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
test: Speed up K8sServicesTest #11550
Conversation
retest-net-next |
Coverage decreased (-0.02%) to 37.005% when pulling fc6f9bb610ba8e34d1f45ecd94d5a6b2c9df345a on pr/brb/cleanup-svc-tests into 3cef02f on master. |
51d8118
to
c260b30
Compare
test-focus K8sService* |
c260b30
to
848cf86
Compare
test-focus K8sService* |
retest-net-next |
3 similar comments
retest-net-next |
retest-net-next |
retest-net-next |
848cf86
to
9b08238
Compare
test-me-please |
retest-gke |
9b08238
to
6df9fb4
Compare
test-me-please |
retest-gke |
retest-4.9 |
retest-4.19 |
test-me-please |
retest-4.19 |
retest-runtime |
fc6f9bb
to
9c03240
Compare
They don't change during test runs. Signed-off-by: Martynas Pumputis <m@lambda.lt>
Regroup the test cases and run them in parallel. On my machine the invocation of testNodePort() went from ~2:50 min to ~1:15 min. Signed-off-by: Martynas Pumputis <m@lambda.lt>
To avoid excessive "kubectl exec", do curl requests in batches. Signed-off-by: Martynas Pumputis <m@lambda.lt>
It's enough to test it only once, thus the move. Signed-off-by: Martynas Pumputis <m@lambda.lt>
Test ClusterIP from a pod netns and a hostnetns in testNodePort(), so that some ClusterIP test cases can be skipped. Signed-off-by: Martynas Pumputis <m@lambda.lt>
Otherwise, in a case of a failure, ginkgo will panic leaving a cryptic message, from which it's harder to determine which test case has failed. Signed-off-by: Martynas Pumputis <m@lambda.lt>
test-me-please |
retest-net-next |
2 similar comments
retest-net-next |
retest-net-next |
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.
Thanks for this change, couple comments inline, can't wait to merge it!
wg.Add(1) | ||
go func(url string) { | ||
defer wg.Done() | ||
testCurlRequest(testDSClient, url) |
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.
I think you will need to increment ExpectWithOffset
offset (first argument) in each helper test function called in goroutines so we get better context information about error if assertion fails.
} | ||
for _, url := range testURLsFromHosts { | ||
wg.Add(1) | ||
go func(url string) { |
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.
Same as above
for _, url := range testURLsFromOutside { | ||
wg.Add(1) | ||
go func(url string) { | ||
defer wg.Done() |
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.
ditto
fromPod, url, i, count) | ||
} | ||
By("Making %d curl requests from pod (host netns) %s to %q", count, fromPod, url) | ||
cmd := fmt.Sprintf(`/bin/sh -c 'for i in $(seq 1 %d); do %s; done'`, count, |
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.
Holy mother of nesting. But I guess there is no way around this (unless we want to also parallelize curl calls?).
retest-net-next |
retest-4.9 |
1 similar comment
retest-4.9 |
retest-4.19 |
retest-net-next |
2 similar comments
retest-net-next |
retest-net-next |
retest-4.9 |
retest-4.19 |
test-runtime |
@nebril Thanks for the review! Considering that all the tests have passed, can we merge this, and then I will address your comments in a follow-up PR? |
Let's merge, @brb will make a followup PR with QoL fixes. |
This PR speeds up the test suite mainly by unrolling curl requests (to avoid excessive
kubectl exec
) and running them in parallel.Reviewable per commit.
Partially_fix #11442