-
Notifications
You must be signed in to change notification settings - Fork 135
OCPBUGS-98060 BUG-FIX Latency Test #1566
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?
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 |
|---|---|---|
|
|
@@ -42,12 +42,12 @@ const ( | |
| hwlatdetectTestName = "hwlatdetect" | ||
|
|
||
| //default values | ||
| defaultTestDelay = 0 | ||
| defaultTestRuntime = "300" | ||
| defaultMaxLatency = -1 | ||
| defaultTestCpus = -1 | ||
| defaultTestMemory = "1Gi" | ||
|
|
||
| defaultTestDelay = 0 | ||
| defaultTestRuntime = "300" | ||
| defaultMaxLatency = -1 | ||
| defaultTestCpus = -1 | ||
| defaultTestMemory = "1Gi" | ||
| defaultTestSetupDelay = 150 | ||
| //dynamic memory mode values | ||
| // 32Mi per requested CPU should be reasonable for the test | ||
| perCpuMemoryFactor = 32 | ||
|
|
@@ -57,11 +57,12 @@ const ( | |
| ) | ||
|
|
||
| var ( | ||
| latencyTestDelay = defaultTestDelay | ||
| latencyTestRuntime = defaultTestRuntime | ||
| maximumLatency = defaultMaxLatency | ||
| latencyTestCpus = defaultTestCpus | ||
| latencyTestMemory = defaultTestMemory | ||
| latencyTestDelay = defaultTestDelay | ||
| latencyTestRuntime = defaultTestRuntime | ||
| latencyTestSetupDelay = defaultTestSetupDelay | ||
| maximumLatency = defaultMaxLatency | ||
| latencyTestCpus = defaultTestCpus | ||
| latencyTestMemory = defaultTestMemory | ||
| ) | ||
|
|
||
| // LATENCY_TEST_DELAY delay the run of the binary, can be useful to give time to the CPU manager reconcile loop | ||
|
|
@@ -79,6 +80,9 @@ var _ = Describe("[performance] Latency Test", Ordered, func() { | |
| latencyTestDelay, err = getLatencyTestDelay() | ||
| Expect(err).ToNot(HaveOccurred()) | ||
|
|
||
| latencyTestSetupDelay, err = getLatencyTestSetupDelay() | ||
| Expect(err).ToNot(HaveOccurred()) | ||
|
|
||
| latencyTestCpus, err = getLatencyTestCpus() | ||
| Expect(err).ToNot(HaveOccurred()) | ||
|
|
||
|
|
@@ -275,6 +279,23 @@ func getLatencyTestDelay() (int, error) { | |
| return defaultTestDelay, nil | ||
| } | ||
|
|
||
| func getLatencyTestSetupDelay() (int, error) { | ||
| if latencyTestSetupDelayEnv, ok := os.LookupEnv("LATENCY_TEST_SETUP_DELAY"); ok { | ||
| val, err := strconv.Atoi(latencyTestSetupDelayEnv) | ||
| if err != nil { | ||
| return val, fmt.Errorf("the environment variable LATENCY_TEST_SETUP_DELAY has incorrect value %q, it must be a non-negative integer with maximum value of %d: %w", latencyTestSetupDelayEnv, math.MaxInt32, err) | ||
| } | ||
| if val < 0 || val > math.MaxInt32 { | ||
| return val, fmt.Errorf("the environment variable LATENCY_TEST_SETUP_DELAY has an invalid number %q, it must be a non-negative integer with maximum value of %d", latencyTestSetupDelayEnv, math.MaxInt32) | ||
| } | ||
| if val < defaultTestSetupDelay { | ||
| testlog.Warningf("LATENCY_TEST_SETUP_DELAY=%d is below %d; for safe execution set it to %d or higher, as a lower value may cause timeouts", val, defaultTestSetupDelay, defaultTestSetupDelay) | ||
| } | ||
| return val, nil | ||
|
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. I think we should guard the value to at least 120, or at least warn the users that to increase the chances of the pod to complete gracefully they need to set the setup delay to at least 120s.
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. Setting the value to 120s leaves the issue unresolved, |
||
| } | ||
| return defaultTestSetupDelay, nil | ||
| } | ||
|
|
||
| func getLatencyTestCpus() (int, error) { | ||
| if latencyTestCpusEnv, ok := os.LookupEnv("LATENCY_TEST_CPUS"); ok { | ||
| val, err := strconv.Atoi(latencyTestCpusEnv) | ||
|
|
@@ -490,12 +511,12 @@ func createLatencyTestPod(testPod *corev1.Pod) { | |
| } | ||
|
|
||
| By("Waiting another two minutes to give enough time for the cluster to move the pod to Succeeded phase") | ||
| podTimeout := time.Duration(timeout + latencyTestDelay + 120) | ||
| podTimeout := time.Duration(timeout + latencyTestDelay + latencyTestSetupDelay) | ||
| testPod, err = pods.WaitForPhase(context.TODO(), client.ObjectKeyFromObject(testPod), corev1.PodSucceeded, podTimeout*time.Second) | ||
| if err != nil { | ||
| logEventsForPod(testPod) | ||
| } | ||
| Expect(err).ToNot(HaveOccurred(), "pod %q did not reach %q phase; error: %v", podKey, corev1.PodSucceeded, err) | ||
| Expect(err).ToNot(HaveOccurred(), "pod %q did not reach %q phase; error: %v. Please Increase LATENCY_TEST_SETUP_DELAY to allow the cluster to move the pod to Succeeded phase and run again.", podKey, corev1.PodSucceeded, err) | ||
| } | ||
|
|
||
| func extractLatencyValues(exp string, pod *corev1.Pod) []int { | ||
|
|
||
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.
or predefine that
var val int32and only validate the err is not nil , and later thatval >0There 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.
Predefining
math.MaxInt32alone doesn’t let us drop the range check, we still need to validate that val is within bounds.Could you clarify the change you had in mind?