looking at the use of Expect
, Eventually
, and Consistently
in the cluster-api-actuator-pkg.
breaking up by package is probably the best for making cards.
looks like we have three sizes
$ ack Expect
autoscaler.go
177: Expect(err).NotTo(HaveOccurred())
180: Expect(err).NotTo(HaveOccurred())
181: Expect(len(workerNodes)).To(BeNumerically(">=", 1))
184: Expect(memCapacity).ShouldNot(BeNil())
185: Expect(memCapacity.String()).ShouldNot(BeEmpty())
189: Expect(ok).Should(BeTrue())
202: Expect(deleteObject(name, obj)).To(Succeed())
213: Expect(client.Create(ctx, clusterAutoscaler)).Should(Succeed())
218: Expect(err).NotTo(HaveOccurred())
220: Expect(caEventWatcher.run()).Should(BeTrue())
238: Expect(deleteObject(caName, cleanupObjects[caName])).Should(Succeed())
253: Expect(err).NotTo(HaveOccurred())
269: Expect(err).ToNot(HaveOccurred())
278: Expect(client.Create(ctx, asr)).Should(Succeed())
284: Expect(client.Create(ctx, workload)).Should(Succeed())
288: Expect(err).ToNot(HaveOccurred())
301: Expect(deleteObject(workload.Name, cleanupObjects[workload.Name])).Should(Succeed())
305: Expect(err).ToNot(HaveOccurred())
322: Expect(err).ToNot(HaveOccurred())
336: Expect(client.Create(ctx, asr)).Should(Succeed())
345: Expect(client.Create(ctx, workload)).Should(Succeed())
368: Expect(deleteObject(workload.Name, cleanupObjects[workload.Name])).Should(Succeed())
390: Expect(err).NotTo(HaveOccurred())
411: Expect(err).NotTo(HaveOccurred())
442: Expect(client.Create(ctx, clusterAutoscaler)).Should(Succeed())
452: Expect(deleteObject(caName, cleanupObjects[caName])).Should(Succeed())
471: Expect(err).ToNot(HaveOccurred())
486: Expect(client.Create(ctx, asr)).Should(Succeed())
498: Expect(client.Create(ctx, workload)).Should(Succeed())
523: Expect(deleteObject(workload.Name, cleanupObjects[workload.Name])).Should(Succeed())
558: Expect(err).ToNot(HaveOccurred())
568: Expect(reflect.DeepEqual(transientMachineSets[0].Labels, transientMachineSets[1].Labels)).Should(BeTrue())
579: Expect(client.Create(ctx, asr)).Should(Succeed())
591: Expect(client.Create(ctx, workload)).Should(Succeed())
$ ack Eventually
autoscaler.go
240: Eventually(func() (bool, error) {
286: Eventually(func() bool {
303: Eventually(func() bool {
350: Eventually(func() (bool, error) {
375: Eventually(func() (bool, error) {
393: Eventually(func() (bool, error) {
417: Eventually(func() (bool, error) {
454: Eventually(func() (bool, error) {
503: Eventually(func() (bool, error) {
529: Eventually(func() (bool, error) {
537: Eventually(func() (bool, error) {
542: Eventually(func() (bool, error) {
596: Eventually(func() (bool, error) {
$ ack Consistently
autoscaler.go
526: Consistently(func() (bool, error) {
$ ack Expect
machinesets.go
42: Expect(err).ToNot(HaveOccurred())
48: Expect(err).NotTo(HaveOccurred())
49: Expect(clusterInfra.Status.InfrastructureName).ShouldNot(BeEmpty())
52: Expect(err).NotTo(HaveOccurred())
301: Expect(err).ToNot(HaveOccurred())
332: Expect(len(failed)).To(Equal(0))
$ ack Eventually
machines.go
146: Eventually(func() bool {
machinesets.go
303: Eventually(func() error {
367: Eventually(func() bool {
$ ack Expect
lifecyclehooks.go
47: Expect(err).ToNot(HaveOccurred())
56: Expect(client.Create(context.Background(), workload)).To(Succeed(), "Could not create workload job")
75: Expect(client.Delete(context.Background(), machineSet, &runtimeclient.DeleteOptions{
79: Expect(client.Delete(context.Background(), workload, &runtimeclient.DeleteOptions{
86: Expect(err).ToNot(HaveOccurred())
87: Expect(machines).To(HaveLen(1), "There should be only one machine")
spot.go
45: Expect(err).ToNot(HaveOccurred())
48: Expect(err).NotTo(HaveOccurred())
65: Expect(setSpotOnProviderSpec(platform, machineSetParams, "")).To(Succeed())
68: Expect(err).ToNot(HaveOccurred())
76: Expect(deleteObjects(client, delObjects)).To(Succeed())
83: Expect(err).ToNot(HaveOccurred())
84: Expect(machines).To(HaveLen(machinesCount))
87: Expect(machine.Spec.ObjectMeta.Labels).To(HaveKeyWithValue(machinecontroller.MachineInterruptibleInstanceLabelName, ""))
93: Expect(err).ToNot(HaveOccurred())
94: Expect(nodes).To(HaveLen(machinesCount))
118: Expect(pods).To(HaveLen(1))
147: Expect(err).ToNot(HaveOccurred())
148: Expect(client.Create(ctx, configMap)).To(Succeed())
152: Expect(client.Create(ctx, service)).To(Succeed())
156: Expect(client.Create(ctx, deployment)).To(Succeed())
159: Expect(framework.IsDeploymentAvailable(client, deployment.Name, deployment.Namespace)).To(BeTrue())
165: Expect(err).ToNot(HaveOccurred())
166: Expect(len(machines)).To(BeNumerically(">", 0))
170: Expect(machine.Status.NodeRef).ToNot(BeNil())
175: Expect(client.Create(ctx, serviceAccount)).To(Succeed())
179: Expect(client.Create(ctx, role)).To(Succeed())
183: Expect(client.Create(ctx, roleBinding)).To(Succeed())
187: Expect(client.Create(ctx, job)).To(Succeed())
webhooks.go
32: Expect(err).ToNot(HaveOccurred())
36: Expect(err).NotTo(HaveOccurred())
47: Expect(err).ToNot(HaveOccurred())
58: Expect(err).ToNot(HaveOccurred())
63: Expect(err).ToNot(HaveOccurred())
79: Expect(client.Create(ctx, machine)).To(Succeed())
96: Expect(err).ToNot(HaveOccurred())
112: Expect(client.Create(ctx, machine)).To(Succeed())
117: Expect(err).ToNot(HaveOccurred())
120: Expect(err).ToNot(HaveOccurred())
130: Expect(err).To(HaveOccurred())
131: Expect(err).To(MatchError(ContainSubstring("admission webhook \"validation.machine.machine.openshift.io\" denied the request")))
137: Expect(err).ToNot(HaveOccurred())
142: Expect(err).ToNot(HaveOccurred())
145: Expect(err).ToNot(HaveOccurred())
156: Expect(err).To(HaveOccurred())
157: Expect(err).To(MatchError(ContainSubstring("admission webhook \"validation.machineset.machine.openshift.io\" denied the request")))
infra.go
152: Expect(err).ToNot(HaveOccurred())
158: Expect(err).ToNot(HaveOccurred())
166: Expect(err).ToNot(HaveOccurred())
174: Expect(err).ToNot(HaveOccurred())
175: Expect(machines).ToNot(BeEmpty())
181: Expect(err).NotTo(HaveOccurred())
192: Expect(err).NotTo(HaveOccurred())
202: Expect(err).NotTo(HaveOccurred())
216: klog.Infof("Expected : %v, observed %v , difference %v, ", expectedTaints, observedTaints, expectedTaints.Difference(observedTaints))
227: Expect(err).ToNot(HaveOccurred())
228: Expect(machines).ToNot(BeEmpty())
232: Expect(err).NotTo(HaveOccurred())
242: Expect(err).ToNot(HaveOccurred())
248: Expect(err).ToNot(HaveOccurred())
254: Expect(framework.ScaleMachineSet(machineSet.GetName(), 0)).To(Succeed())
255: Expect(framework.ScaleMachineSet(machineSet2.GetName(), 3)).To(Succeed())
266: Expect(err).ToNot(HaveOccurred())
267: Expect(len(machines)).To(BeNumerically(">=", 2))
278: Expect(err).ToNot(HaveOccurred())
281: Expect(err).ToNot(HaveOccurred())
288: Expect(err).ToNot(HaveOccurred())
299: Expect(err).NotTo(HaveOccurred())
305: Expect(err).NotTo(HaveOccurred())
310: Expect(err).NotTo(HaveOccurred())
318: Expect(err).NotTo(HaveOccurred())
323: Expect(err).NotTo(HaveOccurred())
330: Expect(err).NotTo(HaveOccurred())
339: Expect(err).To(MatchError(expectedAdmissionWebhookErr))
$ ack Eventually
lifecyclehooks.go
59: Eventually(func() (bool, error) {
101: Eventually(func() (bool, error) {
120: Eventually(func() (bool, error) {
138: Eventually(func() (bool, error) {
151: Eventually(func() bool {
155: Eventually(func() (bool, error) {
171: Eventually(func() (bool, error) {
184: Eventually(func() bool {
spot.go
104: Eventually(func() ([]corev1.Pod, error) {
122: Eventually(func() (bool, error) {
webhooks.go
81: Eventually(func() error {
infra.go
205: Eventually(func() bool {
$ ack Expect
machinehealthcheck.go
40: Expect(err).ToNot(HaveOccurred())
46: Expect(err).ToNot(HaveOccurred())
53: Expect(client.Delete(context.Background(), machinehealthcheck)).ToNot(HaveOccurred())
56: Expect(client.Delete(context.Background(), machineSet)).ToNot(HaveOccurred())
64: Expect(err).ToNot(HaveOccurred())
65: Expect(machines).ToNot(BeEmpty())
71: Expect(err).ToNot(HaveOccurred())
72: Expect(framework.AddNodeCondition(client, node, nodeCondition)).ToNot(HaveOccurred())
90: Expect(err).ToNot(HaveOccurred())
91: Expect(machinehealthcheck).ToNot(BeNil())
98: Expect(framework.WaitForEvent(client, "Machine", machine.Name, "MachineDeleted")).ToNot(HaveOccurred())
103: Expect(err).ToNot(HaveOccurred())
104: Expect(allMachines).ToNot(BeEmpty())
105: Expect(framework.MachinesPresent(allMachines, healthyMachines...)).To(BeTrue())
114: Expect(err).ToNot(HaveOccurred())
115: Expect(machines).ToNot(BeEmpty())
121: Expect(err).ToNot(HaveOccurred())
122: Expect(framework.AddNodeCondition(client, node, nodeCondition)).ToNot(HaveOccurred())
140: Expect(err).ToNot(HaveOccurred())
141: Expect(machinehealthcheck).ToNot(BeNil())
144: Expect(framework.WaitForEvent(client, "MachineHealthCheck", machineSet.Name, "RemediationRestricted")).ToNot(HaveOccurred())
148: Expect(err).ToNot(HaveOccurred())
149: Expect(allMachines).ToNot(BeEmpty())
150: Expect(framework.MachinesPresent(allMachines, machines...)).To(BeTrue())
$ ack Eventually
$ ack Expect
cluster-autoscaler-operator.go
28: Expect(err).NotTo(HaveOccurred())
31: Expect(ok).To(BeTrue())
47: Expect(err).To(HaveOccurred())
73: Expect(err).To(HaveOccurred())
83: Expect(err).NotTo(HaveOccurred())
84: Expect(framework.IsDeploymentAvailable(client, "cluster-autoscaler-operator", framework.MachineAPINamespace)).To(BeTrue())
94: Expect(err).NotTo(HaveOccurred())
95: Expect(framework.WaitForStatusAvailableShort(client, "cluster-autoscaler")).To(BeTrue())
cluster-machine-approver.go
18: Expect(err).NotTo(HaveOccurred())
20: Expect(framework.IsDeploymentAvailable(client, cmaDeployment, cmaNamespace)).To(BeTrue())
27: Expect(err).NotTo(HaveOccurred())
29: Expect(framework.WaitForStatusAvailableShort(client, cmaClusterOperator)).To(BeTrue())
machine-api-operator.go
28: Expect(err).NotTo(HaveOccurred())
29: Expect(framework.IsDeploymentAvailable(client, maoDeployment, framework.MachineAPINamespace)).To(BeTrue())
34: Expect(err).NotTo(HaveOccurred())
37: Expect(err).NotTo(HaveOccurred())
40: Expect(framework.IsDeploymentAvailable(client, maoManagedDeployment, framework.MachineAPINamespace)).To(BeTrue())
43: Expect(framework.DeleteDeployment(client, initialDeployment)).NotTo(HaveOccurred())
46: Expect(framework.IsDeploymentAvailable(client, maoManagedDeployment, framework.MachineAPINamespace)).To(BeTrue())
49: Expect(framework.IsDeploymentSynced(client, initialDeployment, maoManagedDeployment, framework.MachineAPINamespace)).To(BeTrue())
54: Expect(err).NotTo(HaveOccurred())
57: Expect(err).NotTo(HaveOccurred())
60: Expect(framework.IsDeploymentAvailable(client, maoManagedDeployment, framework.MachineAPINamespace)).To(BeTrue())
66: Expect(framework.UpdateDeployment(client, maoManagedDeployment, framework.MachineAPINamespace, changedDeployment)).NotTo(HaveOccurred())
69: Expect(framework.IsDeploymentSynced(client, initialDeployment, maoManagedDeployment, framework.MachineAPINamespace)).To(BeTrue())
72: Expect(framework.IsDeploymentAvailable(client, maoManagedDeployment, framework.MachineAPINamespace)).To(BeTrue())
78: Expect(err).NotTo(HaveOccurred())
80: Expect(framework.IsMutatingWebhookConfigurationSynced(client)).To(BeTrue())
85: Expect(err).NotTo(HaveOccurred())
87: Expect(framework.IsValidatingWebhookConfigurationSynced(client)).To(BeTrue())
92: Expect(err).NotTo(HaveOccurred())
96: Expect(err).NotTo(HaveOccurred())
97: Expect(initial).ToNot(BeNil())
100: Expect(framework.DeleteValidatingWebhookConfiguration(client, initial)).To(Succeed())
113: Expect(framework.IsValidatingWebhookConfigurationSynced(client)).To(BeTrue())
118: Expect(err).NotTo(HaveOccurred())
122: Expect(err).NotTo(HaveOccurred())
123: Expect(initial).ToNot(BeNil())
126: Expect(framework.DeleteMutatingWebhookConfiguration(client, initial)).To(Succeed())
139: Expect(framework.IsMutatingWebhookConfigurationSynced(client)).To(BeTrue())
144: Expect(err).NotTo(HaveOccurred())
147: Expect(err).NotTo(HaveOccurred())
148: Expect(initial).ToNot(BeNil())
156: Expect(framework.UpdateMutatingWebhookConfiguration(client, toUpdate)).To(Succeed())
158: Expect(framework.IsMutatingWebhookConfigurationSynced(client)).To(BeTrue())
161: Expect(err).NotTo(HaveOccurred())
162: Expect(updated).ToNot(BeNil())
165: Expect(webhook.ClientConfig.CABundle).To(Equal(initial.Webhooks[i].ClientConfig.CABundle))
171: Expect(err).NotTo(HaveOccurred())
174: Expect(err).NotTo(HaveOccurred())
175: Expect(initial).ToNot(BeNil())
183: Expect(framework.UpdateValidatingWebhookConfiguration(client, toUpdate)).To(Succeed())
185: Expect(framework.IsValidatingWebhookConfigurationSynced(client)).To(BeTrue())
188: Expect(err).NotTo(HaveOccurred())
189: Expect(updated).ToNot(BeNil())
192: Expect(webhook.ClientConfig.CABundle).To(Equal(initial.Webhooks[i].ClientConfig.CABundle))
203: Expect(err).NotTo(HaveOccurred())
204: Expect(framework.WaitForStatusAvailableShort(client, "machine-api")).To(BeTrue())
211: Expect(err).NotTo(HaveOccurred())
215: Expect(err).NotTo(HaveOccurred())
220: Expect(err).NotTo(HaveOccurred())
228: Expect(err).NotTo(HaveOccurred())
232: Expect(result).To(BeTrue())
233: Expect(err).NotTo(HaveOccurred())
238: Expect(err).ToNot(HaveOccurred())
242: Expect(client.Delete(context.Background(), machineSet)).To(Succeed())
252: Expect(err).NotTo(HaveOccurred())
255: Expect(framework.WaitForProxyInjectionSync(client, maoManagedDeployment, framework.MachineAPINamespace, false)).To(BeTrue())
261: Expect(err).NotTo(HaveOccurred())
262: Expect(framework.WaitForProxyInjectionSync(client, maoManagedDeployment, framework.MachineAPINamespace, false)).To(BeTrue())
265: Expect(framework.WaitForStatusAvailableOverLong(client, "kube-apiserver")).To(BeTrue())
268: Expect(framework.WaitForStatusAvailableOverLong(client, "kube-controller-manager")).To(BeTrue())
269: Expect(framework.WaitForStatusAvailableMedium(client, "machine-api")).To(BeTrue())
272: Expect(framework.DestroyClusterProxy(client)).ToNot(HaveOccurred())
$ ack Eventually
machine-api-operator.go
104: Eventually(func() (apitypes.UID, error) {
130: Eventually(func() (apitypes.UID, error) {
$ ack Expect
aws.go
24: Expect(err).ToNot(HaveOccurred())
27: Expect(err).ToNot(HaveOccurred())
33: Expect(err).ToNot(HaveOccurred())
40: Expect(framework.DeleteMachineSets(client, toDelete...)).To(Succeed())
49: Expect(err).ToNot(HaveOccurred())
54: Expect(err).ToNot(HaveOccurred())
68: Expect(err).ToNot(HaveOccurred())
81: Expect(err).ToNot(HaveOccurred())
99: Expect(err).ToNot(HaveOccurred())
100: Expect(logs).Should(ContainSubstring(responseSubstring))
106: Expect(err).To(HaveOccurred())
107: Expect(err.Error()).Should(ContainSubstring("Invalid value: \"fooobaar\": Allowed values are either 'Optional' or 'Required'"))
112: Expect(err).ToNot(HaveOccurred())
118: Expect(err).ToNot(HaveOccurred())
$ ack Eventually
aws.go
85: Eventually(func() (bool, error) {
intro, what are we doing here?
Apr 30, 2025Capturing some of the work that will need to be done to expand the coverage of the opt-in autoscaling from zero feature in Cluster API.
Sep 12, 2024T
Aug 20, 2024After discussion during the 1 May 2024 feature group meeting
Jun 4, 2024or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up