Browse Source

Merge pull request #39506 from thaJeztah/group_test_subdirs

integration: organize bundle directory per test
Sebastiaan van Stijn 6 years ago
parent
commit
0e041d68d8
1 changed files with 13 additions and 0 deletions
  1. 13 0
      internal/test/daemon/daemon.go

+ 13 - 0
internal/test/daemon/daemon.go

@@ -34,6 +34,13 @@ type testingT interface {
 	Fatalf(string, ...interface{})
 	Fatalf(string, ...interface{})
 }
 }
 
 
+type namer interface {
+	Name() string
+}
+type testNamer interface {
+	TestName() string
+}
+
 type logT interface {
 type logT interface {
 	Logf(string, ...interface{})
 	Logf(string, ...interface{})
 }
 }
@@ -96,6 +103,12 @@ func New(t testingT, ops ...func(*Daemon)) *Daemon {
 	if dest == "" {
 	if dest == "" {
 		dest = os.Getenv("DEST")
 		dest = os.Getenv("DEST")
 	}
 	}
+	switch v := t.(type) {
+	case namer:
+		dest = filepath.Join(dest, v.Name())
+	case testNamer:
+		dest = filepath.Join(dest, v.TestName())
+	}
 	assert.Check(t, dest != "", "Please set the DOCKER_INTEGRATION_DAEMON_DEST or the DEST environment variable")
 	assert.Check(t, dest != "", "Please set the DOCKER_INTEGRATION_DAEMON_DEST or the DEST environment variable")
 
 
 	storageDriver := os.Getenv("DOCKER_GRAPHDRIVER")
 	storageDriver := os.Getenv("DOCKER_GRAPHDRIVER")