• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang resource.Test函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/xanzy/terraform-api/helper/resource.Test函数的典型用法代码示例。如果您正苦于以下问题:Golang Test函数的具体用法?Golang Test怎么用?Golang Test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Test函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestAccAWSSecurityGroup_DefaultEgress

func TestAccAWSSecurityGroup_DefaultEgress(t *testing.T) {

	// VPC
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSSecurityGroupConfigDefaultEgress,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSSecurityGroupExistsWithoutDefault("aws_security_group.worker"),
				),
			},
		},
	})

	// Classic
	var group ec2.SecurityGroup
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSSecurityGroupConfigClassic,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:33,代码来源:resource_aws_security_group_test.go


示例2: TestAccVcdSNAT_Basic

func TestAccVcdSNAT_Basic(t *testing.T) {
	if v := os.Getenv("VCD_EXTERNAL_IP"); v == "" {
		t.Skip("Environment variable VCD_EXTERNAL_IP must be set to run SNAT tests")
		return
	}

	var e govcd.EdgeGateway

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckVcdSNATDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testAccCheckVcdSnat_basic, os.Getenv("VCD_EDGE_GATWEWAY"), os.Getenv("VCD_EXTERNAL_IP")),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckVcdSNATExists("vcd_snat.bar", &e),
					resource.TestCheckResourceAttr(
						"vcd_snat.bar", "external_ip", os.Getenv("VCD_EXTERNAL_IP")),
					resource.TestCheckResourceAttr(
						"vcd_snat.bar", "internal_ip", "10.10.102.0/24"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:26,代码来源:resource_vcd_snat_test.go


示例3: TestAccAWSEcsServiceWithRenamedCluster

// Regression for https://github.com/hashicorp/terraform/issues/2427
func TestAccAWSEcsServiceWithRenamedCluster(t *testing.T) {
	originalRegexp := regexp.MustCompile(
		"^arn:aws:ecs:[^:]+:[0-9]+:cluster/terraformecstest3$")
	modifiedRegexp := regexp.MustCompile(
		"^arn:aws:ecs:[^:]+:[0-9]+:cluster/terraformecstest3modified$")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSEcsServiceDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSEcsServiceWithRenamedCluster,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost"),
					resource.TestMatchResourceAttr(
						"aws_ecs_service.ghost", "cluster", originalRegexp),
				),
			},

			resource.TestStep{
				Config: testAccAWSEcsServiceWithRenamedClusterModified,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost"),
					resource.TestMatchResourceAttr(
						"aws_ecs_service.ghost", "cluster", modifiedRegexp),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:32,代码来源:resource_aws_ecs_service_test.go


示例4: TestAccFWRuleV1_basic

func TestAccFWRuleV1_basic(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckFWRuleV1Destroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testFirewallRuleMinimalConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckFWRuleV1Exists(
						"openstack_fw_rule_v1.accept_test_minimal",
						&rules.Rule{
							Protocol:  "udp",
							Action:    "deny",
							IPVersion: 4,
							Enabled:   true,
						}),
				),
			},
			resource.TestStep{
				Config: testFirewallRuleConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckFWRuleV1Exists(
						"openstack_fw_rule_v1.accept_test",
						&rules.Rule{
							Name:                 "accept_test",
							Protocol:             "udp",
							Action:               "deny",
							Description:          "Terraform accept test",
							IPVersion:            4,
							SourceIPAddress:      "1.2.3.4",
							DestinationIPAddress: "4.3.2.0/24",
							SourcePort:           "444",
							DestinationPort:      "555",
							Enabled:              true,
						}),
				),
			},
			resource.TestStep{
				Config: testFirewallRuleUpdateAllFieldsConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckFWRuleV1Exists(
						"openstack_fw_rule_v1.accept_test",
						&rules.Rule{
							Name:                 "accept_test_updated_2",
							Protocol:             "tcp",
							Action:               "allow",
							Description:          "Terraform accept test updated",
							IPVersion:            4,
							SourceIPAddress:      "1.2.3.0/24",
							DestinationIPAddress: "4.3.2.8",
							SourcePort:           "666",
							DestinationPort:      "777",
							Enabled:              false,
						}),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:60,代码来源:resource_openstack_fw_rule_v1_test.go


示例5: TestAccHerokuApp_NukeVars

func TestAccHerokuApp_NukeVars(t *testing.T) {
	var app heroku.App
	appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckHerokuAppDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccCheckHerokuAppConfig_basic(appName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckHerokuAppExists("heroku_app.foobar", &app),
					testAccCheckHerokuAppAttributes(&app, appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "name", appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "config_vars.0.FOO", "bar"),
				),
			},
			resource.TestStep{
				Config: testAccCheckHerokuAppConfig_no_vars(appName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckHerokuAppExists("heroku_app.foobar", &app),
					testAccCheckHerokuAppAttributesNoVars(&app, appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "name", appName),
					resource.TestCheckResourceAttr(
						"heroku_app.foobar", "config_vars.0.FOO", ""),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:34,代码来源:resource_heroku_app_test.go


示例6: TestAccVcdNetwork_Basic

func TestAccVcdNetwork_Basic(t *testing.T) {
	var network govcd.OrgVDCNetwork
	generatedHrefRegexp := regexp.MustCompile("^https://")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckVcdNetworkDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testAccCheckVcdNetwork_basic, os.Getenv("VCD_EDGE_GATWEWAY")),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckVcdNetworkExists("vcd_network.foonet", &network),
					testAccCheckVcdNetworkAttributes(&network),
					resource.TestCheckResourceAttr(
						"vcd_network.foonet", "name", "foonet"),
					resource.TestCheckResourceAttr(
						"vcd_network.foonet", "static_ip_pool.#", "1"),
					resource.TestCheckResourceAttr(
						"vcd_network.foonet", "gateway", "10.10.102.1"),
					resource.TestMatchResourceAttr(
						"vcd_network.foonet", "href", generatedHrefRegexp),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:27,代码来源:resource_vcd_network_test.go


示例7: TestAccAWSEFSFileSystem

func TestAccAWSEFSFileSystem(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckEfsFileSystemDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSEFSFileSystemConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckEfsFileSystem(
						"aws_efs_file_system.foo",
					),
				),
			},
			resource.TestStep{
				Config: testAccAWSEFSFileSystemConfigWithTags,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckEfsFileSystem(
						"aws_efs_file_system.foo-with-tags",
					),
					testAccCheckEfsFileSystemTags(
						"aws_efs_file_system.foo-with-tags",
						map[string]string{
							"Name":    "foo-efs",
							"Another": "tag",
						},
					),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:32,代码来源:resource_aws_efs_file_system_test.go


示例8: TestAccAzureSqlDatabaseServerFirewallRuleAdvanced

func TestAccAzureSqlDatabaseServerFirewallRuleAdvanced(t *testing.T) {
	name1 := "azure_sql_database_server_firewall_rule.foo"
	name2 := "azure_sql_database_server_firewall_rule.bar"

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccAzureDatabaseServerFirewallRuleDeleted(testAccAzureSqlServerNames),
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAzureDatabaseServerFirewallRuleAdvancedConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccAzureSqlDatabaseServerGetNames,
					testAccAzureSqlDatabaseServersNumber(2),
					//testAccAzureDatabaseServerFirewallRuleExists(name1, testAccAzureSqlServerNames),
					resource.TestCheckResourceAttr(name1, "name", "terraform-testing-rule1"),
					resource.TestCheckResourceAttr(name1, "start_ip", "10.0.0.0"),
					resource.TestCheckResourceAttr(name1, "end_ip", "10.0.0.255"),
					//testAccAzureDatabaseServerFirewallRuleExists(name2, testAccAzureSqlServerNames),
					resource.TestCheckResourceAttr(name2, "name", "terraform-testing-rule2"),
					resource.TestCheckResourceAttr(name2, "start_ip", "200.0.0.0"),
					resource.TestCheckResourceAttr(name2, "end_ip", "200.255.255.255"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:27,代码来源:resource_azure_sql_database_server_firewall_rule_test.go


示例9: TestAccAWSElasticacheCluster_decreasingCacheNodes

func TestAccAWSElasticacheCluster_decreasingCacheNodes(t *testing.T) {
	var ec elasticache.CacheCluster

	ri := genRandInt()
	preConfig := fmt.Sprintf(testAccAWSElasticacheClusterConfigDecreasingNodes, ri, ri, ri)
	postConfig := fmt.Sprintf(testAccAWSElasticacheClusterConfigDecreasingNodes_update, ri, ri, ri)

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSElasticacheClusterDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: preConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSElasticacheSecurityGroupExists("aws_elasticache_security_group.bar"),
					testAccCheckAWSElasticacheClusterExists("aws_elasticache_cluster.bar", &ec),
					resource.TestCheckResourceAttr(
						"aws_elasticache_cluster.bar", "num_cache_nodes", "3"),
				),
			},

			resource.TestStep{
				Config: postConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSElasticacheSecurityGroupExists("aws_elasticache_security_group.bar"),
					testAccCheckAWSElasticacheClusterExists("aws_elasticache_cluster.bar", &ec),
					resource.TestCheckResourceAttr(
						"aws_elasticache_cluster.bar", "num_cache_nodes", "1"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:34,代码来源:resource_aws_elasticache_cluster_test.go


示例10: TestAccDMERecordCName

func TestAccDMERecordCName(t *testing.T) {
	var record dnsmadeeasy.Record
	domainid := os.Getenv("DME_DOMAINID")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckDMERecordDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testDMERecordConfigCName, domainid),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckDMERecordExists("dme_record.test", &record),
					resource.TestCheckResourceAttr(
						"dme_record.test", "domainid", domainid),
					resource.TestCheckResourceAttr(
						"dme_record.test", "name", "testcname"),
					resource.TestCheckResourceAttr(
						"dme_record.test", "type", "CNAME"),
					resource.TestCheckResourceAttr(
						"dme_record.test", "value", "foo"),
					resource.TestCheckResourceAttr(
						"dme_record.test", "ttl", "2000"),
					resource.TestCheckResourceAttr(
						"dme_record.test", "gtdLocation", "DEFAULT"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:30,代码来源:resource_dme_record_test.go


示例11: TestAccAWSRoute53Zone_private_region

func TestAccAWSRoute53Zone_private_region(t *testing.T) {
	var zone route53.GetHostedZoneOutput

	// record the initialized providers so that we can use them to
	// check for the instances in each region
	var providers []*schema.Provider
	providerFactories := map[string]terraform.ResourceProviderFactory{
		"aws": func() (terraform.ResourceProvider, error) {
			p := Provider()
			providers = append(providers, p.(*schema.Provider))
			return p, nil
		},
	}

	resource.Test(t, resource.TestCase{
		PreCheck:          func() { testAccPreCheck(t) },
		ProviderFactories: providerFactories,
		CheckDestroy:      testAccCheckRoute53ZoneDestroyWithProviders(&providers),
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccRoute53PrivateZoneRegionConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckRoute53ZoneExistsWithProviders("aws_route53_zone.main", &zone, &providers),
					testAccCheckRoute53ZoneAssociatesWithVpc("aws_vpc.main", &zone),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:29,代码来源:resource_aws_route53_zone_test.go


示例12: TestAccComputeFirewall_update

func TestAccComputeFirewall_update(t *testing.T) {
	var firewall compute.Firewall
	networkName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10))
	firewallName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10))

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckComputeFirewallDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccComputeFirewall_basic(networkName, firewallName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckComputeFirewallExists(
						"google_compute_firewall.foobar", &firewall),
				),
			},
			resource.TestStep{
				Config: testAccComputeFirewall_update(networkName, firewallName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckComputeFirewallExists(
						"google_compute_firewall.foobar", &firewall),
					testAccCheckComputeFirewallPorts(
						&firewall, "80-255"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:29,代码来源:resource_compute_firewall_test.go


示例13: TestAccProject_basic

func TestAccProject_basic(t *testing.T) {
	var project rundeck.Project

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccProjectCheckDestroy(&project),
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccProjectConfig_basic,
				Check: resource.ComposeTestCheckFunc(
					testAccProjectCheckExists("rundeck_project.main", &project),
					func(s *terraform.State) error {
						if expected := "terraform-acc-test-basic"; project.Name != expected {
							return fmt.Errorf("wrong name; expected %v, got %v", expected, project.Name)
						}
						if expected := "baz"; project.Config["foo.bar"] != expected {
							return fmt.Errorf("wrong foo.bar config; expected %v, got %v", expected, project.Config["foo.bar"])
						}
						if expected := "file"; project.Config["resources.source.1.type"] != expected {
							return fmt.Errorf("wrong resources.source.1.type config; expected %v, got %v", expected, project.Config["resources.source.1.type"])
						}
						return nil
					},
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:29,代码来源:resource_project_test.go


示例14: TestAccAzureRMResourceGroup_withTags

func TestAccAzureRMResourceGroup_withTags(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testCheckAzureRMResourceGroupDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAzureRMResourceGroup_withTags,
				Check: resource.ComposeTestCheckFunc(
					testCheckAzureRMResourceGroupExists("azurerm_resource_group.test"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.#", "2"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.environment", "Production"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.cost_center", "MSFT"),
				),
			},

			resource.TestStep{
				Config: testAccAzureRMResourceGroup_withTagsUpdated,
				Check: resource.ComposeTestCheckFunc(
					testCheckAzureRMResourceGroupExists("azurerm_resource_group.test"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.#", "1"),
					resource.TestCheckResourceAttr(
						"azurerm_resource_group.test", "tags.environment", "staging"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:32,代码来源:resource_arm_resource_group_test.go


示例15: TestAccDNSimpleRecord_Basic

func TestAccDNSimpleRecord_Basic(t *testing.T) {
	var record dnsimple.Record
	domain := os.Getenv("DNSIMPLE_DOMAIN")

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckDNSimpleRecordDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: fmt.Sprintf(testAccCheckDNSimpleRecordConfig_basic, domain),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckDNSimpleRecordExists("dnsimple_record.foobar", &record),
					testAccCheckDNSimpleRecordAttributes(&record),
					resource.TestCheckResourceAttr(
						"dnsimple_record.foobar", "name", "terraform"),
					resource.TestCheckResourceAttr(
						"dnsimple_record.foobar", "domain", domain),
					resource.TestCheckResourceAttr(
						"dnsimple_record.foobar", "value", "192.168.0.10"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_dnsimple_record_test.go


示例16: TestAccComputeV2Instance_volumeAttach

func TestAccComputeV2Instance_volumeAttach(t *testing.T) {
	var instance servers.Server
	var volume volumes.Volume

	var testAccComputeV2Instance_volumeAttach = fmt.Sprintf(`
		resource "openstack_blockstorage_volume_v1" "myvol" {
			name = "myvol"
			size = 1
		}

		resource "openstack_compute_instance_v2" "foo" {
			name = "terraform-test"
			security_groups = ["default"]
			volume {
				volume_id = "${openstack_blockstorage_volume_v1.myvol.id}"
			}
		}`)

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckComputeV2InstanceDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccComputeV2Instance_volumeAttach,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckBlockStorageV1VolumeExists(t, "openstack_blockstorage_volume_v1.myvol", &volume),
					testAccCheckComputeV2InstanceExists(t, "openstack_compute_instance_v2.foo", &instance),
					testAccCheckComputeV2InstanceVolumeAttachment(&instance, &volume),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:34,代码来源:resource_openstack_compute_instance_v2_test.go


示例17: TestAccAWSLambdaEventSourceMapping_basic

func TestAccAWSLambdaEventSourceMapping_basic(t *testing.T) {
	var conf lambda.EventSourceMappingConfiguration

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckLambdaEventSourceMappingDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSLambdaEventSourceMappingConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAwsLambdaEventSourceMappingExists("aws_lambda_event_source_mapping.lambda_event_source_mapping_test", &conf),
					testAccCheckAWSLambdaEventSourceMappingAttributes(&conf),
				),
			},
			resource.TestStep{
				Config: testAccAWSLambdaEventSourceMappingConfigUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAwsLambdaEventSourceMappingExists("aws_lambda_event_source_mapping.lambda_event_source_mapping_test", &conf),
					resource.TestCheckResourceAttr("aws_lambda_event_source_mapping.lambda_event_source_mapping_test",
						"batch_size",
						strconv.Itoa(200)),
					resource.TestCheckResourceAttr("aws_lambda_event_source_mapping.lambda_event_source_mapping_test",
						"enabled",
						strconv.FormatBool(false)),
					resource.TestMatchResourceAttr(
						"aws_lambda_event_source_mapping.lambda_event_source_mapping_test",
						"function_arn",
						regexp.MustCompile("example_lambda_name_update$"),
					),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:35,代码来源:resource_aws_lambda_event_source_mapping_test.go


示例18: TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup

func TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup(t *testing.T) {
	var v redshift.ClusterSecurityGroup

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgId,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "name", "redshift-sg-terraform"),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "description", "this is a description"),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "ingress.#", "1"),
					resource.TestCheckResourceAttr(
						"aws_redshift_security_group.bar", "ingress.220863.security_group_name", "terraform_redshift_acceptance_test"),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_aws_redshift_security_group_test.go


示例19: TestAccComputeV2FloatingIP_attach

func TestAccComputeV2FloatingIP_attach(t *testing.T) {
	var instance servers.Server
	var fip floatingip.FloatingIP
	var testAccComputeV2FloatingIP_attach = fmt.Sprintf(`
    resource "openstack_compute_floatingip_v2" "myip" {
    }

    resource "openstack_compute_instance_v2" "foo" {
      name = "terraform-test"
      security_groups = ["default"]
      floating_ip = "${openstack_compute_floatingip_v2.myip.address}"

      network {
        uuid = "%s"
      }
    }`,
		os.Getenv("OS_NETWORK_ID"))

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckComputeV2FloatingIPDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccComputeV2FloatingIP_attach,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckComputeV2FloatingIPExists(t, "openstack_compute_floatingip_v2.myip", &fip),
					testAccCheckComputeV2InstanceExists(t, "openstack_compute_instance_v2.foo", &instance),
					testAccCheckComputeV2InstanceFloatingIPAttach(&instance, &fip),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:34,代码来源:resource_openstack_compute_floatingip_v2_test.go


示例20: TestAccAWSVpnConnection_basic

func TestAccAWSVpnConnection_basic(t *testing.T) {
	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccAwsVpnConnectionDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccAwsVpnConnectionConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccAwsVpnConnection(
						"aws_vpc.vpc",
						"aws_vpn_gateway.vpn_gateway",
						"aws_customer_gateway.customer_gateway",
						"aws_vpn_connection.foo",
					),
				),
			},
			resource.TestStep{
				Config: testAccAwsVpnConnectionConfigUpdate,
				Check: resource.ComposeTestCheckFunc(
					testAccAwsVpnConnection(
						"aws_vpc.vpc",
						"aws_vpn_gateway.vpn_gateway",
						"aws_customer_gateway.customer_gateway",
						"aws_vpn_connection.foo",
					),
				),
			},
		},
	})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:31,代码来源:resource_aws_vpn_connection_test.go



注:本文中的github.com/xanzy/terraform-api/helper/resource.Test函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang resource.TestCheckResourceAttr函数代码示例发布时间:2022-05-28
下一篇:
Golang resource.Retry函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap