Skip to content

Commit

Permalink
Test that optional attributes not set
Browse files Browse the repository at this point in the history
  • Loading branch information
denys-octopus committed Oct 23, 2024
1 parent 171b88b commit bdca84b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion octopusdeploy_framework/resource_s3_feed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestAccOctopusDeployS3Feed(t *testing.T) {
},
{
Config: testS3FeedWithoutKeys(withoutKeysData, localName),
Check: testAssertS3FeedAttributes(withoutKeysData, prefix),
Check: testAssertS3FeedWithoutKeysAttributes(withoutKeysData, prefix),
},
},
})
Expand Down Expand Up @@ -97,6 +97,15 @@ func testS3FeedWithoutKeys(data s3FeedTestData, localName string) string {
)
}

func testAssertS3FeedWithoutKeysAttributes(expected s3FeedTestData, prefix string) resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(prefix, "name", expected.name),
resource.TestCheckResourceAttr(prefix, "use_machine_credentials", strconv.FormatBool(expected.useMachineCredentials)),
resource.TestCheckNoResourceAttr(prefix, "access_key"),
resource.TestCheckNoResourceAttr(prefix, "secret_key"),
)
}

func testS3FeedCheckDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
if rs.Type != "octopusdeploy_s3_feed" {
Expand Down

0 comments on commit bdca84b

Please sign in to comment.