-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix flaky tests by disabling automatic plugin acquisition for all tes…
…ts (#2190) Disable automatic acquisition globally in the repository - this should ensure we do not use the GH API during tests and make our tests here a lot more robust. Instead manually install all required plugins in the Makefile as a dependency of the tests. This ensures we only do it once and do not spam the GH API with redundant requests causing test flakes. I've hit this more than 5 times on separate PRs in the last few days. It's seriously slowing down progress in the repo. When we do hit the GH rate limit, we have to wait for up to an hour for it to reset. ~Skip `TestConvertViaPulumiCLI` until pulumi/pulumi#16469 is addressed.~ ~Skip `TestResourceWithoutID` until #2191 is addressed.~ Looks like we were using the wrong env variable name... One of the tests was also absolutely spamming the GH API: https://github.com/pulumi/pulumi-terraform-bridge/actions/runs/9973182117/job/27557985796?pr=2190 Latest failures: https://github.com/pulumi/pulumi-terraform-bridge/actions/runs/9972810153/job/27556840950?pr=2186 fixes #2191
- Loading branch information
1 parent
4fbc7ed
commit 45e5bcc
Showing
9 changed files
with
95 additions
and
106 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
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
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
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
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
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
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
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
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,49 @@ | ||
// Copyright 2016-2023, Pulumi Corporation. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package testutil | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/blang/semver" | ||
"github.com/pulumi/pulumi/pkg/v3/testing/integration" | ||
"github.com/pulumi/pulumi/sdk/v3/go/common/apitype" | ||
"github.com/pulumi/pulumi/sdk/v3/go/common/diag" | ||
"github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" | ||
"github.com/pulumi/pulumi/sdk/v3/go/common/workspace" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// RandomProvider returns a [integration.LocalDependency] reference to the random provider | ||
// installed via `make install_plugins`. | ||
func RandomProvider(t *testing.T) integration.LocalDependency { | ||
return pluginDependency(t, "random", semver.Version{Major: 4, Minor: 16, Patch: 3}) | ||
} | ||
|
||
func pluginDependency(t *testing.T, name string, version semver.Version) integration.LocalDependency { | ||
path, err := workspace.GetPluginPath( | ||
diag.DefaultSink(os.Stdout, os.Stderr, diag.FormatOptions{ | ||
Color: colors.Never, | ||
}), | ||
apitype.ResourcePlugin, name, &version, nil) | ||
require.NoError(t, err, | ||
`The %s provider at this version should have been installed by "make install_plugins"`, name) | ||
return integration.LocalDependency{ | ||
Package: name, | ||
Path: filepath.Dir(path), | ||
} | ||
} |