Skip to content

Commit

Permalink
fix: wrong default value for revision_history_limit in argocd_applica…
Browse files Browse the repository at this point in the history
…tion resource (#161)
  • Loading branch information
MrLuje authored Apr 12, 2022
1 parent 47ce970 commit 4711587
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions argocd/resource_argocd_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

func TestAccArgoCDApplication(t *testing.T) {
commonName := acctest.RandomWithPrefix("test-acc")
revisionHistoryLimit := acctest.RandIntRange(0, 9)
helmValues := `
ingress:
enabled: true
Expand Down Expand Up @@ -52,6 +53,11 @@ ingress:
"spec.0.source.0.target_revision",
"15.3.0",
),
resource.TestCheckResourceAttr(
"argocd_application.simple",
"spec.0.revision_history_limit",
"10",
),
),
},
{
Expand Down Expand Up @@ -213,6 +219,20 @@ ingress:
),
),
},
{
Config: testAccArgoCDApplicationSimpleRevisionHistory(commonName, revisionHistoryLimit),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(
"argocd_application.simple",
"metadata.0.uid",
),
resource.TestCheckResourceAttr(
"argocd_application.simple",
"spec.0.revision_history_limit",
fmt.Sprint(revisionHistoryLimit),
),
),
},
},
})
}
Expand Down Expand Up @@ -778,6 +798,48 @@ resource "argocd_application" "simple" {
`, name)
}

func testAccArgoCDApplicationSimpleRevisionHistory(name string, revision_history_limit int) string {
return fmt.Sprintf(`
resource "argocd_application" "simple" {
metadata {
name = "%s"
namespace = "argocd"
labels = {
acceptance = "true"
}
annotations = {
"this.is.a.really.long.nested.key" = "yes, really!"
}
}
spec {
revision_history_limit = %d
source {
repo_url = "https://charts.bitnami.com/bitnami"
chart = "redis"
target_revision = "15.3.0"
helm {
parameter {
name = "image.tag"
value = "6.2.5"
}
parameter {
name = "architecture"
value = "standalone"
}
release_name = "testing"
}
}
destination {
server = "https://kubernetes.default.svc"
namespace = "default"
}
}
}
`, name, revision_history_limit)
}

func testAccSkipFeatureIgnoreDiffJQPathExpressions() (bool, error) {
p, _ := testAccProviders["argocd"]()
_ = p.Configure(context.Background(), &terraform.ResourceConfig{})
Expand Down
1 change: 1 addition & 0 deletions argocd/schema_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ func applicationSpecSchema() *schema.Schema {
"revision_history_limit": {
Type: schema.TypeInt,
Optional: true,
Default: 10,
},
},
},
Expand Down

0 comments on commit 4711587

Please sign in to comment.