Merge pull request #15355 from github/mbg/go/increase-test-robustness

Go: Improve robustness of integration tests
This commit is contained in:
Michael B. Gale
2024-01-17 16:45:30 +00:00
committed by GitHub
98 changed files with 249 additions and 47 deletions

View File

@@ -1,7 +1,7 @@
#select
| src/test.go:0:0:0:0 | src/test.go |
| src/todel.go:0:0:0:0 | src/todel.go |
htmlFiles
extractionErrors
| Extraction failed in test.go with error \tother declaration of test | 2 |
| Extraction failed in todel.go with error test redeclared in this block | 2 |
#select
| test.go:0:0:0:0 | test.go |
| todel.go:0:0:0:0 | todel.go |

View File

@@ -1,8 +1,19 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,7 +1,7 @@
#select
| src/test.go:0:0:0:0 | src/test.go |
| src/todel.go:0:0:0:0 | src/todel.go |
htmlFiles
extractionErrors
| Extraction failed in test.go with error \tother declaration of test | 2 |
| Extraction failed in todel.go with error test redeclared in this block | 2 |
#select
| test.go:0:0:0:0 | test.go |
| todel.go:0:0:0:0 | todel.go |

View File

@@ -1,8 +1,19 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,9 +1,19 @@
import sys
import os
import subprocess
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
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"])

View File

@@ -1,9 +1,19 @@
import sys
import os
import subprocess
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
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"])

View File

@@ -1,9 +1,19 @@
import sys
import os
import subprocess
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
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"])

View File

@@ -1,9 +1,19 @@
import sys
import os
import subprocess
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
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"])

View File

@@ -1,9 +1,19 @@
import sys
import os
import subprocess
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
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"])

View File

@@ -1,9 +1,19 @@
import sys
import os
import subprocess
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
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"])

View File

@@ -1,9 +1,19 @@
import sys
import os
import subprocess
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
os.environ['GITHUB_REPOSITORY'] = "a/b"
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"])

View File

@@ -1,4 +1,4 @@
#select
| src/test.go:0:0:0:0 | src/test.go |
htmlFiles
extractionErrors
#select
| test.go:0:0:0:0 | test.go |

View File

@@ -1,5 +1,15 @@
import sys
import os
import subprocess
from create_database_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,4 +1,4 @@
#select
| src/test.go:0:0:0:0 | src/test.go |
htmlFiles
extractionErrors
#select
| test.go:0:0:0:0 | test.go |

View File

@@ -1,5 +1,15 @@
import sys
import os
import subprocess
from create_database_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,4 +1,4 @@
#select
| src/test.go:0:0:0:0 | src/test.go |
htmlFiles
extractionErrors
#select
| test.go:0:0:0:0 | test.go |

View File

@@ -1,5 +1,15 @@
import sys
import os
import subprocess
from create_database_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,4 +1,4 @@
#select
| src/test.go:0:0:0:0 | src/test.go |
htmlFiles
extractionErrors
#select
| test.go:0:0:0:0 | test.go |

View File

@@ -1,5 +1,15 @@
import sys
import os
import subprocess
from create_database_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,8 +1,18 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,8 +1,18 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,8 +1,18 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,8 +1,18 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,8 +1,18 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,8 +1,18 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])

View File

@@ -1,8 +1,18 @@
import sys
import os
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], lang="go")
# 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"])