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:
Patrick Ohly
2022-10-17 14:47:15 +02:00
parent 63ff4a2659
commit df5d84ae81
291 changed files with 1542 additions and 1454 deletions

View File

@@ -18,6 +18,7 @@ package gcp
import (
"bytes"
"context"
"fmt"
"os"
"os/exec"
@@ -111,7 +112,7 @@ var _ = SIGDescribe("GKE system requirements [NodeConformance][Feature:GKEEnv][N
e2eskipper.RunIfSystemSpecNameIs("gke")
})
ginkgo.It("The required processes should be running", func() {
ginkgo.It("The required processes should be running", func(ctx context.Context) {
cmdToProcessMap, err := getCmdToProcessMap()
framework.ExpectNoError(err)
for _, p := range []struct {
@@ -125,10 +126,10 @@ var _ = SIGDescribe("GKE system requirements [NodeConformance][Feature:GKEEnv][N
framework.ExpectNoError(checkProcess(p.cmd, p.ppid, cmdToProcessMap))
}
})
ginkgo.It("The iptable rules should work (required by kube-proxy)", func() {
ginkgo.It("The iptable rules should work (required by kube-proxy)", func(ctx context.Context) {
framework.ExpectNoError(checkIPTables())
})
ginkgo.It("The GCR is accessible", func() {
ginkgo.It("The GCR is accessible", func(ctx context.Context) {
framework.ExpectNoError(checkPublicGCR())
})
})