Skip to content

Commit

Permalink
Merge pull request #466 from fabriziosestito/docs/fix-readme
Browse files Browse the repository at this point in the history
docs: fix README.md TestMain example
  • Loading branch information
k8s-ci-robot authored Nov 27, 2024
2 parents 27153df + 2f870a9 commit 3b609c5
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,24 @@ var (
)

func TestMain(m *testing.M) {
testenv = env.New()
kindClusterName := envconf.RandomName("my-cluster", 16)
namespace := envconf.RandomName("myns", 16)

// Use pre-defined environment funcs to create a kind cluster prior to test run
testenv.Setup(
envfuncs.CreateKindCluster(kindClusterName),
)

// Use pre-defined environment funcs to teardown kind cluster after tests
testenv.Finish(
envfuncs.DeleteNamespace(namespace),
)

// launch package tests
os.Exit(testenv.Run(m))
testenv = env.New()
kindClusterName := envconf.RandomName("my-cluster", 16)
namespace := envconf.RandomName("myns", 16)

// Use pre-defined environment funcs to create a kind cluster prior to test run
testenv.Setup(
envfuncs.CreateCluster(kind.NewProvider(), kindClusterName),
envfuncs.CreateNamespace(namespace),
)

// Use pre-defined environment funcs to teardown kind cluster after tests
testenv.Finish(
envfuncs.DeleteNamespace(namespace),
envfuncs.DestroyCluster(kindClusterName),
)

// launch package tests
os.Exit(testenv.Run(m))
}
```

Expand Down

0 comments on commit 3b609c5

Please sign in to comment.