github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/verify-infra/restapi/argocd_url_test.go (about)

     1  // Copyright (c) 2023, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package restapi_test
     5  
     6  import (
     7  	"fmt"
     8  	"time"
     9  
    10  	. "github.com/onsi/ginkgo/v2"
    11  	"github.com/verrazzano/verrazzano/platform-operator/apis/verrazzano/v1beta1"
    12  	"github.com/verrazzano/verrazzano/tests/e2e/pkg"
    13  	"github.com/verrazzano/verrazzano/tests/e2e/pkg/test/framework/metrics"
    14  )
    15  
    16  var _ = t.Describe("Argo CD", Label("f:infra-lcm",
    17  	"f:ui.console"), func() {
    18  
    19  	t.BeforeEach(func() {
    20  		argoCD := vz.Status.Components["argocd"]
    21  		if argoCD == nil || argoCD.State == v1beta1.CompStateDisabled {
    22  			Skip("Argo CD disabled, skipping test")
    23  		}
    24  
    25  	})
    26  
    27  	t.Context("is enabled", func() {
    28  		t.It("Web URL and the applications page is accessible", func() {
    29  			start := time.Now()
    30  			// Verifying if the Argo CD Ingress URL is accessible
    31  			err := pkg.VerifyArgoCDAccess(t.Logs)
    32  			if err != nil {
    33  				t.Logs.Error(fmt.Sprintf("Error verifying access to Argocd: %v", err))
    34  				t.Fail(err.Error())
    35  			}
    36  
    37  			metrics.Emit(t.Metrics.With("argocd_access_elapsed_time", time.Since(start).Milliseconds()))
    38  
    39  			start = time.Now()
    40  			t.Logs.Info("Accessing the Argocd Applications")
    41  			//Verifying if the Applications page is accessible after login
    42  			err = pkg.VerifyArgoCDApplicationAccess(t.Logs)
    43  			if err != nil {
    44  				t.Logs.Error(fmt.Sprintf("Error verifying access to Argocd application: %v", err))
    45  				t.Fail(err.Error())
    46  			}
    47  
    48  			metrics.Emit(t.Metrics.With("argocd_access_elapsed_time", time.Since(start).Milliseconds()))
    49  
    50  		})
    51  	})
    52  })