-
Notifications
You must be signed in to change notification settings - Fork 271
WIP: Kms preflight positive assertion #2439
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,9 +75,14 @@ func TestEncryptionTypeAESGCM(ctx context.Context, t testing.TB, scenario BasicS | |
| func TestEncryptionTypeKMS(ctx context.Context, t testing.TB, scenario BasicScenario, providers ...EncryptionProvider) { | ||
| provider := resolveProvider(t, configv1.EncryptionTypeKMS, providers) | ||
| e := NewE(t, PrintEventsOnFailure(scenario.OperatorNamespace)) | ||
| // Snapshot preflight before applying the new config so the assertion can confirm a fresh | ||
| // preflight ran for it (the remote key id advances when the config genuinely changes). | ||
| previousPreflight, err := ReadKMSPreflightForOperator(ctx, e, GetClients(e), scenario.OperatorNamespace) | ||
| require.NoError(e, err) | ||
| clientSet := SetAndWaitForEncryptionType(ctx, e, provider, scenario.TargetGRs, scenario.Namespace, scenario.LabelSelector) | ||
| scenario.AssertFunc(e, clientSet, provider.Type, scenario.Namespace, scenario.LabelSelector) | ||
| AssertEncryptionConfig(e, clientSet, scenario.EncryptionConfigSecretName, scenario.EncryptionConfigSecretNamespace, scenario.TargetGRs) | ||
| AssertKMSPreflightSucceededForOperator(ctx, e, clientSet, scenario.OperatorNamespace, previousPreflight) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably not important but wouldn't it be better to assert preflight before the AssertEncryptionConfig?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to make sure the preflight ran after setting the encryption mode/cfg which happens in the SetAndWaitForEncryptionType function. does it make sense ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is correct. But conceptually this should be in this order; AssertKMSPreflightSucceededForOperator(ctx, e, clientSet, scenario.OperatorNamespace, previousPreflight)
AssertEncryptionConfig(e, clientSet, scenario.EncryptionConfigSecretName, scenario.EncryptionConfigSecretNamespace, scenario.TargetGRs)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it matters but I can change the order.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I agree. It is not important. |
||
| } | ||
|
|
||
| func TestEncryptionType(ctx context.Context, t testing.TB, scenario BasicScenario, provider EncryptionProvider) { | ||
|
|
||
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Return the dynamic-client read error.
The callback discards every
Geterror. A forbidden response, invalid resource mapping, or transport failure waits until timeout and hides the original cause. Returnerrfrom the callback.Proposed fix
obj, err := dynamicClient.Resource(gvr).Get(ctx, name, metav1.GetOptions{}) if err != nil { - return false, nil + return false, err }As per coding guidelines and path instructions, “Never ignore error returns.”
📝 Committable suggestion
🧰 Tools
🪛 golangci-lint (2.12.2)
[error] 447-447: error is not nil (line 445) but it returns nil
(nilerr)
🤖 Prompt for AI Agents
Sources: Coding guidelines, Path instructions, Linters/SAST tools