forked from spiffylabs/deploylogger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
44 lines (36 loc) · 867 Bytes
/
main_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
package main
import (
"fmt"
"os"
"os/exec"
)
func init() {
// Create the good test data if it doesn't already exist
if _, err := os.Stat(goodTestData); os.IsNotExist(err) {
fmt.Println("Creating test data")
//create good test data
oldWD, _ := os.Getwd()
err := exec.Command("mkdir", goodTestData).Run()
if err != nil {
panic("could not create dir")
}
err = exec.Command("cp", "testdata/app.yaml", "testdata/good/app.yaml").Run()
if err != nil {
panic("could not move app.yaml")
}
setWD(goodTestData)
err = exec.Command("git", "init").Run()
if err != nil {
panic("could not init git dir")
}
err = exec.Command("git", "add", "-A").Run()
if err != nil {
panic("could not add")
}
err = exec.Command("git", "commit", "-m", "blah blah").Run()
if err != nil {
panic("could not commit")
}
setWD(oldWD)
}
}