-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable slow Plugin Framework Config validation #2920
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6127b10
Disable slow Plugin Framework Config validation
t0yv0 5edf8d0
Add a test verifying configure speed does not regress past 5s
t0yv0 21c1bb0
Better test name
t0yv0 8a035c8
Ensure some form of config validation is happening
t0yv0 e99d7f3
Verify that upstream-level validation is still happening
t0yv0 30e1c9b
Drop test stubs
t0yv0 3a2e4f6
go mod tidy
t0yv0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/pulumi/pulumi-aws/examples/v6 | ||
|
||
go 1.21 | ||
go 1.21.0 | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go v1.45.24 | ||
|
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,137 @@ | ||
// 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 provider | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
"testing" | ||
"time" | ||
|
||
testutils "github.com/pulumi/providertest/replay" | ||
pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge" | ||
"github.com/stretchr/testify/require" | ||
|
||
version "github.com/pulumi/pulumi-aws/provider/v6/pkg/version" | ||
) | ||
|
||
func TestCheckConfigWithUnknownKeys(t *testing.T) { | ||
replaySequence(t, strings.ReplaceAll(` | ||
[{ | ||
"method": "/pulumirpc.ResourceProvider/CheckConfig", | ||
"request": { | ||
"urn": "urn:pulumi:dev::aws-2880::pulumi:providers:aws::default_6_5_0", | ||
"olds": {}, | ||
"news": { | ||
"unknownKey": "injected", | ||
"accessKey": "test", | ||
"region": "us-east-1", | ||
"s3UsePathStyle": "true", | ||
"secretKey": "test", | ||
"skipCredentialsValidation": "true", | ||
"skipRequestingAccountId": "true", | ||
"version": "6.5.0" | ||
} | ||
}, | ||
"response": { | ||
"inputs": "*", | ||
"failures": [{"reason": "could not validate provider configuration: Invalid or unknown key. Check '''pulumi config get aws:unknownKey'''."}] | ||
} | ||
}]`, "'''", "`")) | ||
} | ||
|
||
func TestCheckConfigRunsUpstreamValidators(t *testing.T) { | ||
replaySequence(t, strings.ReplaceAll(` | ||
[{ | ||
"method": "/pulumirpc.ResourceProvider/CheckConfig", | ||
"request": { | ||
"urn": "urn:pulumi:dev::aws-2880::pulumi:providers:aws::default_6_5_0", | ||
"olds": {}, | ||
"news": { | ||
"assumeRoleWithWebIdentity": {"roleArn": "INVALID-ARN", "webIdentityToken": "TOKEN"}, | ||
"accessKey": "test", | ||
"region": "us-east-1", | ||
"s3UsePathStyle": "true", | ||
"secretKey": "test", | ||
"skipCredentialsValidation": "true", | ||
"skipRequestingAccountId": "true", | ||
"version": "6.5.0" | ||
} | ||
}, | ||
"response": { | ||
"inputs": "*", | ||
"failures": [ | ||
{"reason": "could not validate provider configuration: \"assume_role_with_web_identity.0.role_arn\" (INVALID-ARN) is an invalid ARN: arn: invalid prefix. Check '''pulumi config get --path aws:assumeRoleWithWebIdentity.roleArn'''."} | ||
] | ||
} | ||
}]`, "'''", "`")) | ||
} | ||
|
||
func TestCheckConfigFastWithCustomEndpoints(t *testing.T) { | ||
time0 := time.Now() | ||
replaySequence(t, ` | ||
[{ | ||
"method": "/pulumirpc.ResourceProvider/CheckConfig", | ||
"request": { | ||
"urn": "urn:pulumi:dev::aws-2880::pulumi:providers:aws::default_6_5_0", | ||
"olds": {}, | ||
"news": { | ||
"accessKey": "test", | ||
"endpoints": "[{\"accessanalyzer\":\"http://localhost:4566\"},{\"account\":\"http://localhost:4566\"},{\"acm\":\"http://localhost:4566\"},{\"acmpca\":\"http://localhost:4566\"},{\"amg\":\"http://localhost:4566\"},{\"amp\":\"http://localhost:4566\"},{\"amplify\":\"http://localhost:4566\"},{\"apigateway\":\"http://localhost:4566\"},{\"apigatewayv2\":\"http://localhost:4566\"},{\"appautoscaling\":\"http://localhost:4566\"},{\"appconfig\":\"http://localhost:4566\"},{\"appflow\":\"http://localhost:4566\"}]", | ||
"region": "us-east-1", | ||
"s3UsePathStyle": "true", | ||
"secretKey": "test", | ||
"skipCredentialsValidation": "true", | ||
"skipRequestingAccountId": "true", | ||
"version": "6.5.0" | ||
} | ||
}, | ||
"response": { | ||
"inputs": { | ||
"accessKey": "test", | ||
"endpoints": "[{\"accessanalyzer\":\"http://localhost:4566\"},{\"account\":\"http://localhost:4566\"},{\"acm\":\"http://localhost:4566\"},{\"acmpca\":\"http://localhost:4566\"},{\"amg\":\"http://localhost:4566\"},{\"amp\":\"http://localhost:4566\"},{\"amplify\":\"http://localhost:4566\"},{\"apigateway\":\"http://localhost:4566\"},{\"apigatewayv2\":\"http://localhost:4566\"},{\"appautoscaling\":\"http://localhost:4566\"},{\"appconfig\":\"http://localhost:4566\"},{\"appflow\":\"http://localhost:4566\"}]", | ||
"region": "us-east-1", | ||
"s3UsePathStyle": "true", | ||
"secretKey": "test", | ||
"skipCredentialsValidation": "true", | ||
"skipMetadataApiCheck": "true", | ||
"skipRegionValidation": "true", | ||
"skipRequestingAccountId": "true", | ||
"version": "6.5.0" | ||
} | ||
} | ||
}]`) | ||
cutoff := 5 * time.Second | ||
require.Truef(t, time0.Add(cutoff).After(time.Now()), "CheckConfig with custom endpoints is taking more than %v", cutoff) | ||
} | ||
|
||
func replaySequence(t *testing.T, sequence string) { | ||
info := *Provider() | ||
ctx := context.Background() | ||
p, err := pfbridge.MakeMuxedServer(ctx, info.Name, info, | ||
/* | ||
* We leave the schema blank. This will result in incorrect calls to | ||
* GetSchema, but otherwise does not effect the provider. It reduces the | ||
* time to test start by minutes. | ||
*/ | ||
[]byte("{}"), | ||
)(nil) | ||
require.NoError(t, err) | ||
testutils.ReplaySequence(t, p, sequence) | ||
} | ||
|
||
func init() { | ||
version.Version = "6.0.0" | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know this was in the bridge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added to address this P1 specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured 😄