Skip to content

Commit 80c522b

Browse files
committed
test: Add check for coredns deployment
1 parent 3eae779 commit 80c522b

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

test/e2e/coredns_helpers.go

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//go:build e2e
2+
3+
// Copyright 2024 Nutanix. All rights reserved.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
package e2e
7+
8+
import (
9+
"context"
10+
11+
appsv1 "k8s.io/api/apps/v1"
12+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
14+
"sigs.k8s.io/cluster-api/test/framework"
15+
)
16+
17+
type WaitForCoreDNSToBeReadyInWorkloadClusterInput struct {
18+
WorkloadCluster *clusterv1.Cluster
19+
ClusterProxy framework.ClusterProxy
20+
DeploymentIntervals []interface{}
21+
}
22+
23+
func WaitForCoreDNSToBeReadyInWorkloadCluster(
24+
ctx context.Context,
25+
input WaitForCoreDNSToBeReadyInWorkloadClusterInput,
26+
) {
27+
workloadClusterClient := input.ClusterProxy.GetWorkloadCluster(
28+
ctx, input.WorkloadCluster.Namespace, input.WorkloadCluster.Name,
29+
).GetClient()
30+
31+
WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
32+
Getter: workloadClusterClient,
33+
Deployment: &appsv1.Deployment{
34+
ObjectMeta: metav1.ObjectMeta{
35+
Name: "coredns",
36+
Namespace: metav1.NamespaceSystem,
37+
},
38+
},
39+
}, input.DeploymentIntervals...)
40+
}

test/e2e/quick_start_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,18 @@ var _ = Describe("Quick start", Serial, func() {
163163
),
164164
},
165165
)
166+
167+
WaitForCoreDNSToBeReadyInWorkloadCluster(
168+
ctx,
169+
WaitForCoreDNSToBeReadyInWorkloadClusterInput{
170+
WorkloadCluster: workloadCluster,
171+
ClusterProxy: proxy,
172+
DeploymentIntervals: testE2EConfig.GetIntervals(
173+
flavour,
174+
"wait-deployment",
175+
),
176+
},
177+
)
166178
},
167179
}
168180
})

test/e2e/self_hosted_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ var _ = Describe("Self-hosted", Serial, func() {
101101
),
102102
},
103103
)
104+
105+
WaitForCoreDNSToBeReadyInWorkloadCluster(
106+
ctx,
107+
WaitForCoreDNSToBeReadyInWorkloadClusterInput{
108+
WorkloadCluster: workloadCluster,
109+
ClusterProxy: proxy,
110+
DeploymentIntervals: e2eConfig.GetIntervals(
111+
flavour,
112+
"wait-deployment",
113+
),
114+
},
115+
)
104116
},
105117
}
106118
})

0 commit comments

Comments
 (0)