Skip to content

Commit 7792578

Browse files
committed
test: Add check for coredns deployment
1 parent 1cf57db commit 7792578

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
@@ -165,6 +165,18 @@ var _ = Describe("Quick start", Serial, func() {
165165
),
166166
},
167167
)
168+
169+
WaitForCoreDNSToBeReadyInWorkloadCluster(
170+
ctx,
171+
WaitForCoreDNSToBeReadyInWorkloadClusterInput{
172+
WorkloadCluster: workloadCluster,
173+
ClusterProxy: proxy,
174+
DeploymentIntervals: testE2EConfig.GetIntervals(
175+
flavour,
176+
"wait-deployment",
177+
),
178+
},
179+
)
168180
},
169181
}
170182
})

test/e2e/self_hosted_test.go

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

0 commit comments

Comments
 (0)