( c client.Client, cluster *apiv1.Cluster, markAsReady bool, )
| 322 | } |
| 323 | |
| 324 | func generateFakeClusterPods( |
| 325 | c client.Client, |
| 326 | cluster *apiv1.Cluster, |
| 327 | markAsReady bool, |
| 328 | ) []corev1.Pod { |
| 329 | var idx int |
| 330 | var pods []corev1.Pod |
| 331 | for idx < cluster.Spec.Instances { |
| 332 | idx++ |
| 333 | pod, _ := specs.NewInstance(context.TODO(), *cluster, idx, true) |
| 334 | cluster.SetInheritedDataAndOwnership(&pod.ObjectMeta) |
| 335 | |
| 336 | err := c.Create(context.Background(), pod) |
| 337 | Expect(err).ToNot(HaveOccurred()) |
| 338 | |
| 339 | // we overwrite local status, needed for certain tests. The status returned from fake api server will be always |
| 340 | // 'Pending' |
| 341 | if markAsReady { |
| 342 | pod.Status = corev1.PodStatus{ |
| 343 | Phase: corev1.PodRunning, |
| 344 | Conditions: []corev1.PodCondition{ |
| 345 | { |
| 346 | Type: corev1.PodReady, |
| 347 | Status: corev1.ConditionTrue, |
| 348 | }, |
| 349 | }, |
| 350 | } |
| 351 | } |
| 352 | pods = append(pods, *pod) |
| 353 | } |
| 354 | return pods |
| 355 | } |
| 356 | |
| 357 | func generateFakeClusterPodsWithDefaultClient( |
| 358 | k8sClient client.Client, |
no test coverage detected