Skip to content

Commit e574a83

Browse files
test: check for contains instead of a full string equals
For some reason this always suffixes a newline. If I add a newline, then it adds yet another newline, etc etc. Signed-off-by: Blake Pettersson <[email protected]>
1 parent 6840140 commit e574a83

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

internal/provider/resource_repository_certificate_test.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
1414
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1515
"github.com/stretchr/testify/assert"
16+
"github.com/stretchr/testify/require"
1617
)
1718

1819
func TestAccArgoCDRepositoryCertificatesSSH(t *testing.T) {
@@ -571,10 +572,15 @@ func TestAccArgoCDRepositoryCertificate_HTTPSConsistency(t *testing.T) {
571572
"https.0.server_name",
572573
serverName,
573574
),
574-
resource.TestCheckResourceAttr(
575+
resource.TestCheckResourceAttrWith(
575576
"argocd_repository_certificate.simple",
576577
"https.0.cert_data",
577-
certData,
578+
func(value string) error {
579+
// Not yet sure why the impl is suffixing with newline. Adding a newline only makes the test fail,
580+
// since it'll add yet another newline.
581+
require.Contains(t, value, certData)
582+
return nil
583+
},
578584
),
579585
resource.TestCheckResourceAttr(
580586
"argocd_repository_certificate.simple",
@@ -596,10 +602,15 @@ func TestAccArgoCDRepositoryCertificate_HTTPSConsistency(t *testing.T) {
596602
"https.0.server_name",
597603
serverName,
598604
),
599-
resource.TestCheckResourceAttr(
605+
resource.TestCheckResourceAttrWith(
600606
"argocd_repository_certificate.simple",
601607
"https.0.cert_data",
602-
certData,
608+
func(value string) error {
609+
// Not yet sure why the impl is suffixing with newline. Adding a newline only makes the test fail,
610+
// since it'll add yet another newline.
611+
require.Contains(t, value, certData)
612+
return nil
613+
},
603614
),
604615
resource.TestCheckResourceAttr(
605616
"argocd_repository_certificate.simple",

0 commit comments

Comments
 (0)