From 0c65421ae711b633fb8da25d6f2405b7267c474a Mon Sep 17 00:00:00 2001 From: Erik Stidham Date: Mon, 9 Dec 2024 10:31:42 -0600 Subject: [PATCH] Stop benchmarking CRD loading since they are cached anyway --- pkg/crds/crds_test.go | 50 ++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/pkg/crds/crds_test.go b/pkg/crds/crds_test.go index e2ab87caaf..3ba77408dc 100644 --- a/pkg/crds/crds_test.go +++ b/pkg/crds/crds_test.go @@ -21,43 +21,25 @@ import ( opv1 "github.com/tigera/operator/api/v1" ) +// The real test here is simply calling these functions will result in a panic if any of the CRDs cannot be parsed + var _ = Describe("test crds pkg", func() { - Context("GetCalicoCRDSource", func() { - Measure("should quickly load calico source CRDs", func(b Benchmarker) { - runtime := b.Time("runtime", func() { - _ = getCalicoCRDSource() - }) - Expect(runtime.Seconds()).Should(BeNumerically("<", 0.3), "loading calico CRDs should not take too long.") - }, 50) + It("can parse Calico CRDs", func() { + Expect(func() { Expect(getCalicoCRDSource()).ToNot(BeEmpty()) }).ToNot(Panic()) + }) + It("can parse Enterprise CRDs", func() { + Expect(func() { Expect(getEnterpriseCRDSource()).ToNot(BeEmpty()) }).ToNot(Panic()) + }) + It("can parse Operator CRDs used with calico", func() { + Expect(func() { Expect(getOperatorCRDSource(opv1.Calico)).ToNot(BeEmpty()) }).ToNot(Panic()) }) - Context("GetEnterpriseCRDSource", func() { - Measure("should quickly load enterprise source CRDs", func(b Benchmarker) { - runtime := b.Time("runtime", func() { - _ = getEnterpriseCRDSource() - }) - Expect(runtime.Seconds()).Should(BeNumerically("<", 0.3), "loading enterprise CRDs should not take too long.") - }, 50) + It("can parse Operator CRDs used with Enterprise", func() { + Expect(func() { Expect(getOperatorCRDSource(opv1.TigeraSecureEnterprise)).ToNot(BeEmpty()) }).ToNot(Panic()) }) - Context("GetOperatorCRDSource", func() { - Measure("should quickly load operator source CRDs", func(b Benchmarker) { - runtime := b.Time("runtime", func() { - _ = getEnterpriseCRDSource() - }) - Expect(runtime.Seconds()).Should(BeNumerically("<", 0.3), "loading operator CRDs should not take too long.") - }, 50) + It("can get all CRDS used with Calico", func() { + Expect(func() { Expect(GetCRDs(opv1.Calico)).ToNot(BeEmpty()) }).ToNot(Panic()) }) - Context("GetCRDs", func() { - Measure("should quickly load calico CRDs", func(b Benchmarker) { - runtime := b.Time("runtime", func() { - _ = GetCRDs(opv1.Calico) - }) - Expect(runtime.Seconds()).Should(BeNumerically("<", 0.3), "loading calico CRDs should not take too long.") - }, 50) - Measure("should quickly load enterprise CRDs", func(b Benchmarker) { - runtime := b.Time("runtime", func() { - _ = GetCRDs(opv1.TigeraSecureEnterprise) - }) - Expect(runtime.Seconds()).Should(BeNumerically("<", 0.3), "loading enterprise CRDs should not take too long.") - }, 50) + It("can get all CRDS used with Enterprise", func() { + Expect(func() { Expect(GetCRDs(opv1.TigeraSecureEnterprise)).ToNot(BeEmpty()) }).ToNot(Panic()) }) })