Skip to content

Commit 7a0aad8

Browse files
committed
Go: Use shared library for integration tests
1 parent 4673fff commit 7a0aad8

File tree

30 files changed

+96
-411
lines changed

30 files changed

+96
-411
lines changed
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
import os
2-
import subprocess
1+
from go_integration_test import *
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
6-
7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
12-
13-
run_codeql_database_create([], lang="go", source="src")
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
3+
go_integration_test()
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
import os
2-
import subprocess
1+
from go_integration_test import *
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
6-
7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
12-
13-
run_codeql_database_create([], lang="go", source="src")
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
3+
go_integration_test()
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
13-
run_codeql_database_create([], lang="go", source="work", db=None)
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test(source="work", db=None)
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
13-
run_codeql_database_create([], lang="go", source="work")
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test(source="work")
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
13-
run_codeql_database_create([], lang="go", source="src")
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test()
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
13-
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully)
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test(source="work", db=None, runFunction=runUnsuccessfully)
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
13-
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully)
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test(source="work", db=None, runFunction=runUnsuccessfully)
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
13-
run_codeql_database_create([], lang="go", source="work", db=None)
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test(source="work", db=None)
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
13-
run_codeql_database_create([], lang="go", source="work", db=None)
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test(source="work", db=None)
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import os
2-
import subprocess
32

4-
from create_database_utils import *
5-
from diagnostics_test_utils import *
3+
from go_integration_test import *
64

7-
# Set up a GOPATH relative to this test's root directory;
8-
# we set os.environ instead of using extra_env because we
9-
# need it to be set for the call to "go clean -modcache" later
10-
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11-
os.environ['GOPATH'] = goPath
125
os.environ['GITHUB_REPOSITORY'] = "a/b"
13-
run_codeql_database_create([], lang="go", source="work", db=None)
14-
15-
check_diagnostics()
16-
17-
# Clean up the temporary GOPATH to prevent Bazel failures next
18-
# time the tests are run; see https://github.com/golang/go/issues/27161
19-
subprocess.call(["go", "clean", "-modcache"])
6+
go_integration_test(source="work", db=None)

0 commit comments

Comments
 (0)