Skip to content

Commit

Permalink
Make number of nodes per k8s cluster configurable, drop nodes to 1 pe…
Browse files Browse the repository at this point in the history
…r cluster for registration test.
  • Loading branch information
Miles-Garnsey committed May 10, 2024
1 parent 10d540d commit 8d494c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/kubectl-k8ssandra/register/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ var (
func TestMain(m *testing.M) {
os.Exit(envtest.RunMultiKind(m, func(e *envtest.MultiK8sEnvironment) {
multiEnv = e
}, 2))
}, []int{1, 1}))
}
10 changes: 5 additions & 5 deletions internal/envtest/multi_envtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ func RunMulti(m *testing.M, setupFunc func(e *MultiK8sEnvironment), numClusters
return exitCode
}

func RunMultiKind(m *testing.M, setupFunc func(e *MultiK8sEnvironment), numClusters int) (code int) {
e := make(MultiK8sEnvironment, numClusters)
func RunMultiKind(m *testing.M, setupFunc func(e *MultiK8sEnvironment), topology []int) (code int) {
e := make(MultiK8sEnvironment, len(topology))
ctx := ctrl.SetupSignalHandler()
var wg sync.WaitGroup
for i := 0; i < numClusters; i++ {
for i := 0; i < len(topology); i++ {
cluster := KindManager{
ClusterName: "cluster" + strconv.Itoa(i),
KubeconfigLocation: os.NewFile(0, GetBuildDir()+"/cluster"+strconv.Itoa(i)),
Nodes: 3,
Nodes: topology[i],
}
wg.Add(1)
go func(i int) {
Expand All @@ -47,7 +47,7 @@ func RunMultiKind(m *testing.M, setupFunc func(e *MultiK8sEnvironment), numClust
}
wg.Wait()
defer func() {
for i := 0; i < numClusters; i++ {
for i := 0; i < len(topology); i++ {
wg.Add(1)
go func(i int) {
defer wg.Done()
Expand Down

0 comments on commit 8d494c3

Please sign in to comment.