mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-02 02:21:22 +00:00
e2e: accept context from Ginkgo
Every ginkgo callback should return immediately when a timeout occurs or the
test run manually gets aborted with CTRL-C. To do that, they must take a ctx
parameter and pass it through to all code which might block.
This is a first automated step towards that: the additional parameter got added
with
sed -i 's/\(framework.ConformanceIt\|ginkgo.It\)\(.*\)func() {$/\1\2func(ctx context.Context) {/' \
$(git grep -l -e framework.ConformanceIt -e ginkgo.It )
$GOPATH/bin/goimports -w $(git status | grep modified: | sed -e 's/.* //')
log_test.go was left unchanged.
This commit is contained in:
@@ -20,6 +20,7 @@ limitations under the License.
|
||||
package e2enode
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
@@ -38,7 +39,7 @@ const contentionLockFile = "/var/run/kubelet.lock"
|
||||
var _ = SIGDescribe("Lock contention [Slow] [Disruptive] [NodeSpecialFeature:LockContention]", func() {
|
||||
|
||||
// Requires `--lock-file` & `--exit-on-lock-contention` flags to be set on the Kubelet.
|
||||
ginkgo.It("Kubelet should stop when the test acquires the lock on lock file and restart once the lock is released", func() {
|
||||
ginkgo.It("Kubelet should stop when the test acquires the lock on lock file and restart once the lock is released", func(ctx context.Context) {
|
||||
|
||||
ginkgo.By("perform kubelet health check to check if kubelet is healthy and running.")
|
||||
// Precautionary check that kubelet is healthy before running the test.
|
||||
|
||||
Reference in New Issue
Block a user