Skip to content

Commit

Permalink
fix clusterproxy interface
Browse files Browse the repository at this point in the history
  • Loading branch information
shysank committed Mar 24, 2021
1 parent fcc3879 commit 33ee559
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 3 additions & 9 deletions test/e2e/kcp_adoption.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,11 @@ import (
type KCPAdoptionSpecInput struct {
E2EConfig *clusterctl.E2EConfig
ClusterctlConfigPath string
BootstrapClusterProxy ClusterProxy
BootstrapClusterProxy framework.ClusterProxy
ArtifactFolder string
SkipCleanup bool
}

type ClusterProxy interface {
framework.ClusterProxy

ApplyWithArgs(context.Context, []byte, ...string) error
}

// KCPAdoptionSpec implements a test that verifies KCP to properly adopt existing control plane Machines
func KCPAdoptionSpec(ctx context.Context, inputGetter func() KCPAdoptionSpecInput) {
var (
Expand Down Expand Up @@ -111,7 +105,7 @@ func KCPAdoptionSpec(ctx context.Context, inputGetter func() KCPAdoptionSpecInpu
Expect(workloadClusterTemplate).ToNot(BeNil(), "Failed to get the cluster template")

By("Applying the cluster template yaml to the cluster with the 'initial' selector")
Expect(input.BootstrapClusterProxy.ApplyWithArgs(ctx, workloadClusterTemplate, "--selector", "kcp-adoption.step1")).ShouldNot(HaveOccurred())
Expect(input.BootstrapClusterProxy.Apply(ctx, workloadClusterTemplate, "--selector", "kcp-adoption.step1")).ShouldNot(HaveOccurred())

cluster = framework.DiscoveryAndWaitForCluster(ctx, framework.DiscoveryAndWaitForClusterInput{
Getter: client,
Expand All @@ -132,7 +126,7 @@ func KCPAdoptionSpec(ctx context.Context, inputGetter func() KCPAdoptionSpecInpu
}, WaitForControlPlaneIntervals...)

By("Applying the cluster template yaml to the cluster with the 'kcp' selector")
Expect(input.BootstrapClusterProxy.ApplyWithArgs(ctx, workloadClusterTemplate, "--selector", "kcp-adoption.step2")).ShouldNot(HaveOccurred())
Expect(input.BootstrapClusterProxy.Apply(ctx, workloadClusterTemplate, "--selector", "kcp-adoption.step2")).ShouldNot(HaveOccurred())

var controlPlane *controlplanev1.KubeadmControlPlane
Eventually(func() *controlplanev1.KubeadmControlPlane {
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/kcp_adoption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"context"

. "github.com/onsi/ginkgo"

"sigs.k8s.io/cluster-api/test/framework"
)

var _ = Describe("When testing KCP adoption", func() {
Expand All @@ -30,7 +32,7 @@ var _ = Describe("When testing KCP adoption", func() {
return KCPAdoptionSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy.(ClusterProxy),
BootstrapClusterProxy: bootstrapClusterProxy.(framework.ClusterProxy),
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
}
Expand Down

0 comments on commit 33ee559

Please sign in to comment.