From 98fdf4fe2a4b1e814cf59256979dab09cfc7db15 Mon Sep 17 00:00:00 2001 From: Raghav Aggarwal Date: Wed, 20 Dec 2023 23:59:34 +0530 Subject: [PATCH] [MM-42] Fix CI error: implicit memory aliasing (#429) --- server/command_test.go | 2 +- server/configuration_test.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/command_test.go b/server/command_test.go index 15a94b55..eeeb2180 100644 --- a/server/command_test.go +++ b/server/command_test.go @@ -380,7 +380,7 @@ func TestAddWebhookCommand(t *testing.T) { p.GitlabClient = mockedClient conf := &model.Config{} - conf.ServiceSettings.SiteURL = &test.siteURL + conf.ServiceSettings.SiteURL = model.NewString(test.siteURL) encryptedToken, _ := encrypt([]byte(testEncryptionKey), testGitlabToken) diff --git a/server/configuration_test.go b/server/configuration_test.go index dd85d1ea..a306716c 100644 --- a/server/configuration_test.go +++ b/server/configuration_test.go @@ -66,7 +66,7 @@ func TestSetDefaults(t *testing.T) { for _, testCase := range []struct { description string isCloud bool - config configuration + config *configuration shouldChange bool outputCheck func(*testing.T, *configuration) @@ -74,7 +74,7 @@ func TestSetDefaults(t *testing.T) { }{ { description: "noop", - config: configuration{ + config: &configuration{ EncryptionKey: "abcd", WebhookSecret: "efgh", }, @@ -85,7 +85,7 @@ func TestSetDefaults(t *testing.T) { }, }, { description: "set encryption key", - config: configuration{ + config: &configuration{ EncryptionKey: "", }, shouldChange: true, @@ -94,7 +94,7 @@ func TestSetDefaults(t *testing.T) { }, }, { description: "set webhook key", - config: configuration{ + config: &configuration{ WebhookSecret: "", }, shouldChange: true, @@ -103,7 +103,7 @@ func TestSetDefaults(t *testing.T) { }, }, { description: "set webhook and encryption key", - config: configuration{ + config: &configuration{ EncryptionKey: "", WebhookSecret: "", }, @@ -115,7 +115,7 @@ func TestSetDefaults(t *testing.T) { }, { description: "Should not set UsePreregisteredApplication in on-prem", isCloud: false, - config: configuration{ + config: &configuration{ EncryptionKey: "abcd", WebhookSecret: "efgh", UsePreregisteredApplication: false, @@ -128,7 +128,7 @@ func TestSetDefaults(t *testing.T) { }, { description: "Should set UsePreregisteredApplication in cloud if no OAuth secret is configured", isCloud: true, - config: configuration{ + config: &configuration{ EncryptionKey: "abcd", WebhookSecret: "efgh", UsePreregisteredApplication: false, @@ -143,7 +143,7 @@ func TestSetDefaults(t *testing.T) { }, { description: "Should set not UsePreregisteredApplication in cloud if OAuth secret is configured", isCloud: true, - config: configuration{ + config: &configuration{ EncryptionKey: "abcd", WebhookSecret: "efgh", UsePreregisteredApplication: false, @@ -163,7 +163,7 @@ func TestSetDefaults(t *testing.T) { changed, err := testCase.config.setDefaults(testCase.isCloud) assert.Equal(t, testCase.shouldChange, changed) - testCase.outputCheck(t, &testCase.config) + testCase.outputCheck(t, testCase.config) if testCase.errMsg != "" { require.Error(t, err)