Cloned GrainsFile test from MinionConfig test
This commit is contained in:
parent
912fc9c2af
commit
31f66b6fe9
|
@ -119,6 +119,29 @@ func TestProvisionerPrepare_MinionConfig_RemotePillarRoots(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestProvisionerPrepare_GrainsFile(t *testing.T) {
|
||||
var p Provisioner
|
||||
config := testConfig()
|
||||
|
||||
config["grains_file"] = "/i/dont/exist/i/think"
|
||||
err := p.Prepare(config)
|
||||
if err == nil {
|
||||
t.Fatal("should have error")
|
||||
}
|
||||
|
||||
tf, err := ioutil.TempFile("", "grains")
|
||||
if err != nil {
|
||||
t.Fatalf("error tempfile: %s", err)
|
||||
}
|
||||
defer os.Remove(tf.Name())
|
||||
|
||||
config["grains_file"] = tf.Name()
|
||||
err = p.Prepare(config)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProvisionerPrepare_LocalStateTree(t *testing.T) {
|
||||
var p Provisioner
|
||||
config := testConfig()
|
||||
|
|
Loading…
Reference in New Issue