github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/builtin/providers/docker/resource_docker_image_test.go (about)

     1  package docker
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/resource"
     7  )
     8  
     9  func TestAccDockerImage_basic(t *testing.T) {
    10  	resource.Test(t, resource.TestCase{
    11  		PreCheck:  func() { testAccPreCheck(t) },
    12  		Providers: testAccProviders,
    13  		Steps: []resource.TestStep{
    14  			resource.TestStep{
    15  				Config: testAccDockerImageConfig,
    16  				Check: resource.ComposeTestCheckFunc(
    17  					resource.TestCheckResourceAttr(
    18  						"docker_image.foo",
    19  						"latest",
    20  						"8dd8107abd2e22bfd3b45b05733f3d2677d4078b09b5edce56ee3d8677d3c648"),
    21  				),
    22  			},
    23  		},
    24  	})
    25  }
    26  
    27  func TestAddDockerImage_private(t *testing.T) {
    28  	resource.Test(t, resource.TestCase{
    29  		PreCheck:  func() { testAccPreCheck(t) },
    30  		Providers: testAccProviders,
    31  		Steps: []resource.TestStep{
    32  			resource.TestStep{
    33  				Config: testAddDockerPrivateImageConfig,
    34  				Check: resource.ComposeTestCheckFunc(
    35  					resource.TestCheckResourceAttr(
    36  						"docker_image.foobar",
    37  						"latest",
    38  						"2c40b0526b6358710fd09e7b8c022429268cc61703b4777e528ac9d469a07ca1"),
    39  				),
    40  			},
    41  		},
    42  	})
    43  }
    44  
    45  const testAccDockerImageConfig = `
    46  resource "docker_image" "foo" {
    47  	name = "alpine:3.1"
    48  	keep_updated = false
    49  }
    50  `
    51  
    52  const testAddDockerPrivateImageConfig = `
    53  resource "docker_image" "foobar" {
    54  	name = "gcr.io:443/google_containers/pause:0.8.0"
    55  	keep_updated = true
    56  }
    57  `