@@ -36,34 +36,62 @@ func TestAccRepositoryRetentionRule_basic(t *testing.T) {
3636 resource .TestCheckResourceAttr ("cloudsmith_repository_retention_rule.test" , "retention_package_query_string" , "name:test" ),
3737 ),
3838 },
39+ {
40+ Config : testAccRepositoryRetentionRuleConfigZero ,
41+ Check : resource .ComposeTestCheckFunc (
42+ testAccRepositoryCheckExists ("cloudsmith_repository.test-retention" ),
43+ resource .TestCheckResourceAttr ("cloudsmith_repository_retention_rule.test" , "retention_count_limit" , "0" ),
44+ resource .TestCheckResourceAttr ("cloudsmith_repository_retention_rule.test" , "retention_days_limit" , "0" ),
45+ ),
46+ },
3947 },
4048 CheckDestroy : testAccRepositoryCheckDestroy ("cloudsmith_repository.test-retention" ),
4149 })
4250}
4351
4452var testAccRepositoryConfig = fmt .Sprintf (`
4553resource "cloudsmith_repository" "test-retention" {
46- name = "terraform-acc-repo-retention-rule"
47- namespace = "%s"
54+ name = "terraform-acc-repo-retention-rule"
55+ namespace = "%s"
4856}
4957` , os .Getenv ("CLOUDSMITH_NAMESPACE" ))
5058
5159var testAccRepositoryRetentionRuleConfigBasic = fmt .Sprintf (`
5260resource "cloudsmith_repository" "test-retention" {
53- name = "terraform-acc-repo-retention-rule"
54- namespace = "%s"
61+ name = "terraform-acc-repo-retention-rule"
62+ namespace = "%s"
63+ }
64+
65+ resource "cloudsmith_repository_retention_rule" "test" {
66+ namespace = "%s"
67+ repository = cloudsmith_repository.test-retention.name
68+ retention_enabled = false
69+ retention_count_limit = 100
70+ retention_days_limit = 28
71+ retention_group_by_name = false
72+ retention_group_by_format = false
73+ retention_group_by_package_type = false
74+ retention_size_limit = 0
75+ retention_package_query_string = "name:test"
76+ }
77+ ` , os .Getenv ("CLOUDSMITH_NAMESPACE" ), os .Getenv ("CLOUDSMITH_NAMESPACE" ))
78+
79+ var testAccRepositoryRetentionRuleConfigZero = fmt .Sprintf (`
80+ resource "cloudsmith_repository" "test-retention" {
81+ name = "terraform-acc-repo-retention-rule"
82+ namespace = "%s"
5583}
5684
5785resource "cloudsmith_repository_retention_rule" "test" {
58- namespace = "%s"
59- repository = cloudsmith_repository.test-retention.name
60- retention_enabled = false
61- retention_count_limit = 100
62- retention_days_limit = 28
63- retention_group_by_name = false
64- retention_group_by_format = false
65- retention_group_by_package_type = false
66- retention_size_limit = 0
67- retention_package_query_string = "name:test"
86+ namespace = "%s"
87+ repository = cloudsmith_repository.test-retention.name
88+ retention_enabled = false
89+ retention_count_limit = 0
90+ retention_days_limit = 0
91+ retention_group_by_name = false
92+ retention_group_by_format = false
93+ retention_group_by_package_type = false
94+ retention_size_limit = 0
95+ retention_package_query_string = "name:test"
6896}
6997` , os .Getenv ("CLOUDSMITH_NAMESPACE" ), os .Getenv ("CLOUDSMITH_NAMESPACE" ))
0 commit comments