-
Notifications
You must be signed in to change notification settings - Fork 115
CNTRLPLANE-2247:Adding KMS TestKMSEncryptionOnOff test for AUTH #834
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
CNTRLPLANE-2247:Adding KMS TestKMSEncryptionOnOff test for AUTH #834
Conversation
|
@gangwgr: This pull request references CNTRLPLANE-2247 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
WalkthroughThe PR updates the openshift/library-go dependency to a newer version and implements a full end-to-end KMS encryption test, replacing a placeholder with a complete test flow that deploys a mock KMS plugin and validates token encryption and decryption workflows. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
test/e2e/network_policy.go
Outdated
| @@ -0,0 +1,264 @@ | |||
| package e2e | |||
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.
Why do we need this change?. Isn't this out of scope?
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.
my bad i added my network policy feature work in pr
82fda3b to
7927629
Compare
|
/lgtm |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@test/e2e-encryption-kms/encryption_kms_test.go`:
- Around line 30-33: The mock KMS deployment is not cleaned up; update
DeployUpstreamMockKMSPlugin (or the test in encryption_kms_test.go) to register
a cleanup with t.Cleanup that deletes the created namespace/resources (the
namespace is librarykms.WellKnownUpstreamMockKMSPluginNamespace and deployment
is created by librarykms.DeployUpstreamMockKMSPlugin); ensure the cleanup uses
the same clients (library.GetClients(t).Kube) to remove the deployed plugin and
namespace so resources are removed after the test to prevent leakage and
cross-test interference.
| // Deploy the mock KMS plugin for testing. | ||
| // NOTE: This manual deployment is only required for KMS v1. In the future, | ||
| // the platform will manage the KMS plugins, and this code will no longer be needed. | ||
| librarykms.DeployUpstreamMockKMSPlugin(context.Background(), t, library.GetClients(t).Kube, librarykms.WellKnownUpstreamMockKMSPluginNamespace, librarykms.WellKnownUpstreamMockKMSPluginImage) |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find the implementation of DeployUpstreamMockKMSPlugin
rg -n -C5 'func DeployUpstreamMockKMSPlugin' -g '**/*.go'Repository: openshift/cluster-authentication-operator
Length of output: 1697
🏁 Script executed:
#!/bin/bash
# Read the full DeployUpstreamMockKMSPlugin function implementation
sed -n '54,150p' vendor/github.com/openshift/library-go/test/library/encryption/kms/k8s_mock_kms_plugin_deployer.goRepository: openshift/cluster-authentication-operator
Length of output: 3557
🏁 Script executed:
#!/bin/bash
# Check the test file to see if cleanup is registered after calling DeployUpstreamMockKMSPlugin
sed -n '20,60p' test/e2e-encryption-kms/encryption_kms_test.goRepository: openshift/cluster-authentication-operator
Length of output: 2148
🏁 Script executed:
#!/bin/bash
# Search for cleanup or teardown in the test file
rg -n 'Cleanup|cleanup|teardown|defer' test/e2e-encryption-kms/encryption_kms_test.goRepository: openshift/cluster-authentication-operator
Length of output: 67
🏁 Script executed:
#!/bin/bash
# Find and inspect TestEncryptionTurnOnAndOff to see if it handles KMS plugin cleanup
rg -n 'func TestEncryptionTurnOnAndOff' -g '**/*.go' -A 50Repository: openshift/cluster-authentication-operator
Length of output: 8979
🏁 Script executed:
#!/bin/bash
# Check if the test file has any setup/teardown or suite-level cleanup
rg -n 'TestMain|init|defer|t.Cleanup' test/e2e-encryption-kms/encryption_kms_test.goRepository: openshift/cluster-authentication-operator
Length of output: 67
🏁 Script executed:
#!/bin/bash
# Search for the WellKnownUpstreamMockKMSPluginNamespace constant
rg -n 'WellKnownUpstreamMockKMSPluginNamespace' -g '**/*.go' | head -20Repository: openshift/cluster-authentication-operator
Length of output: 688
Add explicit cleanup for the mock KMS plugin deployment.
DeployUpstreamMockKMSPlugin deploys resources to the "k8s-mock-plugin" namespace but does not register cleanup. The test comment mentions cleanup, but no cleanup code exists in the test or library function. Register t.Cleanup() in DeployUpstreamMockKMSPlugin to delete the namespace/resources, or add explicit cleanup in the test to prevent resource leakage and cross-test interference.
🤖 Prompt for AI Agents
In `@test/e2e-encryption-kms/encryption_kms_test.go` around lines 30 - 33, The
mock KMS deployment is not cleaned up; update DeployUpstreamMockKMSPlugin (or
the test in encryption_kms_test.go) to register a cleanup with t.Cleanup that
deletes the created namespace/resources (the namespace is
librarykms.WellKnownUpstreamMockKMSPluginNamespace and deployment is created by
librarykms.DeployUpstreamMockKMSPlugin); ensure the cleanup uses the same
clients (library.GetClients(t).Kube) to remove the deployed plugin and namespace
so resources are removed after the test to prevent leakage and cross-test
interference.
7927629 to
a51c1b7
Compare
2c2e899 to
8428744
Compare
|
/retest-required |
|
I think failures look same. I suspect that tls changes in library-go causing this. Investigating... |
|
/retest |
|
/lgtm |
|
/retest |
8428744 to
8dd3540
Compare
8dd3540 to
5dbb770
Compare
5dbb770 to
d6826ab
Compare
d6826ab to
ea4537d
Compare
|
/lgtm |
|
Failure of e2e-gcp-operator-encryption-kms is expected. Because controllers are not ready to handle KMS encryption type yet (i.e. openshift/library-go#2086). |
|
@ardaguclu: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@gangwgr: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/assign @liouk |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ardaguclu, gangwgr, liouk The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
2d8256b
into
openshift:master
CNTRLPLANE-2247:Adding KMS TestKMSEncryptionOnOff test for AUTH