Skip to content

Commit e710b3c

Browse files
committed
Use sub-directory to save files
1 parent 3764b28 commit e710b3c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/monitortests/cli/adm_upgrade/status/monitortest.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os"
7+
"path"
78
"path/filepath"
89
"strings"
910
"time"
@@ -161,11 +162,15 @@ func (w *monitor) EvaluateTestsFromConstructedIntervals(ctx context.Context, fin
161162
}
162163

163164
func (w *monitor) WriteContentToStorage(ctx context.Context, storageDir, timeSuffix string, finalIntervals monitorapi.Intervals, finalResourceState monitorapi.ResourcesMap) error {
165+
folderPath := path.Join(storageDir, "adm-upgrade-status")
166+
if err := os.MkdirAll(folderPath, os.ModePerm); err != nil {
167+
return fmt.Errorf("unable to create directory %s: %w", folderPath, err)
168+
}
169+
164170
var errs []error
165171
for when, observed := range w.ocAdmUpgradeStatus {
166-
// TODO: Maybe make a directory for these files
167172
outputFilename := fmt.Sprintf("adm-upgrade-status-%s_%s.txt", when, timeSuffix)
168-
outputFile := filepath.Join(storageDir, outputFilename)
173+
outputFile := filepath.Join(folderPath, outputFilename)
169174
if err := os.WriteFile(outputFile, []byte(observed.out), 0644); err != nil {
170175
errs = append(errs, fmt.Errorf("failed to write %s: %w", outputFile, err))
171176
}

0 commit comments

Comments
 (0)