From 88957f71fb3fea5b2e9eee9ceb0a4e5772f7436e Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 25 May 2022 12:52:55 -0500 Subject: [PATCH] tests: Add assertion to address review comment --- internal/core/machine_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/core/machine_test.go b/internal/core/machine_test.go index 5c6797e03..7fcef998a 100644 --- a/internal/core/machine_test.go +++ b/internal/core/machine_test.go @@ -60,6 +60,11 @@ func TestMachineSetEmptyId(t *testing.T) { require.Nil(t, dbTarget) require.Error(t, err) + // Verify the DataDir still exists (see below test for more detail on why) + dir, err := tm.DataDir() + require.NoError(t, err) + require.DirExists(t, dir.DataDir().String()) + // Also check new id dbTarget, err = tm.Client().GetTarget(tm.ctx, &vagrant_server.GetTargetRequest{ @@ -74,7 +79,7 @@ func TestMachineSetEmptyId(t *testing.T) { require.Error(t, err) } -func TestMachineSetIdBlankThenSomethingRecreatesDataDir(t *testing.T) { +func TestMachineSetIdBlankThenSomethingPreservesDataDir(t *testing.T) { tm, _ := TestMinimalMachine(t) // Set empty id, followed by a temp id. This is the same thing that happens