mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
Update output directory used in TestArchive (#11406)
This change uses a different as part of the TestArchive output path to fix an intermittently failing test case on Windows caused by using the same output name across test cases. Originally tired to use t.TempDir() to gt a temp path but ran into errors with parsing the config on Windows. ``` Unable to parse test config: invalid character 'U' in string escape code ```
This commit is contained in:
parent
09b29bc4c0
commit
55b49cdb6f
1 changed files with 4 additions and 3 deletions
|
|
@ -235,6 +235,7 @@ func TestArchive(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
tmpArchiveFile := "temp-archive-package"
|
||||
for format, unzip := range tc {
|
||||
t.Run(format, func(t *testing.T) {
|
||||
config := fmt.Sprintf(`
|
||||
|
|
@ -242,11 +243,11 @@ func TestArchive(t *testing.T) {
|
|||
"post-processors": [
|
||||
{
|
||||
"type": "compress",
|
||||
"output": "package.%s"
|
||||
"output": "%s.%s"
|
||||
}
|
||||
]
|
||||
}
|
||||
`, format)
|
||||
`, tmpArchiveFile, format)
|
||||
|
||||
artifact := testArchive(t, config)
|
||||
defer func() {
|
||||
|
|
@ -256,7 +257,7 @@ func TestArchive(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
filename := fmt.Sprintf("package.%s", format)
|
||||
filename := fmt.Sprintf("%s.%s", tmpArchiveFile, format)
|
||||
// Verify things look good
|
||||
_, err := os.Stat(filename)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue