Skip to content

Commit 1e46e43

Browse files
authored
Merge pull request #16823 from smowton/smowton/admin/maven-transfer-failure-test-expectations
Java: Adjust and tolerate variability in test expectations
2 parents d2a00fa + 351b908 commit 1e46e43

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

java/ql/integration-tests/all-platforms/java/diagnostics/dependency-error/diagnostics.expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"markdownMessage": "A dependency failed to download. Check that all dependencies are available, and [supply credentials for any private dependencies](https://github.com/Azure/actions-workflow-samples/blob/master/assets/create-secrets-for-GitHub-workflows.md#set-up-secrets-in-github-action-workflows).\n\nRelevant output line: `Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact junit:junit-nonesuch:jar:4.11 in central (https://repo.maven.apache.org/maven2)`",
2+
"markdownMessage": "A dependency failed to download. Check that all dependencies are available, and [supply credentials for any private dependencies](https://github.com/Azure/actions-workflow-samples/blob/master/assets/create-secrets-for-GitHub-workflows.md#set-up-secrets-in-github-action-workflows).\n\n",
33
"severity": "error",
44
"source": {
55
"extractorName": "java",

java/ql/integration-tests/all-platforms/java/diagnostics/dependency-error/test.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import pathlib
33
import shutil
4+
import re
45

56
from create_database_utils import *
67
from diagnostics_test_utils import *
@@ -13,4 +14,5 @@
1314

1415
run_codeql_database_create([], lang="java", runFunction = runUnsuccessfully, db = None)
1516

16-
check_diagnostics()
17+
# Drop the specific output line here because it varies from version to version of Maven.
18+
check_diagnostics(replacements = {"Relevant output line: [^\"]*": ""})

java/ql/integration-tests/all-platforms/java/diagnostics/maven-http-repository/diagnostics.expected

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
{
2+
"markdownMessage": "A dependency failed to download. Check that all dependencies are available, and [supply credentials for any private dependencies](https://github.com/Azure/actions-workflow-samples/blob/master/assets/create-secrets-for-GitHub-workflows.md#set-up-secrets-in-github-action-workflows).\n\nRelevant output line: `Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.example:maven-sample:jar:1.0-SNAPSHOT: Failed to collect dependencies at junit-nonesuch:junit-nonesuch:jar:4.11`",
3+
"severity": "error",
4+
"source": {
5+
"extractorName": "java",
6+
"id": "java/autobuilder/dependency-download-failure",
7+
"name": "Failed to download a dependency"
8+
},
9+
"visibility": {
10+
"cliSummaryTable": false,
11+
"statusPage": false,
12+
"telemetry": true
13+
}
14+
}
115
{
216
"markdownMessage": "Building your code triggered an access to an insecure HTTP Maven repository. Allow access to insecure repositories, or [update your build to use HTTPS](https://maven.apache.org/docs/3.8.1/release-notes.html#how-to-fix-when-i-get-a-http-repository-blocked).\n\nRelevant output line: `Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact junit-nonesuch:junit-nonesuch:pom:4.11 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [insecure (http://repo.maven.apache.org/maven2/, default, releases+snapshots)]`",
317
"severity": "error",

0 commit comments

Comments
 (0)