@@ -19,17 +19,11 @@ package e2e
19
19
import (
20
20
"context"
21
21
"fmt"
22
- "time"
23
22
24
23
"github.com/blang/semver/v4"
25
24
. "github.com/onsi/ginkgo/v2"
26
- . "github.com/onsi/gomega"
27
25
"github.com/onsi/gomega/types"
28
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29
- "k8s.io/klog/v2"
30
- "sigs.k8s.io/controller-runtime/pkg/client"
31
26
32
- clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2"
33
27
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
34
28
)
35
29
@@ -89,47 +83,3 @@ func GetLatestReleaseOfMinor(ctx context.Context, minorRelease string) (string,
89
83
return clusterctl .ResolveRelease (ctx , releaseMarker )
90
84
}
91
85
92
- // verifyV1Beta2Conditions checks the Cluster and Machines of a Cluster that
93
- // the given v1beta2 condition types are set to true without a message, if they exist.
94
- func verifyV1Beta2Conditions (ctx context.Context , c client.Client , clusterName , clusterNamespace string , v1beta2conditionTypes map [string ]struct {}) {
95
- cluster := & clusterv1.Cluster {}
96
- key := client.ObjectKey {
97
- Namespace : clusterNamespace ,
98
- Name : clusterName ,
99
- }
100
- Eventually (func () error {
101
- return c .Get (ctx , key , cluster )
102
- }, 3 * time .Minute , 10 * time .Second ).Should (Succeed (), "Failed to get Cluster object %s" , klog .KRef (clusterNamespace , clusterName ))
103
-
104
- if len (cluster .Status .Conditions ) > 0 {
105
- for _ , condition := range cluster .Status .Conditions {
106
- if _ , ok := v1beta2conditionTypes [condition .Type ]; ! ok {
107
- continue
108
- }
109
- Expect (condition .Status ).To (Equal (metav1 .ConditionTrue ), "The v1beta2 condition %q on the Cluster should be set to true" , condition .Type )
110
- Expect (condition .Message ).To (BeEmpty (), "The v1beta2 condition %q on the Cluster should have an empty message" , condition .Type )
111
- }
112
- }
113
-
114
- machineList := & clusterv1.MachineList {}
115
- Eventually (func () error {
116
- return c .List (ctx , machineList , client .InNamespace (clusterNamespace ),
117
- client.MatchingLabels {
118
- clusterv1 .ClusterNameLabel : clusterName ,
119
- })
120
- }, 3 * time .Minute , 10 * time .Second ).Should (Succeed (), "Failed to list Machines for Cluster %s" , klog .KObj (cluster ))
121
- if len (cluster .Status .Conditions ) > 0 {
122
- for _ , machine := range machineList .Items {
123
- if len (machine .Status .Conditions ) == 0 {
124
- continue
125
- }
126
- for _ , condition := range machine .Status .Conditions {
127
- if _ , ok := v1beta2conditionTypes [condition .Type ]; ! ok {
128
- continue
129
- }
130
- Expect (condition .Status ).To (Equal (metav1 .ConditionTrue ), "The v1beta2 condition %q on the Machine %q should be set to true" , condition .Type , machine .Name )
131
- Expect (condition .Message ).To (BeEmpty (), "The v1beta2 condition %q on the Machine %q should have an empty message" , condition .Type , machine .Name )
132
- }
133
- }
134
- }
135
- }
0 commit comments