From 18a59381fdb40c2df9b4d7ecf67f969f333a019e Mon Sep 17 00:00:00 2001 From: Artur Sawicki Date: Fri, 20 Dec 2024 14:47:32 +0100 Subject: [PATCH] Fix failing multiline related tests --- pkg/acceptance/helpers/function_client.go | 6 ++++-- pkg/acceptance/helpers/procedure_client.go | 2 +- pkg/datasources/users_acceptance_test.go | 12 ++++++------ .../legacy_service_user_acceptance_test.go | 8 ++++---- pkg/resources/service_user_acceptance_test.go | 8 ++++---- pkg/resources/user_acceptance_test.go | 14 +++++++------- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/pkg/acceptance/helpers/function_client.go b/pkg/acceptance/helpers/function_client.go index 1e2c8ee29a..98fd9464e0 100644 --- a/pkg/acceptance/helpers/function_client.go +++ b/pkg/acceptance/helpers/function_client.go @@ -224,7 +224,7 @@ func (c *FunctionClient) SampleJavaDefinitionNoArgs(t *testing.T, className stri return c.formatFunctionDefinition(fmt.Sprintf(` class %[1]s { public static String %[2]s() { - return "hello"; + return null; } } `, className, funcName)) @@ -244,7 +244,9 @@ func (c *FunctionClient) SampleJavascriptDefinition(t *testing.T, argName string func (c *FunctionClient) SampleJavascriptDefinitionNoArgs(t *testing.T) string { t.Helper() - return c.formatFunctionDefinition(`return 1;`) + return c.formatFunctionDefinition(` +return 1; +`) } func (c *FunctionClient) SamplePythonDefinition(t *testing.T, funcName string, argName string) string { diff --git a/pkg/acceptance/helpers/procedure_client.go b/pkg/acceptance/helpers/procedure_client.go index f0066e91dd..6fe9cd686a 100644 --- a/pkg/acceptance/helpers/procedure_client.go +++ b/pkg/acceptance/helpers/procedure_client.go @@ -192,7 +192,7 @@ func (c *ProcedureClient) SampleJavaDefinitionNoArgs(t *testing.T, className str import com.snowflake.snowpark_java.*; class %[1]s { public static String %[2]s(Session session) { - return "hello"; + return null; } } `, className, funcName)) diff --git a/pkg/datasources/users_acceptance_test.go b/pkg/datasources/users_acceptance_test.go index e4355d8f79..69b687a9cc 100644 --- a/pkg/datasources/users_acceptance_test.go +++ b/pkg/datasources/users_acceptance_test.go @@ -46,8 +46,8 @@ func TestAcc_Users_PersonUser(t *testing.T) { WithDefaultRole("some_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). WithMinsToBypassMfa(10). - WithRsaPublicKey(key1). - WithRsaPublicKey2(key2). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)). WithComment(comment). WithDisableMfa("true") @@ -204,8 +204,8 @@ func TestAcc_Users_ServiceUser(t *testing.T) { WithDefaultNamespace("some.namespace"). WithDefaultRole("some_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). - WithRsaPublicKey(key1). - WithRsaPublicKey2(key2). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)). WithComment(comment) resource.Test(t, resource.TestCase{ @@ -364,8 +364,8 @@ func TestAcc_Users_LegacyServiceUser(t *testing.T) { WithDefaultNamespace("some.namespace"). WithDefaultRole("some_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). - WithRsaPublicKey(key1). - WithRsaPublicKey2(key2). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)). WithComment(comment) resource.Test(t, resource.TestCase{ diff --git a/pkg/resources/legacy_service_user_acceptance_test.go b/pkg/resources/legacy_service_user_acceptance_test.go index f078648ddc..1931d4a1dc 100644 --- a/pkg/resources/legacy_service_user_acceptance_test.go +++ b/pkg/resources/legacy_service_user_acceptance_test.go @@ -56,8 +56,8 @@ func TestAcc_LegacyServiceUser_BasicFlows(t *testing.T) { WithDefaultNamespace("some.namespace"). WithDefaultRole("some_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). - WithRsaPublicKey(key1). - WithRsaPublicKey2(key2). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)). WithComment(comment) userModelAllAttributesChanged := func(loginName string) *model.LegacyServiceUserModel { @@ -74,8 +74,8 @@ func TestAcc_LegacyServiceUser_BasicFlows(t *testing.T) { WithDefaultNamespace("one_part_namespace"). WithDefaultRole("other_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). - WithRsaPublicKey(key2). - WithRsaPublicKey2(key1). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key2)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key1)). WithComment(newComment) } diff --git a/pkg/resources/service_user_acceptance_test.go b/pkg/resources/service_user_acceptance_test.go index d511079981..319b8ab61c 100644 --- a/pkg/resources/service_user_acceptance_test.go +++ b/pkg/resources/service_user_acceptance_test.go @@ -51,8 +51,8 @@ func TestAcc_ServiceUser_BasicFlows(t *testing.T) { WithDefaultNamespace("some.namespace"). WithDefaultRole("some_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). - WithRsaPublicKey(key1). - WithRsaPublicKey2(key2). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)). WithComment(comment) userModelAllAttributesChanged := func(loginName string) *model.ServiceUserModel { @@ -67,8 +67,8 @@ func TestAcc_ServiceUser_BasicFlows(t *testing.T) { WithDefaultNamespace("one_part_namespace"). WithDefaultRole("other_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). - WithRsaPublicKey(key2). - WithRsaPublicKey2(key1). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key2)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key1)). WithComment(newComment) } diff --git a/pkg/resources/user_acceptance_test.go b/pkg/resources/user_acceptance_test.go index 4f75ab59ef..373e5b6914 100644 --- a/pkg/resources/user_acceptance_test.go +++ b/pkg/resources/user_acceptance_test.go @@ -64,8 +64,8 @@ func TestAcc_User_BasicFlows(t *testing.T) { WithDefaultRole("some_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). WithMinsToBypassMfa(10). - WithRsaPublicKey(key1). - WithRsaPublicKey2(key2). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)). WithComment(comment). WithDisableMfa("true") @@ -87,8 +87,8 @@ func TestAcc_User_BasicFlows(t *testing.T) { WithDefaultRole("other_role"). WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll). WithMinsToBypassMfa(14). - WithRsaPublicKey(key2). - WithRsaPublicKey2(key1). + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key2)). + WithRsaPublicKey2Value(config.MultilineWrapperVariable(key1)). WithComment(newComment). WithDisableMfa("false") } @@ -696,15 +696,15 @@ func TestAcc_User_issue2970(t *testing.T) { userModel := model.User(resourceName, userId.Name()). WithPassword(pass). - WithRsaPublicKey(key) + WithRsaPublicKeyValue(config.MultilineWrapperVariable(key)) newUserModelIncorrectNewKey := model.User(resourceName, userId.Name()). WithPassword(newPass). - WithRsaPublicKey(incorrectlyFormattedNewKey) + WithRsaPublicKeyValue(config.MultilineWrapperVariable(incorrectlyFormattedNewKey)) newUserModel := model.User(resourceName, userId.Name()). WithPassword(newPass). - WithRsaPublicKey(newKey) + WithRsaPublicKeyValue(config.MultilineWrapperVariable(newKey)) resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,