From 3b138c8b16668f17bfcd367d05b5f7846d185caf Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 3 May 2018 09:55:03 -0400 Subject: MM-10189 Fixed inconsistency when using environment variables for MessageExportSettings (#8705) --- utils/config_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'utils/config_test.go') diff --git a/utils/config_test.go b/utils/config_test.go index ec66a30f0..75bbc420f 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -396,3 +396,25 @@ func sToP(s string) *string { func bToP(b bool) *bool { return &b } + +func TestGetDefaultsFromStruct(t *testing.T) { + s := struct { + TestSettings struct { + IntValue int + BoolValue bool + StringValue string + } + PointerToTestSettings *struct { + Value int + } + }{} + + defaults := getDefaultsFromStruct(s) + + assert.Equal(t, defaults["TestSettings.IntValue"], 0) + assert.Equal(t, defaults["TestSettings.BoolValue"], false) + assert.Equal(t, defaults["TestSettings.StringValue"], "") + assert.Equal(t, defaults["PointerToTestSettings.Value"], 0) + assert.NotContains(t, defaults, "PointerToTestSettings") + assert.Len(t, defaults, 4) +} -- cgit v1.2.3-1-g7c22