From 0d9cbe369de7c921b6f2f6972531ce2c9dc6eb56 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Fri, 13 Dec 2019 10:43:51 -0800 Subject: [PATCH] Removes redundant test --- aws/resource_aws_ecs_cluster_test.go | 69 ---------------------------- 1 file changed, 69 deletions(-) diff --git a/aws/resource_aws_ecs_cluster_test.go b/aws/resource_aws_ecs_cluster_test.go index 04a2d63ad28..17c3f6411d6 100644 --- a/aws/resource_aws_ecs_cluster_test.go +++ b/aws/resource_aws_ecs_cluster_test.go @@ -189,11 +189,6 @@ func TestAccAWSEcsCluster_CapacityProviders(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_ecs_cluster.test" - providerNames := []string{ - "FARGATE", - "FARGATE_SPOT", - } - resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -203,7 +198,6 @@ func TestAccAWSEcsCluster_CapacityProviders(t *testing.T) { Config: testAccAWSEcsClusterCapacityProviders(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsClusterExists(resourceName, &cluster), - testAccCheckAWSEcsClusterCapacityProviders(&cluster, providerNames), ), }, { @@ -351,69 +345,6 @@ func testAccCheckAWSEcsClusterExists(resourceName string, cluster *ecs.Cluster) } } -func testAccCheckAWSEcsClusterCapacityProviders(cluster *ecs.Cluster, expectedProviderNames []string) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).ecsconn - - input := &ecs.DescribeClustersInput{ - Clusters: []*string{cluster.ClusterArn}, - } - - resp, err := conn.DescribeClusters(input) - if err != nil { - return fmt.Errorf("error describing ECS Cluster: %s", err) - } - - var actual *ecs.Cluster - for _, c := range resp.Clusters { - if aws.StringValue(c.ClusterArn) == *cluster.ClusterArn { - actual = c - break - } - - } - if actual == nil { - return fmt.Errorf("ECS Cluster has disappeared") - } - - var match bool - if length := len(expectedProviderNames); len(actual.CapacityProviders) == length { - match = true - - visited := make([]bool, length) - for i := 0; i < length; i++ { - found := false - element := *actual.CapacityProviders[i] - for j := 0; j < length; j++ { - if visited[j] { - continue - } - if element == expectedProviderNames[j] { - visited[j] = true - found = true - break - } - } - match = match && found - if !match { - break - } - } - } else { - match = false - } - if !match { - actualProviderNames := make([]string, len(actual.CapacityProviders)) - for i, v := range actual.CapacityProviders { - actualProviderNames[i] = *v - } - return fmt.Errorf("error matching CapacityProviders:\n\texpected %v\n\tgot: %v", expectedProviderNames, actualProviderNames) - } - - return nil - } -} - func testAccCheckAWSEcsClusterDisappears(cluster *ecs.Cluster) resource.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ecsconn