Fix unit tests

The type needs a string pointer now. We may end up wanting a string
pointer making convenience method in the SDK at some point, but for now
I punted on that question and just made one for the test.
This commit is contained in:
Paul Hinze 2022-03-01 17:13:34 -06:00
parent e3444f40bc
commit 4b0acfb513
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -242,7 +242,7 @@ func TestMachineSyncedFolders(t *testing.T) {
errors: false,
config: &vagrant_plugin_sdk.Vagrantfile_ConfigVM{
SyncedFolders: []*vagrant_plugin_sdk.Vagrantfile_SyncedFolder{
{Source: ".", Destination: "/vagrant", Type: "mysyncedfolder"},
{Source: ".", Destination: "/vagrant", Type: stringPtr("mysyncedfolder")},
},
},
expectedFolders: 1,
@ -253,9 +253,9 @@ func TestMachineSyncedFolders(t *testing.T) {
errors: false,
config: &vagrant_plugin_sdk.Vagrantfile_ConfigVM{
SyncedFolders: []*vagrant_plugin_sdk.Vagrantfile_SyncedFolder{
{Source: ".", Destination: "/vagrant", Type: "mysyncedfolder"},
{Source: "./two", Destination: "/vagrant-two", Type: "mysyncedfolder"},
{Source: "./three", Destination: "/vagrant-three", Type: "myothersyncedfolder"},
{Source: ".", Destination: "/vagrant", Type: stringPtr("mysyncedfolder")},
{Source: "./two", Destination: "/vagrant-two", Type: stringPtr("mysyncedfolder")},
{Source: "./three", Destination: "/vagrant-three", Type: stringPtr("myothersyncedfolder")},
},
},
expectedFolders: 3,
@ -266,9 +266,9 @@ func TestMachineSyncedFolders(t *testing.T) {
errors: true,
config: &vagrant_plugin_sdk.Vagrantfile_ConfigVM{
SyncedFolders: []*vagrant_plugin_sdk.Vagrantfile_SyncedFolder{
{Source: ".", Destination: "/vagrant", Type: "idontexist"},
{Source: "./two", Destination: "/vagrant-two", Type: "mysyncedfolder"},
{Source: "./three", Destination: "/vagrant-three", Type: "myothersyncedfolder"},
{Source: ".", Destination: "/vagrant", Type: stringPtr("idontexist")},
{Source: "./two", Destination: "/vagrant-two", Type: stringPtr("mysyncedfolder")},
{Source: "./three", Destination: "/vagrant-three", Type: stringPtr("myothersyncedfolder")},
},
},
},
@ -290,3 +290,7 @@ func TestMachineSyncedFolders(t *testing.T) {
}
}
}
func stringPtr(s string) *string {
return &s
}