From 730131c105f14ff3fb160817627b0a934ea8e8c1 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Wed, 7 Sep 2022 16:32:18 -0400 Subject: [PATCH] Add test --- internal/cmd/config/config_test.go | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/internal/cmd/config/config_test.go b/internal/cmd/config/config_test.go index 62126b214..e2ba32f25 100644 --- a/internal/cmd/config/config_test.go +++ b/internal/cmd/config/config_test.go @@ -1686,3 +1686,43 @@ func TestDatabaseConnMaxIdleTimeDuration(t *testing.T) { }) } } + +func TestDatabaseSkipSharedLockAcquisition(t *testing.T) { + tests := []struct { + name string + in string + expSkipSharedLockAcquisition bool + }{ + { + name: "not set", + in: ` + controller { + name = "example-controller" + database { + } + }`, + expSkipSharedLockAcquisition: false, + }, + { + name: "set", + in: ` + controller { + name = "example-controller" + database { + skip_shared_lock_acquisition = true + } + }`, + expSkipSharedLockAcquisition: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + c, err := Parse(tt.in) + require.NoError(t, err) + require.NotNil(t, c) + require.NotNil(t, c.Controller) + require.NotNil(t, c.Controller.Database) + require.Equal(t, tt.expSkipSharedLockAcquisition, *&c.Controller.Database.SkipSharedLockAcquisition) + }) + } +}