From 90d7476ecf541c10385b894560b7bb4615b0032a Mon Sep 17 00:00:00 2001 From: YannC Date: Wed, 4 Dec 2024 10:26:02 +0100 Subject: [PATCH] fix(): tests --- internal/provider/resource_binding_test.go | 8 ++++---- internal/provider/resource_user_password_test.go | 3 ++- internal/provider/resource_user_test.go | 10 ++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/internal/provider/resource_binding_test.go b/internal/provider/resource_binding_test.go index 33ed9d9..5f64ea5 100644 --- a/internal/provider/resource_binding_test.go +++ b/internal/provider/resource_binding_test.go @@ -13,7 +13,7 @@ func TestAccBinding(t *testing.T) { ProviderFactories: providerFactories, Steps: []resource.TestStep{ { - Config: testAccResourceBinding("GROUP", "admin", "admin", "namespace = \"io.kestra.terraform.data\"", "new"), + Config: testAccResourceBinding("GROUP", "admin", "admin_default", "namespace = \"io.kestra.terraform.data\"", "new"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "kestra_binding.new", "type", "GROUP", @@ -22,7 +22,7 @@ func TestAccBinding(t *testing.T) { "kestra_binding.new", "external_id", "admin", ), resource.TestCheckResourceAttr( - "kestra_binding.new", "role_id", "admin", + "kestra_binding.new", "role_id", "admin_default", ), resource.TestCheckResourceAttr( "kestra_binding.new", "namespace", "io.kestra.terraform.data", @@ -30,7 +30,7 @@ func TestAccBinding(t *testing.T) { ), }, { - Config: testAccResourceBinding("USER", "john", "admin2", "", "new"), + Config: testAccResourceBinding("USER", "john", "launcher_default", "", "new"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "kestra_binding.new", "type", "USER", @@ -39,7 +39,7 @@ func TestAccBinding(t *testing.T) { "kestra_binding.new", "external_id", "john", ), resource.TestCheckResourceAttr( - "kestra_binding.new", "role_id", "admin2", + "kestra_binding.new", "role_id", "launcher_default", ), ), }, diff --git a/internal/provider/resource_user_password_test.go b/internal/provider/resource_user_password_test.go index 9037f68..a25685c 100644 --- a/internal/provider/resource_user_password_test.go +++ b/internal/provider/resource_user_password_test.go @@ -40,7 +40,8 @@ func testAccResourceUserPassword(password string) string { return fmt.Sprintf( ` resource "kestra_user" "new" { - username = "my-new-user" + username = "new@user.com" + email = "new@user.com" } resource "kestra_user_password" "new" { diff --git a/internal/provider/resource_user_test.go b/internal/provider/resource_user_test.go index 06d6afd..7b6db8f 100644 --- a/internal/provider/resource_user_test.go +++ b/internal/provider/resource_user_test.go @@ -15,13 +15,12 @@ func TestAccUser(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccResourceUser( - "admin", "admin@john.doe", "[kestra_group.group1.id]", ), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( - "kestra_user.new", "username", "admin", + "kestra_user.new", "username", "admin@john.doe", ), resource.TestCheckResourceAttr( "kestra_user.new", "email", "admin@john.doe", @@ -33,13 +32,12 @@ func TestAccUser(t *testing.T) { }, { Config: testAccResourceUser( - "admin-2", "admin2@john.doe", "[]", ), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( - "kestra_user.new", "username", "admin-2", + "kestra_user.new", "username", "admin2@john.doe", ), resource.TestCheckResourceAttr( "kestra_user.new", "email", "admin2@john.doe", @@ -58,7 +56,7 @@ func TestAccUser(t *testing.T) { }) } -func testAccResourceUser(name, email, groups string) string { +func testAccResourceUser(email, groups string) string { return fmt.Sprintf( ` resource "kestra_role" "new" { @@ -82,7 +80,7 @@ func testAccResourceUser(name, email, groups string) string { email = "%s" groups = %s }`, - name, + email, email, groups, )