Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Pod ResourceVersion in Tests #275

Merged
merged 1 commit into from
Aug 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions controllers/quayregistry_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ var _ = Describe("QuayRegistryReconciler", func() {
})

Context("on an existing `QuayRegistry`", func() {
var oldDeployments appsv1.DeploymentList
var oldPods corev1.PodList
listOptions := client.ListOptions{Namespace: namespace}

JustBeforeEach(func() {
_ = k8sClient.List(context.Background(), &oldDeployments, &listOptions)
_ = k8sClient.List(context.Background(), &oldPods, &listOptions)
})

Context("which references a `configBundleSecret` that does not exist", func() {
Expand All @@ -198,14 +198,15 @@ var _ = Describe("QuayRegistryReconciler", func() {
})

It("will not update any Quay objects on the cluster", func() {
var deployments appsv1.DeploymentList
var pods corev1.PodList
listOptions := client.ListOptions{Namespace: namespace}

_ = k8sClient.List(context.Background(), &deployments, &listOptions)
for _, deployment := range deployments.Items {
for _, oldDeployment := range oldDeployments.Items {
if deployment.GetName() == oldDeployment.GetName() {
Expect(deployment.Spec).To(Equal(oldDeployment.Spec))
_ = k8sClient.List(context.Background(), &pods, &listOptions)
Expect(len(pods.Items)).To(Equal(len(oldPods.Items)))
for _, pod := range pods.Items {
for _, oldPod := range oldPods.Items {
if pod.GetName() == oldPod.GetName() {
Expect(pod.GetResourceVersion()).To(Equal(oldPod.GetResourceVersion()))
}
}
}
Expand Down