-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Support Managed Load Balancer as Resources
- Loading branch information
1 parent
180021d
commit f06c1fc
Showing
77 changed files
with
8,365 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1CertificateImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "certificates", "/v1.0/certificates", testMockMLBV1CertificatesCreate) | ||
mc.Register(t, "certificates", "/v1.0/certificates/497f6eca-6276-4993-bfeb-53cbbbba6f08/files", testMockMLBV1CertificatesUploadFileCaCert) | ||
mc.Register(t, "certificates", "/v1.0/certificates/497f6eca-6276-4993-bfeb-53cbbbba6f08/files", testMockMLBV1CertificatesUploadFileSslCert) | ||
mc.Register(t, "certificates", "/v1.0/certificates/497f6eca-6276-4993-bfeb-53cbbbba6f08/files", testMockMLBV1CertificatesUploadFileSslKey) | ||
mc.Register(t, "certificates", "/v1.0/certificates/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1CertificatesShowAfterCreate) | ||
mc.Register(t, "certificates", "/v1.0/certificates/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1CertificatesDelete) | ||
mc.Register(t, "certificates", "/v1.0/certificates/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1CertificatesShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1Certificate, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_certificate_v1.certificate", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"ca_cert", "ssl_cert", "ssl_key"}, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1HealthMonitorImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "health_monitors", "/v1.0/health_monitors", testMockMLBV1HealthMonitorsCreate) | ||
mc.Register(t, "health_monitors", "/v1.0/health_monitors/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1HealthMonitorsShowAfterCreate) | ||
mc.Register(t, "health_monitors", "/v1.0/health_monitors/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1HealthMonitorsDelete) | ||
mc.Register(t, "health_monitors", "/v1.0/health_monitors/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1HealthMonitorsShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1HealthMonitor, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_health_monitor_v1.health_monitor", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1ListenerImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "listeners", "/v1.0/listeners", testMockMLBV1ListenersCreate) | ||
mc.Register(t, "listeners", "/v1.0/listeners/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1ListenersShowAfterCreate) | ||
mc.Register(t, "listeners", "/v1.0/listeners/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1ListenersDelete) | ||
mc.Register(t, "listeners", "/v1.0/listeners/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1ListenersShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1Listener, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_listener_v1.listener", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1LoadBalancerImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "load_balancers", "/v1.0/load_balancers", testMockMLBV1LoadBalancersCreate) | ||
mc.Register(t, "load_balancers", "/v1.0/load_balancers/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1LoadBalancersShowAfterCreate) | ||
mc.Register(t, "load_balancers", "/v1.0/load_balancers/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1LoadBalancersDelete) | ||
mc.Register(t, "load_balancers", "/v1.0/load_balancers/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1LoadBalancersShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1LoadBalancer, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_load_balancer_v1.load_balancer", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1PolicyImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "policies", "/v1.0/policies", testMockMLBV1PoliciesCreate) | ||
mc.Register(t, "policies", "/v1.0/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1PoliciesShowAfterCreate) | ||
mc.Register(t, "policies", "/v1.0/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1PoliciesDelete) | ||
mc.Register(t, "policies", "/v1.0/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1PoliciesShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1Policy, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_policy_v1.policy", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1RouteImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "routes", "/v1.0/routes", testMockMLBV1RoutesCreate) | ||
mc.Register(t, "routes", "/v1.0/routes/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1RoutesShowAfterCreate) | ||
mc.Register(t, "routes", "/v1.0/routes/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1RoutesDelete) | ||
mc.Register(t, "routes", "/v1.0/routes/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1RoutesShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1Route, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_route_v1.route", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1RuleImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "rules", "/v1.0/rules", testMockMLBV1RulesCreate) | ||
mc.Register(t, "rules", "/v1.0/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1RulesShowAfterCreate) | ||
mc.Register(t, "rules", "/v1.0/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1RulesDelete) | ||
mc.Register(t, "rules", "/v1.0/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1RulesShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1Rule, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_rule_v1.rule", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ecl | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
|
||
"github.com/nttcom/terraform-provider-ecl/ecl/testhelper/mock" | ||
) | ||
|
||
func TestMockedAccMLBV1TargetGroupImport(t *testing.T) { | ||
mc := mock.NewMockController() | ||
defer mc.TerminateMockControllerSafety() | ||
|
||
postKeystone := fmt.Sprintf(fakeKeystonePostTmpl, mc.Endpoint(), OS_REGION_NAME) | ||
|
||
mc.Register(t, "keystone", "/v3/auth/tokens", postKeystone) | ||
mc.Register(t, "target_groups", "/v1.0/target_groups", testMockMLBV1TargetGroupsCreate) | ||
mc.Register(t, "target_groups", "/v1.0/target_groups/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1TargetGroupsShowAfterCreate) | ||
mc.Register(t, "target_groups", "/v1.0/target_groups/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1TargetGroupsDelete) | ||
mc.Register(t, "target_groups", "/v1.0/target_groups/497f6eca-6276-4993-bfeb-53cbbbba6f08", testMockMLBV1TargetGroupsShowAfterDelete) | ||
|
||
mc.StartServer(t) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMLBV1TargetGroup, | ||
}, | ||
{ | ||
ResourceName: "ecl_mlb_target_group_v1.target_group", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.