mirror of
https://github.com/kopia/kopia.git
synced 2026-05-11 16:25:13 -04:00
chore(ci): include date-time in temp dir name used for tests (#4651)
While sorting by modification time is possible with OS tools, such as `ls`, including the directory creation time in the name facilitates cleanup in local dev environments where tests fail often.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -24,7 +25,7 @@
|
||||
|
||||
// GetInterestingTempDirectoryName returns interesting directory name used for testing.
|
||||
func GetInterestingTempDirectoryName() (string, error) {
|
||||
td, err := os.MkdirTemp("", "kopia-test")
|
||||
td, err := os.MkdirTemp("", "kopia-test-"+time.Now().UTC().Format("20060102-150405")) //nolint:forbidigo
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "unable to create temp directory")
|
||||
}
|
||||
@@ -73,7 +74,7 @@ func TempDirectory(tb testing.TB) string {
|
||||
func TempDirectoryShort(tb testing.TB) string {
|
||||
tb.Helper()
|
||||
|
||||
d, err := os.MkdirTemp("", "kopia-test")
|
||||
d, err := os.MkdirTemp("", "kopia-test-"+time.Now().UTC().Format("20060102-150405")) //nolint:forbidigo
|
||||
if err != nil {
|
||||
tb.Fatal(errors.Wrap(err, "unable to create temp directory"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user