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{
|
args := []string{
|
||||||
|
"-parallel=false",
|
||||||
"-only=chocolate,vanilla",
|
"-only=chocolate,vanilla",
|
||||||
filepath.Join(testFixture("build-only"), "template.json"),
|
filepath.Join(testFixture("build-only"), "template.json"),
|
||||||
}
|
}
|
||||||
|
@ -58,7 +59,7 @@ func TestBuildStdin(t *testing.T) {
|
||||||
defer func() { os.Stdin = stdin }()
|
defer func() { os.Stdin = stdin }()
|
||||||
|
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
if code := c.Run([]string{"-"}); code != 0 {
|
if code := c.Run([]string{"-parallel=false", "-"}); code != 0 {
|
||||||
fatalCommand(t, c.Meta)
|
fatalCommand(t, c.Meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +77,7 @@ func TestBuildOnlyFileMultipleFlags(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
|
"-parallel=false",
|
||||||
"-only=chocolate",
|
"-only=chocolate",
|
||||||
"-only=cherry",
|
"-only=cherry",
|
||||||
"-only=apple", // ignored
|
"-only=apple", // ignored
|
||||||
|
@ -109,6 +111,7 @@ func TestBuildEverything(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
|
"-parallel=false",
|
||||||
`-except=`,
|
`-except=`,
|
||||||
filepath.Join(testFixture("build-only"), "template.json"),
|
filepath.Join(testFixture("build-only"), "template.json"),
|
||||||
}
|
}
|
||||||
|
@ -133,6 +136,7 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
|
"-parallel=false",
|
||||||
"-except=chocolate,vanilla",
|
"-except=chocolate,vanilla",
|
||||||
filepath.Join(testFixture("build-only"), "template.json"),
|
filepath.Join(testFixture("build-only"), "template.json"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,19 +24,19 @@
|
||||||
{
|
{
|
||||||
"name": "apple",
|
"name": "apple",
|
||||||
"type": "shell-local",
|
"type": "shell-local",
|
||||||
"inline": [ "touch apple.txt" ]
|
"inline": [ "echo apple > apple.txt" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "peach",
|
"name": "peach",
|
||||||
"type": "shell-local",
|
"type": "shell-local",
|
||||||
"inline": [ "touch peach.txt" ]
|
"inline": [ "echo peach > peach.txt" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "pear",
|
"name": "pear",
|
||||||
"type": "shell-local",
|
"type": "shell-local",
|
||||||
"inline": [ "touch pear.txt" ]
|
"inline": [ "echo pear > pear.txt" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
],
|
],
|
||||||
"name": "tomato",
|
"name": "tomato",
|
||||||
"type": "shell-local",
|
"type": "shell-local",
|
||||||
"inline": [ "touch tomato.txt" ]
|
"inline": [ "echo tomato > tomato.txt" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
"chocolate"
|
"chocolate"
|
||||||
],
|
],
|
||||||
"type": "shell-local",
|
"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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
scripts = append(scripts, tempScriptFileName)
|
|
||||||
|
|
||||||
// figure out what extension the file should have, and rename it.
|
// figure out what extension the file should have, and rename it.
|
||||||
if config.TempfileExtension != "" {
|
if config.TempfileExtension != "" {
|
||||||
os.Rename(tempScriptFileName, fmt.Sprintf("%s.%s", tempScriptFileName, config.TempfileExtension))
|
os.Rename(tempScriptFileName, fmt.Sprintf("%s.%s", tempScriptFileName, config.TempfileExtension))
|
||||||
tempScriptFileName = fmt.Sprintf("%s.%s", tempScriptFileName, config.TempfileExtension)
|
tempScriptFileName = fmt.Sprintf("%s.%s", tempScriptFileName, config.TempfileExtension)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scripts = append(scripts, tempScriptFileName)
|
||||||
|
|
||||||
defer os.Remove(tempScriptFileName)
|
defer os.Remove(tempScriptFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue