Skip to content

Commit f023f58

Browse files
authored
Merge pull request kubernetes#92705 from pohly/nested-directories-podlogs
e2e pod logs: use hierarchical directory structure
2 parents e37c04b + 8f55fad commit f023f58

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/e2e/storage/testsuites/base.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,24 @@ func StartPodLogs(f *framework.Framework, driverNamespace *v1.Namespace) func()
578578
to.LogWriter = ginkgo.GinkgoWriter
579579
} else {
580580
test := ginkgo.CurrentGinkgoTestDescription()
581+
// Clean up each individual component text such that
582+
// it contains only characters that are valid as file
583+
// name.
581584
reg := regexp.MustCompile("[^a-zA-Z0-9_-]+")
585+
var components []string
586+
for _, component := range test.ComponentTexts {
587+
components = append(components, reg.ReplaceAllString(component, "_"))
588+
}
582589
// We end the prefix with a slash to ensure that all logs
583590
// end up in a directory named after the current test.
584591
//
585-
// TODO: use a deeper directory hierarchy once gubernator
586-
// supports that (https://github.com/kubernetes/test-infra/issues/10289).
592+
// Each component name maps to a directory. This
593+
// avoids cluttering the root artifact directory and
594+
// keeps each directory name smaller (the full test
595+
// name at one point exceeded 256 characters, which was
596+
// too much for some filesystems).
587597
to.LogPathPrefix = framework.TestContext.ReportDir + "/" +
588-
reg.ReplaceAllString(test.FullTestText, "_") + "/"
598+
strings.Join(components, "/") + "/"
589599
}
590600
podlogs.CopyAllLogs(ctx, cs, ns, to)
591601

0 commit comments

Comments
 (0)