From 4b0acfb513df177bf9a3385ce804e50f86a92f40 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Tue, 1 Mar 2022 17:13:34 -0600 Subject: [PATCH] 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. --- internal/core/machine_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/internal/core/machine_test.go b/internal/core/machine_test.go index b64ce6b0f..edec3d871 100644 --- a/internal/core/machine_test.go +++ b/internal/core/machine_test.go @@ -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 +}