Skip to content

Commit

Permalink
fix(): tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Skraye committed Dec 4, 2024
1 parent 8732617 commit 90d7476
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions internal/provider/resource_binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -22,15 +22,15 @@ 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",
),
),
},
{
Config: testAccResourceBinding("USER", "john", "admin2", "", "new"),
Config: testAccResourceBinding("USER", "john", "launcher_default", "", "new"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"kestra_binding.new", "type", "USER",
Expand All @@ -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",
),
),
},
Expand Down
3 changes: 2 additions & 1 deletion internal/provider/resource_user_password_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ func testAccResourceUserPassword(password string) string {
return fmt.Sprintf(
`
resource "kestra_user" "new" {
username = "my-new-user"
username = "[email protected]"
email = "[email protected]"
}
resource "kestra_user_password" "new" {
Expand Down
10 changes: 4 additions & 6 deletions internal/provider/resource_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ func TestAccUser(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccResourceUser(
"admin",
"[email protected]",
"[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", "[email protected]",
Expand All @@ -33,13 +32,12 @@ func TestAccUser(t *testing.T) {
},
{
Config: testAccResourceUser(
"admin-2",
"[email protected]",
"[]",
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"kestra_user.new", "username", "admin-2",
"kestra_user.new", "username", "[email protected]",
),
resource.TestCheckResourceAttr(
"kestra_user.new", "email", "[email protected]",
Expand All @@ -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" {
Expand All @@ -82,7 +80,7 @@ func testAccResourceUser(name, email, groups string) string {
email = "%s"
groups = %s
}`,
name,
email,
email,
groups,
)
Expand Down

0 comments on commit 90d7476

Please sign in to comment.