From f7d4aca96573bc7e3fd937f7b16c098e4fc9f9ef Mon Sep 17 00:00:00 2001 From: Raphael Randschau Date: Sun, 6 Mar 2016 16:22:11 +0100 Subject: [PATCH] Fix docker test assertions regarding latest tag --- builtin/providers/docker/resource_docker_image_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/providers/docker/resource_docker_image_test.go b/builtin/providers/docker/resource_docker_image_test.go index 81c508742..67c5317c2 100644 --- a/builtin/providers/docker/resource_docker_image_test.go +++ b/builtin/providers/docker/resource_docker_image_test.go @@ -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), ), }, },