Add tests for rotated files in bundle

This commit is contained in:
Theodor S. Midtlien
2026-06-02 11:07:27 +02:00
parent 702d45b7e5
commit 8d0f49ae29
2 changed files with 104 additions and 11 deletions
+1 -11
View File
@@ -1048,23 +1048,13 @@ func (g *BundleGenerator) addRotatedLogFiles(logDir string) {
}
// This regex will match both logs rotated by us and logrotate on linux
pattern := filepath.Join(logDir, "client*.log*.gz")
pattern := filepath.Join(logDir, "client*.log.*")
files, err := filepath.Glob(pattern)
if err != nil {
log.Warnf("failed to glob rotated logs: %v", err)
return
}
// This regex will match plain logs rotated by logrotate on linux.
// We assume that logrotate is configured with nocompress or delaycompress.
pattern = filepath.Join(logDir, "client*.log.*")
uncompressedFiles, err := filepath.Glob(pattern)
if err != nil {
log.Warnf("failed to glob rotated logs: %v", err)
return
}
files = uncompressedFiles
if len(files) == 0 {
return
}