mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 18:01:01 -06:00
23 lines
483 B
Go
23 lines
483 B
Go
|
package command
|
||
|
|
||
|
import (
|
||
|
"path/filepath"
|
||
|
"sort"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
// testStateBackups returns the list of backups in order of creation
|
||
|
// (oldest first) in the given directory.
|
||
|
func testStateBackups(t *testing.T, dir string) []string {
|
||
|
// Find all the backups
|
||
|
list, err := filepath.Glob(filepath.Join(dir, "*"+DefaultBackupExtension))
|
||
|
if err != nil {
|
||
|
t.Fatalf("err: %s", err)
|
||
|
}
|
||
|
|
||
|
// Sort them which will put them naturally in the right order
|
||
|
sort.Strings(list)
|
||
|
|
||
|
return list
|
||
|
}
|