Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions test/e2e/pkg/cert_rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var _ = Describe("Certificate Rotation", Ordered, Label("e2e-tests-cert-rotation
return fmt.Errorf("expected 1 replica, got %d", *deployment.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

By("verifying work status is reported back")
Eventually(func() error {
Expand All @@ -118,7 +118,7 @@ var _ = Describe("Certificate Rotation", Ordered, Label("e2e-tests-cert-rotation
return fmt.Errorf("work not available yet")
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

AfterAll(func() {
Expand Down Expand Up @@ -156,7 +156,7 @@ var _ = Describe("Certificate Rotation", Ordered, Label("e2e-tests-cert-rotation
By("ensuring the work is deleted")
Eventually(func() error {
return AssertWorkNotFound(workName)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

By("ensuring the deployment is deleted from agent cluster")
Eventually(func() error {
Expand All @@ -168,7 +168,7 @@ var _ = Describe("Certificate Rotation", Ordered, Label("e2e-tests-cert-rotation
return err
}
return fmt.Errorf("deployment %s still exists", deployName)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("should update work when certificate expires and succeed after rotation", func() {
Expand Down Expand Up @@ -210,7 +210,7 @@ var _ = Describe("Certificate Rotation", Ordered, Label("e2e-tests-cert-rotation
return fmt.Errorf("expected 2 replicas, got %d", *deployment.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})
})
})
Expand Down Expand Up @@ -429,7 +429,7 @@ func restartDeployment(ctx context.Context, kubeClient kubernetes.Interface, dep
}

return nil
}, 2*time.Minute, 2*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

// Give the deployment a moment to establish connections
time.Sleep(5 * time.Second)
Expand Down
13 changes: 6 additions & 7 deletions test/e2e/pkg/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"io"
"net/http"
"time"

"github.com/cloudevents/sdk-go/v2/binding"
cetypes "github.com/cloudevents/sdk-go/v2/types"
Expand Down Expand Up @@ -80,7 +79,7 @@ var _ = Describe("GRPC", Ordered, Label("e2e-tests-grpc"), func() {
}

return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

Eventually(func() error {
_, err := agentTestOpts.kubeClientSet.AppsV1().Deployments("default").Get(ctx, deployName, metav1.GetOptions{})
Expand All @@ -91,7 +90,7 @@ var _ = Describe("GRPC", Ordered, Label("e2e-tests-grpc"), func() {
return err
}
return fmt.Errorf("nginx deployment still exists")
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

_, resp, err := apiClient.DefaultAPI.ApiMaestroV1ResourceBundlesIdGet(ctx, resourceID).Execute()
Expect(err).To(HaveOccurred(), "Expected 404 error")
Expand All @@ -104,7 +103,7 @@ var _ = Describe("GRPC", Ordered, Label("e2e-tests-grpc"), func() {
It("should subscribe to the resource status with grpc client", func() {
Eventually(func() error {
return assertResourceStatus(subscribedResourceStatus, resourceID, 1)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("get the deployment from cluster", func() {
Expand All @@ -117,7 +116,7 @@ var _ = Describe("GRPC", Ordered, Label("e2e-tests-grpc"), func() {
return fmt.Errorf("unexpected replicas, expected 1, got %d", *deploy.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("get the resource via maestro api", func() {
Expand All @@ -141,7 +140,7 @@ var _ = Describe("GRPC", Ordered, Label("e2e-tests-grpc"), func() {
It("should subscribe to the resource status with grpc client", func() {
Eventually(func() error {
return assertResourceStatus(subscribedResourceStatus, resourceID, 2)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("get the deployment from cluster", func() {
Expand All @@ -154,7 +153,7 @@ var _ = Describe("GRPC", Ordered, Label("e2e-tests-grpc"), func() {
return fmt.Errorf("unexpected replicas, expected 2, got %d", *deploy.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("get the resource via maestro api", func() {
Expand Down
26 changes: 13 additions & 13 deletions test/e2e/pkg/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
return fmt.Errorf("unexpected replicas, expected 1, got %d", *deploy.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

resourceID = string(createdWork.UID)
gotResource, resp, err := apiClient.DefaultAPI.ApiMaestroV1ResourceBundlesIdGet(ctx, resourceID).Execute()
Expand All @@ -66,11 +66,11 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
return err
}
return fmt.Errorf("nginx deployment still exists")
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

Eventually(func() error {
return AssertWorkNotFound(workName)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("patch the resource with source work client", func() {
Expand Down Expand Up @@ -120,7 +120,7 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
return err
}
return fmt.Errorf("nginx deployment still exists")
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

Eventually(func() error {
_, resp, err := apiClient.DefaultAPI.ApiMaestroV1ResourceBundlesIdGet(ctx, resourceID).Execute()
Expand All @@ -131,7 +131,7 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
return fmt.Errorf("unexpected http code, got %d, expected %d", resp.StatusCode, http.StatusNotFound)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

opIDCtx, opID = newOpIDContext(ctx)
By(fmt.Sprintf("create the resource again with source work client (op-id: %s)", opID))
Expand All @@ -148,7 +148,7 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
return fmt.Errorf("unexpected replicas, expected 1, got %d", *deploy.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

// the resource id should not change
gotResource, resp, err := apiClient.DefaultAPI.ApiMaestroV1ResourceBundlesIdGet(ctx, resourceID).Execute()
Expand Down Expand Up @@ -240,12 +240,12 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
return err
}
return fmt.Errorf("auth secret still exists")
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

By("check the resource deletion via source workclient")
Eventually(func() error {
return AssertWorkNotFound(workName)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("get the resource status back", func() {
Expand All @@ -268,7 +268,7 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
}

return fmt.Errorf("work status manifests are empty")
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})
})

Expand All @@ -293,15 +293,15 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
By("check the resource deletion via source workclient")
Eventually(func() error {
return AssertWorkNotFound(workName)
}, 2*time.Minute, 2*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("check the nested work is created and not updated", func() {
// make sure the nested work is created
Eventually(func() error {
_, err := agentTestOpts.workClientSet.WorkV1().ManifestWorks(nestedWorkNamespace).Get(ctx, nestedWorkName, metav1.GetOptions{})
return err
}, 30*time.Second, time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

// make sure the nested work is not updated
Consistently(func() error {
Expand All @@ -315,7 +315,7 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {
}

return nil
}, 1*time.Minute, 1*time.Second).Should(BeNil())
}).Should(BeNil())
})
})

Expand All @@ -342,7 +342,7 @@ var _ = Describe("Resources", Ordered, Label("e2e-tests-resources"), func() {

Eventually(func() error {
return AssertWorkNotFound(workName)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

})

Expand Down
20 changes: 10 additions & 10 deletions test/e2e/pkg/sourceclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien
}

return AssertWorkNotFound(initWorkBName)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

watcherCancel()
})
Expand Down Expand Up @@ -139,7 +139,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien

Eventually(func() error {
return AssertWatchResult(result)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

expectedMetrics := fmt.Sprintf(`
# HELP source_client_registered_watchers Number of registered watchers for a source client.
Expand Down Expand Up @@ -197,11 +197,11 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien

Eventually(func() error {
return AssertWatchResult(allConsumerWatcherResult)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

Eventually(func() error {
return AssertWatchResult(consumerWatcherResult)
}, 30*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

Consistently(func() error {
if len(otherConsumerWatcherResult.WatchedWorks) != 0 {
Expand Down Expand Up @@ -261,7 +261,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien

Eventually(func() error {
return AssertWatchResult(result)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

expectedMetrics := fmt.Sprintf(`
# HELP source_client_registered_watchers Number of registered watchers for a source client.
Expand Down Expand Up @@ -334,7 +334,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien
return fmt.Errorf("second watcher should have received events")
}
return nil
}, 30*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

By("verify watchers are independent - first watcher stopped, second continues")
Expect(len(firstResult.WatchedWorks)).Should(BeNumerically(">", 0), "first watcher should have processed initial events")
Expand Down Expand Up @@ -395,7 +395,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien
}

return fmt.Errorf("no deleted work watched")
}, 1*time.Minute, 5*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})
})

Expand Down Expand Up @@ -491,7 +491,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien
}

return AssertWorkNotFound(testWorkCName)
}, 2*time.Minute, 2*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("list works with options", func() {
Expand Down Expand Up @@ -789,7 +789,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien
}

return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

By("update deploy replicas", func() {
Expand Down Expand Up @@ -855,7 +855,7 @@ var _ = Describe("SourceWorkClient", Ordered, Label("e2e-tests-source-work-clien
}

return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})
})
})
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/pkg/spec_resync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return fmt.Errorf("unexpected replicas, expected 1, got %d", *deploy.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

opIDCtx, opID = newOpIDContext(ctx)
By(fmt.Sprintf("create resource B with source work client (op-id: %s)", opID))
Expand All @@ -59,7 +59,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return fmt.Errorf("unexpected replicas, expected 1, got %d", *deploy.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("shut down maestro agent", func() {
Expand All @@ -86,7 +86,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return fmt.Errorf("maestro-agent pods still running")
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("patch the resource A with source work client", func() {
Expand Down Expand Up @@ -208,7 +208,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return err
}
return fmt.Errorf("nginx B deployment %s still exists", deployB)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

It("ensure the nginx C deployment is created", func() {
Expand All @@ -221,7 +221,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return fmt.Errorf("unexpected replicas for nginx C deployment %s, expected 1, got %d", deployC, *deploy.Spec.Replicas)
}
return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})

AfterAll(func() {
Expand Down Expand Up @@ -252,7 +252,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return err
}
return fmt.Errorf("nginx A deployment %s still exists", deployA)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

Eventually(func() error {
_, err := agentTestOpts.kubeClientSet.AppsV1().Deployments("default").Get(ctx, deployB, metav1.GetOptions{})
Expand All @@ -263,7 +263,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return err
}
return fmt.Errorf("nginx B deployment %s still exists", deployB)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

Eventually(func() error {
_, err := agentTestOpts.kubeClientSet.AppsV1().Deployments("default").Get(ctx, deployC, metav1.GetOptions{})
Expand All @@ -274,7 +274,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
return err
}
return fmt.Errorf("nginx C deployment %s still exists", deployC)
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())

By("check the resource deletion via source workclient")
Eventually(func() error {
Expand All @@ -291,7 +291,7 @@ var _ = Describe("Spec Resync After Restart", Ordered, Label("e2e-tests-spec-res
}

return nil
}, 1*time.Minute, 1*time.Second).ShouldNot(HaveOccurred())
}).ShouldNot(HaveOccurred())
})
})
})
Loading
Loading