export GetPluginOutputDir
@@ -48,7 +48,7 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() {
defer os.RemoveAll(tempDir)
o.Expect(oc.Run("adm", "must-gather").Args("--dest-dir", tempDir).Execute()).To(o.Succeed())
- pluginOutputDir := getPluginOutputDir(tempDir)
+ pluginOutputDir := GetPluginOutputDir(tempDir)
expectedDirectories := [][]string{
{pluginOutputDir, "cluster-scoped-resources", "config.openshift.io"},
@@ -119,7 +119,7 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() {
"ls -l > /artifacts/ls.log",
}
o.Expect(oc.Run("adm", "must-gather").Args(args...).Execute()).To(o.Succeed())
- expectedFilePath := path.Join(getPluginOutputDir(tempDir), "ls.log")
+ expectedFilePath := path.Join(GetPluginOutputDir(tempDir), "ls.log")
o.Expect(expectedFilePath).To(o.BeAnExistingFile())
stat, err := os.Stat(expectedFilePath)
o.Expect(err).NotTo(o.HaveOccurred())
@@ -186,7 +186,7 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() {
// wait for the contents to show up in the plugin output directory, avoiding EOF errors
time.Sleep(10 * time.Second)
- pluginOutputDir := getPluginOutputDir(tempDir)
+ pluginOutputDir := GetPluginOutputDir(tempDir)
expectedDirectoriesToExpectedCount := map[string]int{
path.Join(pluginOutputDir, "audit_logs", "kube-apiserver"): 1000,
@@ -331,7 +331,7 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() {
o.Expect(oc.Run("adm", "must-gather").Args(args...).Execute()).To(o.Succeed())
- pluginOutputDir := getPluginOutputDir(tempDir)
+ pluginOutputDir := GetPluginOutputDir(tempDir)
expectedAuditSubDirs := []string{"kube-apiserver", "openshift-apiserver", "oauth-apiserver"}
seen := sets.String{}
@@ -365,13 +365,13 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() {
})
})
-// getPluginOutputDir returns the directory containing must-gather assets.
+// GetPluginOutputDir returns the directory containing must-gather assets.
// Before [1], the assets were placed directly in tempDir. Since [1],
// they have been placed in a subdirectory named after the must-gather
// image.
//
// [1]: https://github.com/openshift/oc/pull/84
-func getPluginOutputDir(tempDir string) string {
+func GetPluginOutputDir(tempDir string) string {
files, err := os.ReadDir(tempDir)
o.Expect(err).NotTo(o.HaveOccurred())
dir := ""
