diff --git a/provisioner/salt-masterless/provisioner_test.go b/provisioner/salt-masterless/provisioner_test.go index 2b7f3a026..2b40887d3 100644 --- a/provisioner/salt-masterless/provisioner_test.go +++ b/provisioner/salt-masterless/provisioner_test.go @@ -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()