Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
npolshakova committed May 16, 2024
1 parent a53c1a2 commit 2ac8189
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/kubernetes/e2e/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ func CreateTestInstallationForCluster(

// GeneratedFiles contains the unique location where files generated during the execution
// of tests against this installation will be stored
// By creating a unique location, per TestInstallation, we guarantee isolation between TestInstallation
GeneratedFiles: MustGeneratedFiles(glooGatewayContext.InstallNamespace),
// By creating a unique location, per TestInstallation and per ClusterId we guarantee isolation
// between TestInstallation outputs per CI run
GeneratedFiles: MustGeneratedFiles(glooGatewayContext.InstallNamespace, clusterContext.ClusterId),
}
runtime.SetFinalizer(installation, func(i *TestInstallation) { i.finalize() })
return installation
Expand Down Expand Up @@ -196,16 +197,14 @@ type GeneratedFiles struct {
}

// MustGeneratedFiles returns GeneratedFiles, or panics if there was an error generating the directories
func MustGeneratedFiles(tmpDirId string) GeneratedFiles {
func MustGeneratedFiles(tmpDirId, clusterId string) GeneratedFiles {
tmpDir, err := os.MkdirTemp("", tmpDirId)
if err != nil {
panic(err)
}

// Get cluster id if it is set in the env to avoid conflicts when uploading artifacts on failed workflow runs
clusterId := os.Getenv(testutils.ClusterId)

failureDir := filepath.Join(testruntime.PathToBugReport(), tmpDirId, clusterId)
// output path is in the format of bug_report/cluster_id/tmp_dir_id
failureDir := filepath.Join(testruntime.PathToBugReport(), clusterId, tmpDirId)
err = os.MkdirAll(failureDir, os.ModePerm)
if err != nil {
panic(err)
Expand Down
3 changes: 3 additions & 0 deletions test/kubernetes/testutils/cluster/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ type Context struct {

// A set of clients for interacting with the Kubernetes Cluster
Clientset *kubernetes.Clientset

// Cluster id is a unique identifier for the cluster running in CI
ClusterId string
}
3 changes: 3 additions & 0 deletions test/kubernetes/testutils/cluster/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"

"github.com/solo-io/gloo/test/testutils"
"k8s.io/apimachinery/pkg/runtime"

"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -56,5 +57,7 @@ func MustKindContextWithScheme(clusterName string, scheme *runtime.Scheme) *Cont
Cli: kubectl.NewCli().WithKubeContext(kubeCtx).WithReceiver(os.Stdout),
Client: clt,
Clientset: clientset,
// Get cluster id if it is set in the env to avoid conflicts when uploading artifacts on failed workflow runs
ClusterId: os.Getenv(testutils.ClusterId),
}
}

0 comments on commit 2ac8189

Please sign in to comment.