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

@@ -64,7 +64,7 @@ var _ = utils.SIGDescribe("EmptyDir wrapper volumes", func() {
Testname: EmptyDir Wrapper Volume, Secret and ConfigMap volumes, no conflict
Description: Secret volume and ConfigMap volume is created with data. Pod MUST be able to start with Secret and ConfigMap volumes mounted into the container.
*/
framework.ConformanceIt("should not conflict", func() {
framework.ConformanceIt("should not conflict", func(ctx context.Context) {
name := "emptydir-wrapper-test-" + string(uuid.NewUUID())
volumeName := "secret-volume"
volumeMountPath := "/etc/secret-volume"
@@ -186,7 +186,7 @@ var _ = utils.SIGDescribe("EmptyDir wrapper volumes", func() {
Testname: EmptyDir Wrapper Volume, ConfigMap volumes, no race
Description: Create 50 ConfigMaps Volumes and 5 replicas of pod with these ConfigMapvolumes mounted. Pod MUST NOT fail waiting for Volumes.
*/
framework.ConformanceIt("should not cause race condition when used for configmaps [Serial]", func() {
framework.ConformanceIt("should not cause race condition when used for configmaps [Serial]", func(ctx context.Context) {
configMapNames := createConfigmapsForRace(f)
defer deleteConfigMaps(f, configMapNames)
volumes, volumeMounts := makeConfigMapVolumes(configMapNames)
@@ -199,7 +199,7 @@ var _ = utils.SIGDescribe("EmptyDir wrapper volumes", func() {
// This test uses deprecated GitRepo VolumeSource so it MUST not be promoted to Conformance.
// To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.
// This projected volume maps approach can also be tested with secrets and downwardapi VolumeSource but are less prone to the race problem.
ginkgo.It("should not cause race condition when used for git_repo [Serial] [Slow]", func() {
ginkgo.It("should not cause race condition when used for git_repo [Serial] [Slow]", func(ctx context.Context) {
gitURL, gitRepo, cleanup := createGitServer(f)
defer cleanup()
volumes, volumeMounts := makeGitRepoVolumes(gitURL, gitRepo)