@@ -18,25 +18,17 @@ package e2e
1818
1919import (
2020 "fmt"
21- "os"
2221 "os/exec"
2322 "testing"
2423
2524 . "github.com/onsi/ginkgo/v2"
2625 . "github.com/onsi/gomega"
26+ "github.com/onsi/gomega/format"
2727
2828 "github.com/creydr/func-operator/test/utils"
2929)
3030
3131var (
32- // Optional Environment Variables:
33- // - CERT_MANAGER_INSTALL_SKIP=true: Skips CertManager installation during test setup.
34- // These variables are useful if CertManager is already installed, avoiding
35- // re-installation and conflicts.
36- skipCertManagerInstall = os .Getenv ("CERT_MANAGER_INSTALL_SKIP" ) == "true"
37- // isCertManagerAlreadyInstalled will be set true when CertManager CRDs be found on the cluster
38- isCertManagerAlreadyInstalled = false
39-
4032 // projectImage is the name of the image which will be build and loaded
4133 // with the code source changes to be tested.
4234 projectImage = "localhost:5001/func-operator:v0.0.1"
@@ -58,26 +50,5 @@ var _ = BeforeSuite(func() {
5850 _ , err := utils .Run (cmd )
5951 ExpectWithOffset (1 , err ).NotTo (HaveOccurred (), "Failed to build the manager(Operator) image" )
6052
61- // The tests-e2e are intended to run on a temporary cluster that is created and destroyed for testing.
62- // To prevent errors when tests run in environments with CertManager already installed,
63- // we check for its presence before execution.
64- // Setup CertManager before the suite if not skipped and if not already installed
65- if ! skipCertManagerInstall {
66- By ("checking if cert manager is installed already" )
67- isCertManagerAlreadyInstalled = utils .IsCertManagerCRDsInstalled ()
68- if ! isCertManagerAlreadyInstalled {
69- _ , _ = fmt .Fprintf (GinkgoWriter , "Installing CertManager...\n " )
70- Expect (utils .InstallCertManager ()).To (Succeed (), "Failed to install CertManager" )
71- } else {
72- _ , _ = fmt .Fprintf (GinkgoWriter , "WARNING: CertManager is already installed. Skipping installation...\n " )
73- }
74- }
75- })
76-
77- var _ = AfterSuite (func () {
78- // Teardown CertManager after the suite if not skipped and if it was not already installed
79- if ! skipCertManagerInstall && ! isCertManagerAlreadyInstalled {
80- _ , _ = fmt .Fprintf (GinkgoWriter , "Uninstalling CertManager...\n " )
81- utils .UninstallCertManager ()
82- }
53+ format .MaxLength = format .MaxLength * 5 // TODO find a better way to not exceed the limit
8354})
0 commit comments