sidero/sfyra/pkg/tests/workload_cluster.go
Andrey Smirnov ad5f1ed9a9 test: add a test to deploy and destroy workload cluster
This cluster has a single controlplane node just for the sake of testing
with another cluster in place.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-12-02 11:51:12 -08:00

32 lines
1.0 KiB
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package tests
import (
"context"
"testing"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/talos-systems/sidero/sfyra/pkg/capi"
"github.com/talos-systems/sidero/sfyra/pkg/talos"
"github.com/talos-systems/sidero/sfyra/pkg/vm"
)
const (
workloadClusterName = "workload-cluster"
workloadClusterLBPort = 20000
)
// TestWorkloadCluster deploys and destroys the workload cluster via CAPI.
func TestWorkloadCluster(ctx context.Context, metalClient client.Client, cluster talos.Cluster, vmSet *vm.Set, capiManager *capi.Manager) TestFunc {
return func(t *testing.T) {
loadbalancer, _ := deployCluster(ctx, t, metalClient, cluster, vmSet, capiManager, workloadClusterName, workloadServerClassName, workloadClusterLBPort, 1, 0)
defer loadbalancer.Close()
deleteCluster(ctx, t, metalClient, workloadClusterName)
}
}