-
Notifications
You must be signed in to change notification settings - Fork 13
/
integration_test.go
47 lines (42 loc) · 898 Bytes
/
integration_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// +build integration
package main
import (
"log"
"os"
"os/exec"
"testing"
)
var artifacts = []struct {
in string
out string
}{
{"fixtures/virtualbox-ovf.json", "packer_virtualbox-ovf_virtualbox.vhd"},
{"fixtures/virtualbox-ova.json", "packer_virtualbox-ova_virtualbox.vhd"},
}
// Build the source artifacts.
func init() {
cmd := exec.Command("packer", "build", "--force", "fixtures/virtualbox-iso.json")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
}
func TestIntegration(t *testing.T) {
if err := os.Chdir("test"); err != nil {
t.Error(err)
}
for _, tt := range artifacts {
cmd := exec.Command("packer", "build", "--force", tt.in)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
t.Error(err)
}
if _, err := os.Stat(tt.out); os.IsNotExist(err) {
t.Error(err)
}
}
}