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

@@ -85,7 +85,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut
framework.ExpectNoError(err)
})
ginkgo.It("should add the DisruptionTarget pod failure condition to the evicted pods", func() {
ginkgo.It("should add the DisruptionTarget pod failure condition to the evicted pods", func(ctx context.Context) {
nodeName := getNodeName(f)
nodeSelector := fields.Set{
"spec.nodeName": nodeName,
@@ -188,7 +188,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut
framework.ExpectNoError(err)
})
ginkgo.It("should be able to gracefully shutdown pods with various grace periods", func() {
ginkgo.It("should be able to gracefully shutdown pods with various grace periods", func(ctx context.Context) {
nodeName := getNodeName(f)
nodeSelector := fields.Set{
"spec.nodeName": nodeName,
@@ -302,7 +302,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut
})
ginkgo.It("should be able to handle a cancelled shutdown", func() {
ginkgo.It("should be able to handle a cancelled shutdown", func(ctx context.Context) {
ginkgo.By("Emitting Shutdown signal")
err := emitSignalPrepareForShutdown(true)
framework.ExpectNoError(err)
@@ -326,7 +326,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut
}, nodeStatusUpdateTimeout, pollInterval).Should(gomega.BeNil())
})
ginkgo.It("after restart dbus, should be able to gracefully shutdown", func() {
ginkgo.It("after restart dbus, should be able to gracefully shutdown", func(ctx context.Context) {
// allows manual restart of dbus to work in Ubuntu.
err := overlayDbusConfig()
framework.ExpectNoError(err)
@@ -427,7 +427,7 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut
framework.ExpectNoError(err)
})
ginkgo.It("should be able to gracefully shutdown pods with various grace periods", func() {
ginkgo.It("should be able to gracefully shutdown pods with various grace periods", func(ctx context.Context) {
nodeName := getNodeName(f)
nodeSelector := fields.Set{
"spec.nodeName": nodeName,