Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit bae6ec9

Browse files
committed
test: more robust test<->deployment binding
The anonymous function is bound to the loop variables which change their content. This works with the current Ginkgo v1.12.1 where Describe calls the function immediately, but in Ginkgo v1.14.1 that changes and the function is stored and called much later. To prepare for that, each function instance must be bound to copies of the loop variables. Otherwise for example a test for "operator" runs with the deployment for "direct-testing".
1 parent 1c28809 commit bae6ec9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/e2e/deploy/deploy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,9 @@ func Describe(deployment, describe, what string, f func(d *Deployment)) bool {
10501050
// DefineTests must be called to register all tests defined so far via Describe.
10511051
func DefineTests() {
10521052
for deploymentName, group := range tests {
1053+
deploymentName := deploymentName
10531054
for describe, funcs := range group {
1055+
funcs := funcs
10541056
ginkgo.Describe(describe, func() {
10551057
deployment := EnsureDeployment(deploymentName)
10561058
for _, f := range funcs {

0 commit comments

Comments
 (0)