|
|
|
|
@ -327,6 +327,26 @@ func TestProviderFromVagrantBox_metadata_bad_json(t *testing.T) {
|
|
|
|
|
t.Logf("%s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestProviderFromVagrantBox_metadata_no_provider_key(t *testing.T) {
|
|
|
|
|
// Bad: Create a box with no 'provider' key in the metadata.json file
|
|
|
|
|
files := tarFiles{
|
|
|
|
|
{"foo.txt", "This is a foo file"},
|
|
|
|
|
{"bar.txt", "This is a bar file"},
|
|
|
|
|
{"metadata.json", `{"cows":"moo"}`},
|
|
|
|
|
}
|
|
|
|
|
boxfile, err := createBox(files)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("Error creating test box: %s", err)
|
|
|
|
|
}
|
|
|
|
|
defer os.Remove(boxfile.Name())
|
|
|
|
|
|
|
|
|
|
_, err = providerFromVagrantBox(boxfile.Name())
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatalf("Should have error as box files metadata.json file is empty")
|
|
|
|
|
}
|
|
|
|
|
t.Logf("%s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestProviderFromVagrantBox_metadata_provider_value_empty(t *testing.T) {
|
|
|
|
|
// Bad: The boxes metadata.json file 'provider' key has an empty value
|
|
|
|
|
files := tarFiles{
|
|
|
|
|
|