Skip to content

Commit

Permalink
Add test for FAILED release
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanstipl committed Dec 14, 2018
1 parent 63bdeb6 commit 29788c8
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions helm/resource_release_test.go
Expand Up @@ -240,6 +240,41 @@ func TestAccResourceRelease_updateAfterFail(t *testing.T) {
})
}

func TestAccResourceRelease_updateExistingFailed(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
CheckDestroy: testAccCheckHelmReleaseDestroy,
Steps: []resource.TestStep{{
Config: testAccHelmReleaseConfigValues(
testResourceName, testNamespace, testResourceName, "stable/mariadb",
[]string{"master:\n persistence:\n enabled: false", "replication:\n enabled: false"},
),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("helm_release.test", "metadata.0.revision", "1"),
resource.TestCheckResourceAttr("helm_release.test", "status", "DEPLOYED"),
),
}, {
Config: testAccHelmReleaseConfigValues(
testResourceName, testNamespace, testResourceName, "stable/mariadb",
[]string{"master:\n persistence:\n enabled: true", "replication:\n enabled: false"},
),
ExpectError: regexp.MustCompile("forbidden"),
ExpectNonEmptyPlan: true,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("helm_release.test", "metadata.0.revision", "2"),
resource.TestCheckResourceAttr("helm_release.test", "status", "FAILED"),
),
}, {
Config: testAccHelmReleaseConfigValues(
testResourceName, testNamespace, testResourceName, "stable/mariadb",
[]string{"master:\n persistence:\n enabled: true", "replication:\n enabled: false"},
),
ExpectError: regexp.MustCompile("forbidden"),
ExpectNonEmptyPlan: true,
}},
})
}

func TestAccResourceRelease_updateVersionFromRelease(t *testing.T) {
dir, err := ioutil.TempDir("", "")
if err != nil {
Expand Down

0 comments on commit 29788c8

Please sign in to comment.