Skip to content

Commit

Permalink
Merge c1c84ea into d567784
Browse files Browse the repository at this point in the history
  • Loading branch information
valaparthvi authored Jun 17, 2022
2 parents d567784 + c1c84ea commit 2d1982c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/integration/cmd_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ var _ = Describe("odo create/delete/list/set namespace/project tests", func() {
AfterEach(func() {
helper.CommonAfterEach(commonVar)
})

for _, commandName := range []string{"namespace", "project"} {

// this is a workaround to ensure that the for loop works with `It` blocks
commandName := commandName
Describe("create "+commandName, func() {

namespace := fmt.Sprintf("%s-%s", helper.RandString(4), commandName)

// TODO: Remove for loop; find a way to use DescribeTable
It(fmt.Sprintf("should successfully create the %s", commandName), func() {
helper.Cmd("odo", "create", commandName, namespace, "--wait").ShouldPass()
defer func(ns string) {
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/devfile/cmd_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ var _ = Describe("odo delete command tests", func() {
},
},
} {
// this is a workaround to ensure that the for loop works with `It` blocks
ctx := ctx
When(ctx.title, func() {
BeforeEach(func() {
// Hardcoded names from `ctx.devfileName`
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/devfile/cmd_describe_binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ var _ = Describe("odo describe binding command tests", func() {
},
},
} {
// this is a workaround to ensure that for loop works well with `It` blocks
ctx := ctx
When(ctx.title, func() {
cmpName := "my-nodejs-app"
BeforeEach(func() {
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/devfile/cmd_devfile_build_images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ var _ = Describe("odo devfile build-images command tests", func() {
},
},
} {
// this is a workaround to ensure that the for loop works with `It` blocks
scope := scope
It(fmt.Sprintf("should build image via %s if build context references PROJECT_SOURCE env var", scope.name), func() {
stdout := helper.Cmd("odo", "build-images").AddEnv(scope.envvars...).ShouldPass().Out()
lines, err := helper.ExtractLines(stdout)
Expand Down Expand Up @@ -144,6 +146,8 @@ var _ = Describe("odo devfile build-images command tests", func() {
},
},
} {
// this is a workaround to ensure that the for loop works with `It` blocks
scope := scope
It(fmt.Sprintf("should build image via %s by defaulting build context to devfile path", scope.name), func() {
stdout := helper.Cmd("odo", "build-images").AddEnv(scope.envvars...).ShouldPass().Out()
lines, err := helper.ExtractLines(stdout)
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/devfile/cmd_devfile_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ var _ = Describe("odo devfile deploy command tests", func() {
},
},
} {
// this is a workaround to ensure that the for loop works with `It` blocks
ctx := ctx

When(ctx.title, func() {
// from devfile
Expand Down Expand Up @@ -214,6 +216,9 @@ var _ = Describe("odo devfile deploy command tests", func() {
},
},
} {
// this is a workaround to ensure that the for loop works with `It` blocks
scope := scope

It(fmt.Sprintf("should build image via %s if build context references PROJECT_SOURCE env var", scope.name), func() {
stdout := helper.Cmd("odo", "deploy").AddEnv(scope.envvars...).ShouldPass().Out()
lines, err := helper.ExtractLines(stdout)
Expand Down Expand Up @@ -258,6 +263,9 @@ var _ = Describe("odo devfile deploy command tests", func() {
},
},
} {
// this is a workaround to ensure that the for loop works with `It` blocks
scope := scope

It(fmt.Sprintf("should build image via %s by defaulting build context to devfile path", scope.name), func() {
stdout := helper.Cmd("odo", "deploy").AddEnv(scope.envvars...).ShouldPass().Out()
lines, err := helper.ExtractLines(stdout)
Expand Down

0 comments on commit 2d1982c

Please sign in to comment.