41 lines
878 B
Go
41 lines
878 B
Go
package azurerm
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
func TestAzureRMContainerRegistryMigrateState(t *testing.T) {
|
|
cases := map[string]struct {
|
|
StateVersion int
|
|
ID string
|
|
Attributes map[string]string
|
|
Expected string
|
|
Meta interface{}
|
|
}{
|
|
"v0_1_without_value": {
|
|
StateVersion: 0,
|
|
ID: "some_id",
|
|
Attributes: map[string]string{},
|
|
Expected: "Basic",
|
|
},
|
|
}
|
|
|
|
for tn, tc := range cases {
|
|
is := &terraform.InstanceState{
|
|
ID: tc.ID,
|
|
Attributes: tc.Attributes,
|
|
}
|
|
is, err := resourceAzureRMContainerRegistryMigrateState(tc.StateVersion, is, tc.Meta)
|
|
|
|
if err != nil {
|
|
t.Fatalf("bad: %s, err: %#v", tn, err)
|
|
}
|
|
|
|
if is.Attributes["sku"] != tc.Expected {
|
|
t.Fatalf("bad Container Registry Migrate: %s\n\n expected: %s", is.Attributes["sku"], tc.Expected)
|
|
}
|
|
}
|
|
}
|