github.com/hooklift/nomad@v0.5.7-0.20170407200202-db11e7dd7b55/command/integration_test.go (about) 1 package command_test 2 3 import ( 4 "io/ioutil" 5 "os" 6 "os/exec" 7 "testing" 8 ) 9 10 func TestIntegration_Command_NomadInit(t *testing.T) { 11 tmpDir, err := ioutil.TempDir("", "nomadtest-rootsecretdir") 12 if err != nil { 13 t.Fatalf("unable to create tempdir for test: %v", err) 14 } 15 defer os.RemoveAll(tmpDir) 16 17 { 18 cmd := exec.Command("nomad", "init") 19 cmd.Dir = tmpDir 20 if err := cmd.Run(); err != nil { 21 t.Fatalf("error running init: %v", err) 22 } 23 } 24 25 { 26 cmd := exec.Command("nomad", "validate", "example.nomad") 27 cmd.Dir = tmpDir 28 cmd.Env = []string{`NOMAD_ADDR=http://127.0.0.2:1025`} 29 if err := cmd.Run(); err != nil { 30 t.Fatalf("error validating example.nomad: %v", err) 31 } 32 } 33 }