-
Notifications
You must be signed in to change notification settings - Fork 173
CNTRLPLANE-3609: update TestEtcdDBScaling to also include the validation check for BackendQuotaGiB #1656
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: main
Are you sure you want to change the base?
CNTRLPLANE-3609: update TestEtcdDBScaling to also include the validation check for BackendQuotaGiB #1656
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 |
|---|---|---|
|
|
@@ -32,13 +32,28 @@ const ( | |
|
|
||
| func TestEtcdDBScaling(t testing.TB) { | ||
| dbSizeGB := int32(16) | ||
| invalidLowDBSizeGB := int32(7) | ||
| invalidHighDBSizeGB := int32(17) | ||
| opClientSet := framework.NewOperatorClient(t) | ||
| clientSet := framework.NewClientSet("") | ||
| etcdPodsClient := clientSet.CoreV1Interface.Pods(operandNameSpace) | ||
|
|
||
| // first check the validation | ||
| etcdCR, err := opClientSet.OperatorV1().Etcds().Get(context.Background(), etcdCRName, metav1.GetOptions{}) | ||
| require.NoError(t, err) | ||
| etcdCR.Spec.BackendQuotaGiB = invalidLowDBSizeGB | ||
| etcdCR, err = opClientSet.OperatorV1().Etcds().Update(context.Background(), etcdCR, metav1.UpdateOptions{}) | ||
| require.Error(t, err) | ||
|
|
||
| etcdCR, err = opClientSet.OperatorV1().Etcds().Get(context.Background(), etcdCRName, metav1.GetOptions{}) | ||
| require.NoError(t, err) | ||
| etcdCR.Spec.BackendQuotaGiB = invalidHighDBSizeGB | ||
| etcdCR, err = opClientSet.OperatorV1().Etcds().Update(context.Background(), etcdCR, metav1.UpdateOptions{}) | ||
| require.Error(t, err) | ||
|
|
||
| // valid update | ||
| etcdCR, err = opClientSet.OperatorV1().Etcds().Get(context.Background(), etcdCRName, metav1.GetOptions{}) | ||
| require.NoError(t, err) | ||
|
Comment on lines
42
to
+56
Contributor
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. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show relevant file and surrounding lines
sed -n '1,160p' test/e2e/scaling_dbsize.goRepository: openshift/cluster-etcd-operator Length of output: 3021 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Map functions in the file for context
ast-grep outline test/e2e/scaling_dbsize.go --view expandedRepository: openshift/cluster-etcd-operator Length of output: 573 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find all uses of context.Background in the e2e test file
rg -n "context\.Background\(\)|WithTimeout|WithCancel" test/e2e/scaling_dbsize.goRepository: openshift/cluster-etcd-operator Length of output: 953 Bound all Kubernetes API calls in this test. The 🤖 Prompt for AI AgentsSource: Path instructions |
||
| etcdCR.Spec.BackendQuotaGiB = dbSizeGB | ||
| etcdCR, err = opClientSet.OperatorV1().Etcds().Update(context.Background(), etcdCR, metav1.UpdateOptions{}) | ||
| require.NoError(t, err) | ||
|
|
||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/cluster-etcd-operator
Length of output: 7216
🏁 Script executed:
Repository: openshift/cluster-etcd-operator
Length of output: 50388
🏁 Script executed:
Repository: openshift/cluster-etcd-operator
Length of output: 384
🏁 Script executed:
Repository: openshift/cluster-etcd-operator
Length of output: 1186
🏁 Script executed:
Repository: openshift/cluster-etcd-operator
Length of output: 2854
🏁 Script executed:
Repository: openshift/cluster-etcd-operator
Length of output: 956
🏁 Script executed:
Repository: openshift/cluster-etcd-operator
Length of output: 956
Assert the expected validation error here.
BackendQuotaGiBis schema-limited to 8–16, so these updates should fail withapierrors.IsInvalid(err)rather than any generic error. Checking theBackendQuotaGiBfield cause would make the test even tighter.🤖 Prompt for AI Agents