Merge pull request #5476 from nicolai86/feature/docker-tag-handling

provider/docker fix image test assertions
This commit is contained in:
Paul Stack 2016-03-07 18:52:03 +01:00
commit 122e9ac42a
1 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
)
var contentDigestRegexp = regexp.MustCompile(`\A[A-Za-z0-9_\+\.-]+:[A-Fa-f0-9]+\z`)
func TestAccDockerImage_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -15,7 +17,7 @@ func TestAccDockerImage_basic(t *testing.T) {
resource.TestStep{
Config: testAccDockerImageConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestMatchResourceAttr("docker_image.foo", "latest", regexp.MustCompile(`\A[a-f0-9]{64}\z`)),
resource.TestMatchResourceAttr("docker_image.foo", "latest", contentDigestRegexp),
),
},
},
@ -30,7 +32,7 @@ func TestAccDockerImage_private(t *testing.T) {
resource.TestStep{
Config: testAddDockerPrivateImageConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestMatchResourceAttr("docker_image.foobar", "latest", regexp.MustCompile(`\A[a-f0-9]{64}\z`)),
resource.TestMatchResourceAttr("docker_image.foobar", "latest", contentDigestRegexp),
),
},
},