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

🌱 Remove async ginkgo tests #1564

Merged
merged 1 commit into from
Jun 23, 2021
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
4 changes: 1 addition & 3 deletions pkg/builder/builder_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestBuilder(t *testing.T) {
var testenv *envtest.Environment
var cfg *rest.Config

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

testenv = &envtest.Environment{}
Expand All @@ -63,8 +63,6 @@ var _ = BeforeSuite(func(done Done) {

webhook.DefaultPort, _, err = addr.Suggest("")
Expect(err).NotTo(HaveOccurred())

close(done)
}, 60)

var _ = AfterSuite(func() {
Expand Down
10 changes: 3 additions & 7 deletions pkg/builder/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ var _ = Describe("application", func() {
})

Describe("Start with ControllerManagedBy", func() {
It("should Reconcile Owns objects", func(done Done) {
It("should Reconcile Owns objects", func() {
m, err := manager.New(cfg, manager.Options{})
Expect(err).NotTo(HaveOccurred())

Expand All @@ -308,10 +308,9 @@ var _ = Describe("application", func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
doReconcileTest(ctx, "3", bldr, m, false)
close(done)
}, 10)

It("should Reconcile Watches objects", func(done Done) {
It("should Reconcile Watches objects", func() {
m, err := manager.New(cfg, manager.Options{})
Expect(err).NotTo(HaveOccurred())

Expand All @@ -324,12 +323,11 @@ var _ = Describe("application", func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
doReconcileTest(ctx, "4", bldr, m, true)
close(done)
}, 10)
})

Describe("Set custom predicates", func() {
It("should execute registered predicates only for assigned kind", func(done Done) {
It("should execute registered predicates only for assigned kind", func() {
m, err := manager.New(cfg, manager.Options{})
Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -385,8 +383,6 @@ var _ = Describe("application", func() {
Expect(deployPrctExecuted).To(BeTrue(), "Deploy predicated should be called at least once")
Expect(replicaSetPrctExecuted).To(BeTrue(), "ReplicaSet predicated should be called at least once")
Expect(allPrctExecuted).To(BeNumerically(">=", 2), "Global Predicated should be called at least twice")

close(done)
})
})

Expand Down
4 changes: 1 addition & 3 deletions pkg/cache/cache_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var testenv *envtest.Environment
var cfg *rest.Config
var clientset *kubernetes.Clientset

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

testenv = &envtest.Environment{}
Expand All @@ -50,8 +50,6 @@ var _ = BeforeSuite(func(done Done) {

clientset, err = kubernetes.NewForConfig(cfg)
Expect(err).NotTo(HaveOccurred())

close(done)
}, 60)

var _ = AfterSuite(func() {
Expand Down
12 changes: 4 additions & 8 deletions pkg/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
})
Describe("as an Informer", func() {
Context("with structured objects", func() {
It("should be able to get informer for the object", func(done Done) {
It("should be able to get informer for the object", func() {
By("getting a shared index informer for a pod")
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -921,9 +921,8 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca

By("verifying the object is received on the channel")
Eventually(out).Should(Receive(Equal(pod)))
close(done)
})
It("should be able to get an informer by group/version/kind", func(done Done) {
It("should be able to get an informer by group/version/kind", func() {
By("getting an shared index informer for gvk = core/v1/pod")
gvk := schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Pod"}
sii, err := informerCache.GetInformerForKind(context.TODO(), gvk)
Expand Down Expand Up @@ -960,7 +959,6 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca

By("verifying the object is received on the channel")
Eventually(out).Should(Receive(Equal(pod)))
close(done)
})
It("should be able to index an object field then retrieve objects by that field", func() {
By("creating the cache")
Expand Down Expand Up @@ -1030,7 +1028,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
})
})
Context("with unstructured objects", func() {
It("should be able to get informer for the object", func(done Done) {
It("should be able to get informer for the object", func() {
By("getting a shared index informer for a pod")

pod := &unstructured.Unstructured{
Expand Down Expand Up @@ -1072,7 +1070,6 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca

By("verifying the object is received on the channel")
Eventually(out).Should(Receive(Equal(pod)))
close(done)
}, 3)

It("should be able to index an object field then retrieve objects by that field", func() {
Expand Down Expand Up @@ -1145,7 +1142,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
})
})
Context("with metadata-only objects", func() {
It("should be able to get informer for the object", func(done Done) {
It("should be able to get informer for the object", func() {
By("getting a shared index informer for a pod")

pod := &corev1.Pod{
Expand Down Expand Up @@ -1193,7 +1190,6 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca

By("verifying the object's metadata is received on the channel")
Eventually(out).Should(Receive(Equal(podMeta)))
close(done)
}, 3)

It("should be able to index an object field then retrieve objects by that field", func() {
Expand Down
7 changes: 2 additions & 5 deletions pkg/certwatcher/certwatcher_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@ func TestSource(t *testing.T) {
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
}

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

close(done)
}, 60)

var _ = AfterSuite(func(done Done) {
var _ = AfterSuite(func() {
for _, file := range []string{certPath, keyPath} {
_ = os.Remove(file)
}
close(done)
}, 60)
4 changes: 1 addition & 3 deletions pkg/client/apiutil/apiutil_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ func TestSource(t *testing.T) {

var cfg *rest.Config

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

// for things that technically need a rest.Config for defaulting, but don't actually use them
cfg = &rest.Config{}

close(done)
}, 60)
4 changes: 1 addition & 3 deletions pkg/client/client_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var testenv *envtest.Environment
var cfg *rest.Config
var clientset *kubernetes.Clientset

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

testenv = &envtest.Environment{}
Expand All @@ -51,8 +51,6 @@ var _ = BeforeSuite(func(done Done) {

clientset, err = kubernetes.NewForConfig(cfg)
Expect(err).NotTo(HaveOccurred())

close(done)
}, 60)

var _ = AfterSuite(func() {
Expand Down
Loading