Skip to content

Commit 69e024c

Browse files
fix: Make more tests idempotent
1 parent db1da25 commit 69e024c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

internal/provider/system_resource_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,9 @@ func TestAccSystemResourceAutoGeneratedSlug(t *testing.T) {
454454
}
455455

456456
func TestAccSystemResourceComplexNameSlugification(t *testing.T) {
457-
rName := acctest.RandString(8)
458-
complexName := fmt.Sprintf("test-system-%s", rName)
459-
expectedSlug := fmt.Sprintf("test-system-%s", strings.ToLower(rName))
457+
rName := acctest.RandString(5)
458+
complexName := fmt.Sprintf("Test %s With Spaces", rName)
459+
expectedSlug := fmt.Sprintf("test-%s-with-spaces", strings.ToLower(rName))
460460

461461
resource.Test(t, resource.TestCase{
462462
PreCheck: func() { ctrlacctest.PreCheck(t) },
@@ -475,7 +475,8 @@ func TestAccSystemResourceComplexNameSlugification(t *testing.T) {
475475
}
476476

477477
func TestAccSystemResourceLongSlug(t *testing.T) {
478-
longName := "This is a very long name that will generate a slug exceeding thirty characters"
478+
rName := acctest.RandString(5)
479+
longName := fmt.Sprintf("Long test %s with a very long name that will generate a slug exceeding thirty characters", rName)
479480

480481
resource.Test(t, resource.TestCase{
481482
PreCheck: func() { ctrlacctest.PreCheck(t) },
@@ -516,10 +517,11 @@ resource "ctrlplane_system" "test" {
516517

517518
func TestAccSystemResourceUpdateWithLongSlug(t *testing.T) {
518519
resourceName := "ctrlplane_system.test"
520+
rName := acctest.RandString(5)
519521
initialName := fmt.Sprintf("Initial System %s", acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum))
520522
initialSlug := fmt.Sprintf("initial-system-%s", acctest.RandStringFromCharSet(5, acctest.CharSetAlpha))
521-
updatedName := "Updated System"
522-
longSlug := "this-is-a-very-long-slug-that-exceeds-thirty-characters"
523+
updatedName := fmt.Sprintf("Updated System %s", rName)
524+
longSlug := fmt.Sprintf("very-long-slug-%s-that-exceeds-thirty-characters", rName)
523525

524526
resource.Test(t, resource.TestCase{
525527
PreCheck: func() { ctrlacctest.PreCheck(t) },

0 commit comments

Comments
 (0)