-
Notifications
You must be signed in to change notification settings - Fork 41.1k
sheduler_perf: Add test cases for createPodsOp #132488
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?
Conversation
Signed-off-by: utam0k <k0ma@utam0k.jp>
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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 kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: utam0k The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
// verifyNamespaceCreated returns a verification function that checks if a namespace was created. | ||
func verifyNamespaceCreated(expectedNamespace string) verifyFunc { | ||
return func(t *testing.T, tCtx ktesting.TContext, op realOp) error { | ||
_, err := tCtx.Client().CoreV1().Namespaces().Get(context.Background(), expectedNamespace, metav1.GetOptions{}) |
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.
Use tCtx
instead of context.Background()
namespace := fmt.Sprintf("namespace-%d", 0) // default namespace pattern | ||
if opDetails.Namespace != nil { | ||
namespace = *opDetails.Namespace | ||
} |
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.
Don't put this logic in tests. I'd expect we obtain the namespace from the expectedPodTemplate
.
if opDetails.Namespace != nil { | ||
namespace = *opDetails.Namespace | ||
} | ||
podsList, listErr := tCtx.Client().CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{}) |
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.
podsList, listErr := tCtx.Client().CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{}) | |
podsList, err := tCtx.Client().CoreV1().Pods(namespace).List(tCtx, metav1.ListOptions{}) |
if opType.Namespace != nil { | ||
namespace = *opType.Namespace | ||
} | ||
pods, err := tCtx.Client().CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{}) |
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.
Use tCtx
as a context
name: "Create Single Pod", | ||
op: &createPodsOp{ | ||
Opcode: createPodsOpcode, | ||
Count: 1, |
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.
Let's create multiple pods (2)
@@ -208,6 +209,120 @@ func TestRunOp(t *testing.T) { | |||
}, | |||
expectedFailure: true, | |||
}, | |||
{ | |||
name: "Create Single Pod", | |||
op: &createPodsOp{ |
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.
Please also verify other fields, as there are more.
What type of PR is this?
/kind cleanup
/sig scheduling
What this PR does / why we need it:
Add test cases for createPodsOp in scheduler_perf to enhance scheduler performance testing capabilities. This follows the same testing pattern established for createNodesOp.
The tests verify:
Which issue(s) this PR is related to:
Part of #127745
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: