Skip to content

Commit

Permalink
docs: fix README.md TestMain example
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Sestito <[email protected]>
  • Loading branch information
fabriziosestito committed Nov 25, 2024
1 parent 27153df commit 2f870a9
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 2f870a9

Please sign in to comment.