Few small fixes to make the last tests also pass

The reason why the shebang is removed from these tests, is because the
shebang is only needed for SSH/Linux connections. So in the new setup
the shebang line is added in the SSH communicator instead of in the
resource provisioner itself…
This commit is contained in:
Sander van Harmelen 2015-04-10 00:50:48 +02:00
parent c9e9e374bb
commit b1c6a3f63f
2 changed files with 11 additions and 13 deletions

View File

@ -41,6 +41,11 @@ func TestResourceProvider_Validate_bad(t *testing.T) {
}
}
var expectedScriptOut = `cd /tmp
wget http://foobar
exit 0
`
func TestResourceProvider_generateScript(t *testing.T) {
p := new(ResourceProvisioner)
conf := testConfig(t, map[string]interface{}{
@ -60,12 +65,6 @@ func TestResourceProvider_generateScript(t *testing.T) {
}
}
var expectedScriptOut = `#!/bin/sh
cd /tmp
wget http://foobar
exit 0
`
func TestResourceProvider_CollectScripts_inline(t *testing.T) {
p := new(ResourceProvisioner)
conf := testConfig(t, map[string]interface{}{
@ -91,8 +90,8 @@ func TestResourceProvider_CollectScripts_inline(t *testing.T) {
t.Fatalf("err: %v", err)
}
if string(out.Bytes()) != expectedScriptOut {
t.Fatalf("bad: %v", out.Bytes())
if out.String() != expectedScriptOut {
t.Fatalf("bad: %v", out.String())
}
}
@ -117,8 +116,8 @@ func TestResourceProvider_CollectScripts_script(t *testing.T) {
t.Fatalf("err: %v", err)
}
if string(out.Bytes()) != expectedScriptOut {
t.Fatalf("bad: %v", out.Bytes())
if out.String() != expectedScriptOut {
t.Fatalf("bad: %v", out.String())
}
}
@ -148,8 +147,8 @@ func TestResourceProvider_CollectScripts_scripts(t *testing.T) {
t.Fatalf("err: %v", err)
}
if string(out.Bytes()) != expectedScriptOut {
t.Fatalf("bad: %v", out.Bytes())
if out.String() != expectedScriptOut {
t.Fatalf("bad: %v", out.String())
}
}
}

View File

@ -1,4 +1,3 @@
#!/bin/sh
cd /tmp
wget http://foobar
exit 0