Do not run mlops-stacks integration test in parallel (#1982)

## Changes
This test changes the cwd using the `testutil.Chdir` function. This
causes flakiness with other integration tests, like
`TestAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles`, which
rely on the cwd being configured correctly to read test fixtures.

The `t.Setenv` call in `testutil.Chdir` ensures that it is not run from
a test whose upstream is executing in parallel.
This commit is contained in:
shreyas-goenka 2024-12-09 18:04:27 +05:30 committed by GitHub
parent 227a13556b
commit e0d54f0bb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,6 @@ func TestAccBundleInitErrorOnUnknownFields(t *testing.T) {
// make changes that can break the MLOps Stacks DAB. In which case we should // make changes that can break the MLOps Stacks DAB. In which case we should
// skip this test until the MLOps Stacks DAB is updated to work again. // skip this test until the MLOps Stacks DAB is updated to work again.
func TestAccBundleInitOnMlopsStacks(t *testing.T) { func TestAccBundleInitOnMlopsStacks(t *testing.T) {
t.Parallel()
env := testutil.GetCloud(t).String() env := testutil.GetCloud(t).String()
tmpDir1 := t.TempDir() tmpDir1 := t.TempDir()

View File

@ -51,6 +51,10 @@ func GetEnvOrSkipTest(t *testing.T, name string) string {
// Changes into specified directory for the duration of the test. // Changes into specified directory for the duration of the test.
// Returns the current working directory. // Returns the current working directory.
func Chdir(t *testing.T, dir string) string { func Chdir(t *testing.T, dir string) string {
// Prevent parallel execution when changing the working directory.
// t.Setenv automatically fails if t.Parallel is set.
t.Setenv("DO_NOT_RUN_IN_PARALLEL", "true")
wd, err := os.Getwd() wd, err := os.Getwd()
require.NoError(t, err) require.NoError(t, err)