-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16214 from github/mbg/go/use-shared-integration-t…
…est-code Go: Use shared integration test code
- Loading branch information
Showing
31 changed files
with
104 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 2 additions & 18 deletions
20
go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
|
||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
20 changes: 2 additions & 18 deletions
20
go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
|
||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
17 changes: 2 additions & 15 deletions
17
...gration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" | ||
run_codeql_database_create([], lang="go", source="work", db=None) | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test(source="work", db=None) |
17 changes: 2 additions & 15 deletions
17
go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" | ||
run_codeql_database_create([], lang="go", source="work") | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test(source="work") |
17 changes: 2 additions & 15 deletions
17
go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" | ||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
17 changes: 2 additions & 15 deletions
17
go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" | ||
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully) | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test(source="work", db=None, runFunction=runUnsuccessfully) |
17 changes: 2 additions & 15 deletions
17
go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" | ||
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully) | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test(source="work", db=None, runFunction=runUnsuccessfully) |
17 changes: 2 additions & 15 deletions
17
go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" | ||
run_codeql_database_create([], lang="go", source="work", db=None) | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test(source="work", db=None) |
17 changes: 2 additions & 15 deletions
17
...l/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" | ||
run_codeql_database_create([], lang="go", source="work", db=None) | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test(source="work", db=None) |
17 changes: 2 additions & 15 deletions
17
go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
import os | ||
import subprocess | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
from go_integration_test import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
os.environ['GITHUB_REPOSITORY'] = "a/b" | ||
run_codeql_database_create([], lang="go", source="work", db=None) | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test(source="work", db=None) |
16 changes: 2 additions & 14 deletions
16
go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
14 changes: 14 additions & 0 deletions
14
go/ql/integration-tests/all-platforms/go/go-mod-sample/diagnostics.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"markdownMessage": "A single `go.mod` file was found.\n\n`go.mod`", | ||
"severity": "note", | ||
"source": { | ||
"extractorName": "go", | ||
"id": "go/autobuilder/single-root-go-mod-found", | ||
"name": "A single `go.mod` file was found in the root" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": false, | ||
"statusPage": false, | ||
"telemetry": true | ||
} | ||
} |
16 changes: 2 additions & 14 deletions
16
go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
19 changes: 2 additions & 17 deletions
19
go/ql/integration-tests/all-platforms/go/go-mod-without-version/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
19 changes: 2 additions & 17 deletions
19
go/ql/integration-tests/all-platforms/go/go-version-bump/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
14 changes: 14 additions & 0 deletions
14
go/ql/integration-tests/all-platforms/go/make-sample/diagnostics.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"markdownMessage": "A single `go.mod` file was found.\n\n`go.mod`", | ||
"severity": "note", | ||
"source": { | ||
"extractorName": "go", | ||
"id": "go/autobuilder/single-root-go-mod-found", | ||
"name": "A single `go.mod` file was found in the root" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": false, | ||
"statusPage": false, | ||
"telemetry": true | ||
} | ||
} |
16 changes: 2 additions & 14 deletions
16
go/ql/integration-tests/all-platforms/go/make-sample/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
19 changes: 2 additions & 17 deletions
19
go/ql/integration-tests/all-platforms/go/mixed-layout/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
import os | ||
import subprocess | ||
from go_integration_test import * | ||
|
||
from create_database_utils import * | ||
from diagnostics_test_utils import * | ||
|
||
# Set up a GOPATH relative to this test's root directory; | ||
# we set os.environ instead of using extra_env because we | ||
# need it to be set for the call to "go clean -modcache" later | ||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") | ||
os.environ['GOPATH'] = goPath | ||
run_codeql_database_create([], lang="go", source="src") | ||
|
||
check_diagnostics() | ||
|
||
# Clean up the temporary GOPATH to prevent Bazel failures next | ||
# time the tests are run; see https://github.com/golang/go/issues/27161 | ||
subprocess.call(["go", "clean", "-modcache"]) | ||
go_integration_test() |
Oops, something went wrong.