Cloned GrainsFile test from MinionConfig test

This commit is contained in:
Ian Ellis 2017-06-04 13:03:50 +01:00
parent 912fc9c2af
commit 31f66b6fe9
1 changed files with 23 additions and 0 deletions

View File

@ -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()