Merge pull request #7467 from hashicorp/fix_windows_tests
Fix windows tests
This commit is contained in:
commit
5b07926b69
|
@ -17,6 +17,7 @@ func TestBuildOnlyFileCommaFlags(t *testing.T) {
|
|||
}
|
||||
|
||||
args := []string{
|
||||
"-parallel=false",
|
||||
"-only=chocolate,vanilla",
|
||||
filepath.Join(testFixture("build-only"), "template.json"),
|
||||
}
|
||||
|
@ -58,7 +59,7 @@ func TestBuildStdin(t *testing.T) {
|
|||
defer func() { os.Stdin = stdin }()
|
||||
|
||||
defer cleanup()
|
||||
if code := c.Run([]string{"-"}); code != 0 {
|
||||
if code := c.Run([]string{"-parallel=false", "-"}); code != 0 {
|
||||
fatalCommand(t, c.Meta)
|
||||
}
|
||||
|
||||
|
@ -76,6 +77,7 @@ func TestBuildOnlyFileMultipleFlags(t *testing.T) {
|
|||
}
|
||||
|
||||
args := []string{
|
||||
"-parallel=false",
|
||||
"-only=chocolate",
|
||||
"-only=cherry",
|
||||
"-only=apple", // ignored
|
||||
|
@ -109,6 +111,7 @@ func TestBuildEverything(t *testing.T) {
|
|||
}
|
||||
|
||||
args := []string{
|
||||
"-parallel=false",
|
||||
`-except=`,
|
||||
filepath.Join(testFixture("build-only"), "template.json"),
|
||||
}
|
||||
|
@ -133,6 +136,7 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
|
|||
}
|
||||
|
||||
args := []string{
|
||||
"-parallel=false",
|
||||
"-except=chocolate,vanilla",
|
||||
filepath.Join(testFixture("build-only"), "template.json"),
|
||||
}
|
||||
|
|
|
@ -24,19 +24,19 @@
|
|||
{
|
||||
"name": "apple",
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch apple.txt" ]
|
||||
"inline": [ "echo apple > apple.txt" ]
|
||||
},
|
||||
{
|
||||
"name": "peach",
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch peach.txt" ]
|
||||
"inline": [ "echo peach > peach.txt" ]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"name": "pear",
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch pear.txt" ]
|
||||
"inline": [ "echo pear > pear.txt" ]
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -46,7 +46,7 @@
|
|||
],
|
||||
"name": "tomato",
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch tomato.txt" ]
|
||||
"inline": [ "echo tomato > tomato.txt" ]
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -55,7 +55,7 @@
|
|||
"chocolate"
|
||||
],
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch unnamed.txt" ]
|
||||
"inline": [ "echo unnamed > unnamed.txt" ]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
|
|
@ -54,13 +54,15 @@ func Run(ui packer.Ui, config *Config) (bool, error) {
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
scripts = append(scripts, tempScriptFileName)
|
||||
|
||||
// figure out what extension the file should have, and rename it.
|
||||
if config.TempfileExtension != "" {
|
||||
os.Rename(tempScriptFileName, fmt.Sprintf("%s.%s", tempScriptFileName, config.TempfileExtension))
|
||||
tempScriptFileName = fmt.Sprintf("%s.%s", tempScriptFileName, config.TempfileExtension)
|
||||
}
|
||||
|
||||
scripts = append(scripts, tempScriptFileName)
|
||||
|
||||
defer os.Remove(tempScriptFileName)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue