Skip to content

Commit

Permalink
test: Add check for coredns deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed May 20, 2024
1 parent 1cf57db commit 7792578
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/e2e/coredns_helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//go:build e2e

// Copyright 2024 Nutanix. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package e2e

import (
"context"

appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"
)

type WaitForCoreDNSToBeReadyInWorkloadClusterInput struct {
WorkloadCluster *clusterv1.Cluster
ClusterProxy framework.ClusterProxy
DeploymentIntervals []interface{}
}

func WaitForCoreDNSToBeReadyInWorkloadCluster(
ctx context.Context,
input WaitForCoreDNSToBeReadyInWorkloadClusterInput,
) {
workloadClusterClient := input.ClusterProxy.GetWorkloadCluster(
ctx, input.WorkloadCluster.Namespace, input.WorkloadCluster.Name,
).GetClient()

WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
Getter: workloadClusterClient,
Deployment: &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "coredns",
Namespace: metav1.NamespaceSystem,
},
},
}, input.DeploymentIntervals...)
}
12 changes: 12 additions & 0 deletions test/e2e/quick_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ var _ = Describe("Quick start", Serial, func() {
),
},
)

WaitForCoreDNSToBeReadyInWorkloadCluster(
ctx,
WaitForCoreDNSToBeReadyInWorkloadClusterInput{
WorkloadCluster: workloadCluster,
ClusterProxy: proxy,
DeploymentIntervals: testE2EConfig.GetIntervals(
flavour,
"wait-deployment",
),
},
)
},
}
})
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/self_hosted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ var _ = Describe("Self-hosted", Serial, func() {
),
},
)

WaitForCoreDNSToBeReadyInWorkloadCluster(
ctx,
WaitForCoreDNSToBeReadyInWorkloadClusterInput{
WorkloadCluster: workloadCluster,
ClusterProxy: proxy,
DeploymentIntervals: e2eConfig.GetIntervals(
flavour,
"wait-deployment",
),
},
)
},
}
})
Expand Down

0 comments on commit 7792578

Please sign in to comment.