From b03bbe91c0db97780ef5bd36e5c1ab5617f70efb Mon Sep 17 00:00:00 2001 From: Patrik Suba Date: Thu, 27 Feb 2025 15:24:29 +0100 Subject: [PATCH] Initial E2E framework with HCP client. - start of E2E test suite and README - client connects to development enviroment using port forwarding to localhost - Draft of list and get test cases. --- CODEOWNERS | 1 + go.work | 1 + go.work.sum | 3 ++ test/e2e/README.md | 69 +++++++++++++++++++++++++++++++++ test/e2e/e2e_test.go | 20 ++++++++++ test/e2e/get_test.go | 32 ++++++++++++++++ test/e2e/list_test.go | 58 ++++++++++++++++++++++++++++ test/e2e/setup.go | 75 ++++++++++++++++++++++++++++++++++++ test/go.mod | 39 +++++++++++++++++++ test/go.sum | 78 ++++++++++++++++++++++++++++++++++++++ test/util/labels/labels.go | 17 +++++++++ test/util/log/logger.go | 22 +++++++++++ 12 files changed, 415 insertions(+) create mode 100644 test/e2e/README.md create mode 100644 test/e2e/e2e_test.go create mode 100644 test/e2e/get_test.go create mode 100644 test/e2e/list_test.go create mode 100644 test/e2e/setup.go create mode 100644 test/go.mod create mode 100644 test/go.sum create mode 100644 test/util/labels/labels.go create mode 100644 test/util/log/logger.go diff --git a/CODEOWNERS b/CODEOWNERS index fc938f17a..8c54d4ba7 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -13,3 +13,4 @@ go.work* @bennerv @mbarnes @SudoBrendan @mociarain @venkateshsredhat @nanyte25 @ /cluster-service/ @machi1990 @zgalor @miguelsorianod @JameelB /observability/ @frzifus @simonpasquier @dinhxuanvu @mbarnes /docs/ @geoberle @janboll @tony-schndr @jfchevrette @mmazur @weinong @whober0521 @jonathan34c @stevekuznetsov +/test/ @patriksuba @mbukatov @mgahagan73 diff --git a/go.work b/go.work index fa23cb1a0..87d816137 100644 --- a/go.work +++ b/go.work @@ -10,4 +10,5 @@ use ( ./tooling/mcerepkg ./tooling/templatize tooling/prometheus-rules + ./test ) diff --git a/go.work.sum b/go.work.sum index 59931950b..75957c488 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1549,6 +1549,7 @@ github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042 github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.13.2/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM= github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.22.1/go.mod h1:S6aTpoRsSq2cZOd+pssHAlKW/Q/jZt6cPrPlnj4a1xM= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= @@ -2110,6 +2111,7 @@ golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2168,6 +2170,7 @@ golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/test/e2e/README.md b/test/e2e/README.md new file mode 100644 index 000000000..db241d075 --- /dev/null +++ b/test/e2e/README.md @@ -0,0 +1,69 @@ +# Testing + +## E2E test suite + +The E2E test suite will work in every environment of the ARO-HCP project. Its main purpose is to ensure specific functionality based on the environment and its usage. You can find more details about the test suite design in [ARO-12804](https://issues.redhat.com/browse/ARO-12804). + +- The test suite client connects to the RP frontend in the development environment using port forwarding to localhost. +- In the integration environment, the client will connect to the RP frontend using a public IP (when available) but only within the MSFT corporate network. +- For stage and production environments, the client will connect through ARM once they are set up. + +The client expects a subscription to be already registered. To assign the client to a specific subscription, set its ID in the environment variable **CUSTOMER_SUBSCRIPTION**. If not set, the default all-zero subscription will be used. + +Test cases expect resource group name, where cluster resources (vnet, managed identity, ...) are located, to be set in the environment variable **CUSTOMER_RG_NAME**. + +### Run E2E tests locally against development environment + +1. Login with AZ CLI +2. Port-forward RP running on SC: `kubectl port-forward -n aro-hcp svc/aro-hcp-frontend 8443:8443` +3. Export environment variables LOCAL_DEVELOPMENT, CUSTOMER_SUBSCRIPTION and CUSTOMER_RG_NAME + +```bash +export LOCAL_DEVELOPMENT=true +export CUSTOMER_SUBSCRIPTION= +export CUSTOMER_RG_NAME= +``` + +4. Run test suite with command + +Run all test cases: `ginkgo ./e2e` + +Run specific test case: `ginkgo --focus "" ./e2e` + +Run in debug mode: `ginkgo ./e2e --vv` + +### Writing E2E test with ginkgo + +[Ginkgo documentation](https://onsi.github.io/ginkgo/) + +[Gomega documentation](https://onsi.github.io/gomega/) + +#### Writing specs + +Ginkgo consist of specs nodes structure which can look like: + +- Describe -> It +- Describe -> Context -> It +- Describe -> Describe -> ... + +Every node consist of arguments: +- description +- labels (optional, but very important) +- function. + +Node *It* is last node and contains test itself. To describe useful test steps use function **By(message)**. Decorator **defer** is used to call funtions after test finish (cleanup). To skip a test use function **Skip(message)** with appropriate message. + +In higher level nodes, **BeforeEach** and **AfterEach** functions can be used to run same code before and after every test. + +#### Labels +Create a label with function **Label(name)** in file *util/labels/labels.go*. + +To run tests with specified labels use ginkgo with option --label-filter. Example: `ginkgo --label-filter=QUERY` + +#### Assertions + +To assert values GOMEGA module is used. + +Example: +**Expect(variable).To/ToNot(BeNil(), BeEmpty(), BeTrue(), BeNumerically, ContainString ...)** + diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go new file mode 100644 index 000000000..9b9325bc1 --- /dev/null +++ b/test/e2e/e2e_test.go @@ -0,0 +1,20 @@ +package e2e + +import ( + "context" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestE2E(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "ARO-HCP E2E Tests") +} + +var _ = BeforeSuite(func() { + if err := setup(context.Background()); err != nil { + panic(err) + } +}) diff --git a/test/e2e/get_test.go b/test/e2e/get_test.go new file mode 100644 index 000000000..df14dc4ed --- /dev/null +++ b/test/e2e/get_test.go @@ -0,0 +1,32 @@ +package e2e + +import ( + "context" + "fmt" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + api "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" + "github.com/Azure/ARO-HCP/test/util/labels" +) + +var _ = Describe("Get operation", func() { + var ( + clustersClient *api.HcpOpenShiftClustersClient + ) + + BeforeEach(func() { + By("Prepare HCP clusters client") + clustersClient = clients.NewHcpOpenShiftClustersClient() + }) + + It("Get non existing cluster", labels.Medium, labels.Negative, func(ctx context.Context) { + clusterName := "non-existing-cluster" + By("Send get request for cluster") + _, err := clustersClient.Get(ctx, customerRGName, clusterName, nil) + Expect(err).ToNot(BeNil()) + errMessage := fmt.Sprintf("The resource 'hcpOpenShiftClusters/%s' under resource group '%s' was not found.", clusterName, customerRGName) + Expect(err.Error()).To(ContainSubstring(errMessage)) + }) +}) diff --git a/test/e2e/list_test.go b/test/e2e/list_test.go new file mode 100644 index 000000000..b2083a5e2 --- /dev/null +++ b/test/e2e/list_test.go @@ -0,0 +1,58 @@ +package e2e + +import ( + "context" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + api "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" + "github.com/Azure/ARO-HCP/test/util/labels" + "github.com/Azure/ARO-HCP/test/util/log" +) + +var _ = Describe("List operations", func() { + defer GinkgoRecover() + + var ( + clustersClient *api.HcpOpenShiftClustersClient + ) + + BeforeEach(func() { + By("Prepare HCP clusters client") + clustersClient = clients.NewHcpOpenShiftClustersClient() + }) + + Context("List clusters", func() { + It("List clusters by subscription", labels.Medium, func(ctx context.Context) { + By("Prepare pager to list clusters") + listOptions := &api.HcpOpenShiftClustersClientListBySubscriptionOptions{} + pager := clustersClient.NewListBySubscriptionPager(listOptions) + By("Access IDs of all fetched clusters") + for pager.More() { + clusterList, err := pager.NextPage(ctx) + Expect(err).To(BeNil()) + log.Logger.Infoln("Number of clusters:", len(clusterList.Value)) + for _, val := range clusterList.Value { + Expect(*val.ID).ToNot(BeEmpty()) + log.Logger.Infoln(*val.ID) + } + } + }) + + It("List clusters by resource group", labels.Medium, func(ctx context.Context) { + By("Prepare pager to list clusters") + pager := clustersClient.NewListByResourceGroupPager(customerRGName, nil) + By("Access IDs of all fetched clusters") + for pager.More() { + clusterList, err := pager.NextPage(ctx) + Expect(err).To(BeNil()) + log.Logger.Infoln("Number of clusters:", len(clusterList.Value)) + for _, val := range clusterList.Value { + Expect(*val.ID).ToNot(BeEmpty()) + log.Logger.Infoln(*val.ID) + } + } + }) + }) +}) diff --git a/test/e2e/setup.go b/test/e2e/setup.go new file mode 100644 index 000000000..82f756dd1 --- /dev/null +++ b/test/e2e/setup.go @@ -0,0 +1,75 @@ +package e2e + +import ( + "context" + "os" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + azcorearm "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + + api "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" +) + +var ( + clients *api.ClientFactory + subscriptionID string + customerRGName string +) + +func prepareDevelopmentConf() azcore.ClientOptions { + c := cloud.Configuration{ + ActiveDirectoryAuthorityHost: "https://login.microsoftonline.com/", + Services: map[cloud.ServiceName]cloud.ServiceConfiguration{ + cloud.ResourceManager: { + Audience: "https://management.core.windows.net/", + Endpoint: "http://localhost:8443", + }, + }, + } + opts := azcore.ClientOptions{ + Cloud: c, + InsecureAllowCredentialWithHTTP: true, + } + + return opts +} + +func setup(ctx context.Context) error { + var ( + found bool + creds azcore.TokenCredential + err error + ) + + if subscriptionID, found = os.LookupEnv("CUSTOMER_SUBSCRIPTION"); !found { + subscriptionID = "00000000-0000-0000-0000-000000000000" + } + + customerRGName = os.Getenv("CUSTOMER_RG_NAME") + + opts := prepareDevelopmentConf() + + envOptions := &azidentity.EnvironmentCredentialOptions{ + ClientOptions: opts, + } + creds, err = azidentity.NewEnvironmentCredential(envOptions) + + if _, found := os.LookupEnv("LOCAL_DEVELOPMENT"); found { + creds, err = azidentity.NewAzureCLICredential(nil) + } + if err != nil { + return err + } + + armOptions := &azcorearm.ClientOptions{ + ClientOptions: opts, + } + clients, err = api.NewClientFactory(subscriptionID, creds, armOptions) + if err != nil { + return err + } + + return nil +} diff --git a/test/go.mod b/test/go.mod new file mode 100644 index 000000000..67c27b4c7 --- /dev/null +++ b/test/go.mod @@ -0,0 +1,39 @@ +module github.com/Azure/ARO-HCP/test + +go 1.23.3 + +require ( + github.com/Azure/ARO-HCP/internal v0.0.0-20250205092925-ef76031a2bc1 + github.com/onsi/ginkgo/v2 v2.22.2 + github.com/onsi/gomega v1.36.2 + github.com/sirupsen/logrus v1.9.3 +) + +require ( + github.com/AzureAD/microsoft-authentication-library-for-go v1.3.3 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.33.0 // indirect +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect + golang.org/x/net v0.35.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/tools v0.28.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace github.com/Azure/ARO-HCP/internal => ../internal diff --git a/test/go.sum b/test/go.sum new file mode 100644 index 000000000..ce4814814 --- /dev/null +++ b/test/go.sum @@ -0,0 +1,78 @@ +github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 h1:g0EZJwz7xkXQiZAI5xi9f3WWFYBlX1CPTrR+NDToRkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0/go.mod h1:XCW7KnZet0Opnr7HccfUw1PLc4CjHqpcaxW8DHklNkQ= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= +github.com/AzureAD/microsoft-authentication-library-for-go v1.3.3 h1:H5xDQaE3XowWfhZRUpnfC+rGZMEVoSiji+b+/HFAPU4= +github.com/AzureAD/microsoft-authentication-library-for-go v1.3.3/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= +github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU= +github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk= +github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= +github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= +github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= +golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= +google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/test/util/labels/labels.go b/test/util/labels/labels.go new file mode 100644 index 000000000..595bdf047 --- /dev/null +++ b/test/util/labels/labels.go @@ -0,0 +1,17 @@ +package labels + +import ( + . "github.com/onsi/ginkgo/v2" +) + +var ( + Negative = Label("Negative") +) + +// Test cases importance +var ( + Low = Label("Low") + Medium = Label("Medium") + High = Label("High") + Critical = Label("Critical") +) diff --git a/test/util/log/logger.go b/test/util/log/logger.go new file mode 100644 index 000000000..f92381818 --- /dev/null +++ b/test/util/log/logger.go @@ -0,0 +1,22 @@ +package log + +import ( + "time" + + ginkgo "github.com/onsi/ginkgo/v2" + "github.com/sirupsen/logrus" +) + +func GetLogger() *logrus.Logger { + logger := logrus.New() + logger.SetOutput(ginkgo.GinkgoWriter) + logger.SetFormatter(&logrus.TextFormatter{ + DisableColors: true, + FullTimestamp: true, + TimestampFormat: time.RFC3339, + }) + + return logger +} + +var Logger *logrus.Logger = GetLogger()