github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/aws/resource_aws_elastic_beanstalk_environment_migrate_test.go (about)

     1  package aws
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/terraform"
     7  )
     8  
     9  func TestAWSElasticBeanstalkEnvironmentMigrateState(t *testing.T) {
    10  	cases := map[string]struct {
    11  		StateVersion int
    12  		Attributes   map[string]string
    13  		Expected     map[string]string
    14  		Meta         interface{}
    15  	}{
    16  		"v0_1_web": {
    17  			StateVersion: 0,
    18  			Attributes: map[string]string{
    19  				"tier": "",
    20  			},
    21  			Expected: map[string]string{
    22  				"tier": "WebServer",
    23  			},
    24  		},
    25  		"v0_1_web_explicit": {
    26  			StateVersion: 0,
    27  			Attributes: map[string]string{
    28  				"tier": "WebServer",
    29  			},
    30  			Expected: map[string]string{
    31  				"tier": "WebServer",
    32  			},
    33  		},
    34  		"v0_1_worker": {
    35  			StateVersion: 0,
    36  			Attributes: map[string]string{
    37  				"tier": "Worker",
    38  			},
    39  			Expected: map[string]string{
    40  				"tier": "Worker",
    41  			},
    42  		},
    43  	}
    44  
    45  	for tn, tc := range cases {
    46  		is := &terraform.InstanceState{
    47  			ID:         "e-abcde12345",
    48  			Attributes: tc.Attributes,
    49  		}
    50  		is, err := resourceAwsElasticBeanstalkEnvironmentMigrateState(
    51  			tc.StateVersion, is, tc.Meta)
    52  
    53  		if err != nil {
    54  			t.Fatalf("bad: %s, err: %#v", tn, err)
    55  		}
    56  	}
    57  }