You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/command/state_test.go

23 lines
483 B

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
}