Skip to content

Commit bfed9f6

Browse files
Merge pull request #1863 from openshift-cherrypick-robot/cherry-pick-1861-to-release-0.7
[release-0.7] e2e: save data in some temporary directory
2 parents 3837ca0 + bedcad6 commit bfed9f6

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

test/e2e/framework/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func registerFlags(c *testConfig) {
107107
// workspace plugin with --kubeconfig.
108108
func WriteLogicalClusterConfig(t *testing.T, rawConfig clientcmdapi.Config, contextName string, clusterName logicalcluster.Name) (clientcmd.ClientConfig, string) {
109109
logicalRawConfig := LogicalClusterRawConfig(rawConfig, clusterName, contextName)
110-
artifactDir, err := CreateTempDirForTest(t, "artifacts")
110+
artifactDir, _, err := ScratchDirs(t)
111111
require.NoError(t, err)
112112
pathSafeClusterName := strings.ReplaceAll(clusterName.String(), ":", "_")
113113
kubeconfigPath := filepath.Join(artifactDir, fmt.Sprintf("%s.kubeconfig", pathSafeClusterName))

test/e2e/framework/syncer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (sf *syncerFixture) Start(t *testing.T) *StartedSyncerFixture {
166166
// Apply the yaml output from the plugin to the downstream server
167167
KubectlApply(t, downstreamKubeconfigPath, syncerYAML)
168168

169-
artifactDir, err := CreateTempDirForTest(t, "artifacts")
169+
artifactDir, _, err := ScratchDirs(t)
170170
if err != nil {
171171
t.Errorf("failed to create temp dir for syncer artifacts: %v", err)
172172
}

test/e2e/framework/util.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,13 @@ var fs embed.FS
6464
// TODO(marun) Is there a way to avoid embedding by determining the
6565
// path to the file during test execution?
6666
func WriteTokenAuthFile(t *testing.T) string {
67-
dataDir, err := CreateTempDirForTest(t, "data")
68-
require.NoError(t, err)
69-
7067
// This file is expected to be embedded from the package directory.
7168
tokensFilename := "auth-tokens.csv"
7269

7370
data, err := fs.ReadFile(tokensFilename)
7471
require.NoError(t, err, "error reading tokens file")
7572

76-
tokensPath := path.Join(dataDir, tokensFilename)
73+
tokensPath := path.Join(t.TempDir(), tokensFilename)
7774
tokensFile, err := os.Create(tokensPath)
7875
require.NoError(t, err, "failed to create tokens file")
7976
defer tokensFile.Close()
@@ -145,11 +142,7 @@ func ScratchDirs(t *testing.T) (string, string, error) {
145142
if err != nil {
146143
return "", "", err
147144
}
148-
dataDir, err := CreateTempDirForTest(t, "data")
149-
if err != nil {
150-
return "", "", err
151-
}
152-
return artifactDir, dataDir, nil
145+
return artifactDir, t.TempDir(), nil
153146
}
154147

155148
func (c *kcpServer) Artifact(t *testing.T, producer func() (runtime.Object, error)) {

test/e2e/reconciler/ingress/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func TestIngressController(t *testing.T) {
323323
require.NoError(t, err, "failed to pick envoy listener port")
324324
xdsListenerPort, err := framework.GetFreePort(t)
325325
require.NoError(t, err, "failed to pick xds listener port")
326-
artifactDir, err := framework.CreateTempDirForTest(t, "artifacts")
326+
artifactDir, _, err := framework.ScratchDirs(t)
327327
require.NoError(t, err, "failed to create artifact dir for ingress-controller")
328328
kubeconfigPath := filepath.Join(artifactDir, "ingress-controller.kubeconfig")
329329
adminConfig, err := source.RawConfig()

0 commit comments

Comments
 (0)