本文整理汇总了Golang中github.com/xanzy/terraform-api/helper/resource.TestCheckResourceAttr函数的典型用法代码示例。如果您正苦于以下问题:Golang TestCheckResourceAttr函数的具体用法?Golang TestCheckResourceAttr怎么用?Golang TestCheckResourceAttr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TestCheckResourceAttr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestAccAWSRoute53HealthCheck_basic
func TestAccAWSRoute53HealthCheck_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRoute53HealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccRoute53HealthCheckConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53HealthCheckExists("aws_route53_health_check.foo"),
resource.TestCheckResourceAttr(
"aws_route53_health_check.foo", "measure_latency", "true"),
resource.TestCheckResourceAttr(
"aws_route53_health_check.foo", "invert_healthcheck", "true"),
),
},
resource.TestStep{
Config: testAccRoute53HealthCheckConfigUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53HealthCheckExists("aws_route53_health_check.foo"),
resource.TestCheckResourceAttr(
"aws_route53_health_check.foo", "failure_threshold", "5"),
resource.TestCheckResourceAttr(
"aws_route53_health_check.foo", "invert_healthcheck", "false"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:29,代码来源:resource_aws_route53_health_check_test.go
示例2: 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
示例3: 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
示例4: 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
示例5: 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
示例6: TestAccAWSELB_SecurityGroups
func TestAccAWSELB_SecurityGroups(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSELBDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSELBConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"aws_elb.bar", "security_groups.#", "0",
),
),
},
resource.TestStep{
Config: testAccAWSELBConfigSecurityGroups,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"aws_elb.bar", "security_groups.#", "1",
),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_aws_elb_test.go
示例7: TestAccDynRecord_Basic
func TestAccDynRecord_Basic(t *testing.T) {
var record dynect.Record
zone := os.Getenv("DYN_ZONE")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDynRecordDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: fmt.Sprintf(testAccCheckDynRecordConfig_basic, zone),
Check: resource.ComposeTestCheckFunc(
testAccCheckDynRecordExists("dyn_record.foobar", &record),
testAccCheckDynRecordAttributes(&record),
resource.TestCheckResourceAttr(
"dyn_record.foobar", "name", "terraform"),
resource.TestCheckResourceAttr(
"dyn_record.foobar", "zone", zone),
resource.TestCheckResourceAttr(
"dyn_record.foobar", "value", "192.168.0.10"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_dyn_record_test.go
示例8: TestAccHerokuAddon_noPlan
// GH-198
func TestAccHerokuAddon_noPlan(t *testing.T) {
var addon heroku.Addon
appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckHerokuAddonDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckHerokuAddonConfig_no_plan(appName),
Check: resource.ComposeTestCheckFunc(
testAccCheckHerokuAddonExists("heroku_addon.foobar", &addon),
testAccCheckHerokuAddonAttributes(&addon, "memcachier:dev"),
resource.TestCheckResourceAttr(
"heroku_addon.foobar", "app", appName),
resource.TestCheckResourceAttr(
"heroku_addon.foobar", "plan", "memcachier"),
),
},
resource.TestStep{
Config: testAccCheckHerokuAddonConfig_no_plan(appName),
Check: resource.ComposeTestCheckFunc(
testAccCheckHerokuAddonExists("heroku_addon.foobar", &addon),
testAccCheckHerokuAddonAttributes(&addon, "memcachier:dev"),
resource.TestCheckResourceAttr(
"heroku_addon.foobar", "app", appName),
resource.TestCheckResourceAttr(
"heroku_addon.foobar", "plan", "memcachier"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:35,代码来源:resource_heroku_addon_test.go
示例9: TestAccAzureDnsServerUpdate
func TestAccAzureDnsServerUpdate(t *testing.T) {
name := "azure_dns_server.foo"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAzureDnsServerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAzureDnsServerBasic,
Check: resource.ComposeTestCheckFunc(
testAccCheckAzureDnsServerExists(name),
resource.TestCheckResourceAttr(name, "name", "terraform-dns-server"),
resource.TestCheckResourceAttr(name, "dns_address", "8.8.8.8"),
),
},
resource.TestStep{
Config: testAccAzureDnsServerUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckAzureDnsServerExists(name),
resource.TestCheckResourceAttr(name, "name", "terraform-dns-server"),
resource.TestCheckResourceAttr(name, "dns_address", "8.8.4.4"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:28,代码来源:resource_azure_dns_server_test.go
示例10: TestAccAzureHostedServiceUpdate
func TestAccAzureHostedServiceUpdate(t *testing.T) {
name := "azure_hosted_service.foo"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAzureHostedServiceDestroyed,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAzureHostedServiceBasic,
Check: resource.ComposeTestCheckFunc(
testAccCheckAzureHostedServiceExists(name),
resource.TestCheckResourceAttr(name, "name", "terraform-testing-service"),
resource.TestCheckResourceAttr(name, "location", "North Europe"),
resource.TestCheckResourceAttr(name, "ephemeral_contents", "false"),
resource.TestCheckResourceAttr(name, "description", "very discriptive"),
resource.TestCheckResourceAttr(name, "label", "very identifiable"),
),
},
resource.TestStep{
Config: testAccAzureHostedServiceUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckAzureHostedServiceExists(name),
resource.TestCheckResourceAttr(name, "name", "terraform-testing-service"),
resource.TestCheckResourceAttr(name, "location", "North Europe"),
resource.TestCheckResourceAttr(name, "ephemeral_contents", "true"),
resource.TestCheckResourceAttr(name, "description", "very discriptive"),
resource.TestCheckResourceAttr(name, "label", "very identifiable"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:34,代码来源:resource_azure_hosted_service_test.go
示例11: TestAccHerokuAddon_Basic
func TestAccHerokuAddon_Basic(t *testing.T) {
var addon heroku.Addon
appName := fmt.Sprintf("tftest-%s", acctest.RandString(10))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckHerokuAddonDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckHerokuAddonConfig_basic(appName),
Check: resource.ComposeTestCheckFunc(
testAccCheckHerokuAddonExists("heroku_addon.foobar", &addon),
testAccCheckHerokuAddonAttributes(&addon, "deployhooks:http"),
resource.TestCheckResourceAttr(
"heroku_addon.foobar", "config.0.url", "http://google.com"),
resource.TestCheckResourceAttr(
"heroku_addon.foobar", "app", appName),
resource.TestCheckResourceAttr(
"heroku_addon.foobar", "plan", "deployhooks:http"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_heroku_addon_test.go
示例12: TestAccAWSDBSecurityGroup_basic
func TestAccAWSDBSecurityGroup_basic(t *testing.T) {
var v rds.DBSecurityGroup
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSDBSecurityGroupDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSDBSecurityGroupConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSDBSecurityGroupExists("aws_db_security_group.bar", &v),
testAccCheckAWSDBSecurityGroupAttributes(&v),
resource.TestCheckResourceAttr(
"aws_db_security_group.bar", "name", "secgroup-terraform"),
resource.TestCheckResourceAttr(
"aws_db_security_group.bar", "description", "just cuz"),
resource.TestCheckResourceAttr(
"aws_db_security_group.bar", "ingress.3363517775.cidr", "10.0.0.1/24"),
resource.TestCheckResourceAttr(
"aws_db_security_group.bar", "ingress.#", "1"),
resource.TestCheckResourceAttr(
"aws_db_security_group.bar", "tags.#", "1"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:28,代码来源:resource_aws_db_security_group_test.go
示例13: TestAccVSphereVirtualMachine_custom_configs
func TestAccVSphereVirtualMachine_custom_configs(t *testing.T) {
var vm virtualMachine
var locationOpt string
var datastoreOpt string
if v := os.Getenv("VSPHERE_DATACENTER"); v != "" {
locationOpt += fmt.Sprintf(" datacenter = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_CLUSTER"); v != "" {
locationOpt += fmt.Sprintf(" cluster = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_RESOURCE_POOL"); v != "" {
locationOpt += fmt.Sprintf(" resource_pool = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_DATASTORE"); v != "" {
datastoreOpt = fmt.Sprintf(" datastore = \"%s\"\n", v)
}
template := os.Getenv("VSPHERE_TEMPLATE")
label := os.Getenv("VSPHERE_NETWORK_LABEL_DHCP")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckVSphereVirtualMachineDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: fmt.Sprintf(
testAccCheckVSphereVirtualMachineConfig_custom_configs,
locationOpt,
label,
datastoreOpt,
template,
),
Check: resource.ComposeTestCheckFunc(
testAccCheckVSphereVirtualMachineExistsHasCustomConfig("vsphere_virtual_machine.car", &vm),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "name", "terraform-test-custom"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "vcpu", "2"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "memory", "4096"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "disk.#", "1"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "disk.0.template", template),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "network_interface.#", "1"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "custom_configuration_parameters.foo", "bar"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "custom_configuration_parameters.car", "ferrari"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "custom_configuration_parameters.num", "42"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.car", "network_interface.0.label", label),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:60,代码来源:resource_vsphere_virtual_machine_test.go
示例14: TestAccCloudStackPortForward_basic
func TestAccCloudStackPortForward_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckCloudStackPortForwardDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCloudStackPortForward_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"),
resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS),
resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "forward.952396423.protocol", "tcp"),
resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "forward.952396423.private_port", "443"),
resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "forward.952396423.public_port", "8443"),
resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "forward.952396423.virtual_machine", "terraform-test"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_cloudstack_port_forward_test.go
示例15: TestAccAWSELB_HealthCheck
func TestAccAWSELB_HealthCheck(t *testing.T) {
var conf elb.LoadBalancerDescription
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSELBDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSELBConfigHealthCheck,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSELBExists("aws_elb.bar", &conf),
testAccCheckAWSELBAttributesHealthCheck(&conf),
resource.TestCheckResourceAttr(
"aws_elb.bar", "health_check.3484319807.healthy_threshold", "5"),
resource.TestCheckResourceAttr(
"aws_elb.bar", "health_check.3484319807.unhealthy_threshold", "5"),
resource.TestCheckResourceAttr(
"aws_elb.bar", "health_check.3484319807.target", "HTTP:8000/"),
resource.TestCheckResourceAttr(
"aws_elb.bar", "health_check.3484319807.timeout", "30"),
resource.TestCheckResourceAttr(
"aws_elb.bar", "health_check.3484319807.interval", "60"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:28,代码来源:resource_aws_elb_test.go
示例16: TestAccAWSCodeCommitRepository_withChanges
func TestAccAWSCodeCommitRepository_withChanges(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckCodeCommitRepositoryDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCodeCommitRepository_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckCodeCommitRepositoryExists("aws_codecommit_repository.test"),
resource.TestCheckResourceAttr(
"aws_codecommit_repository.test", "description", "This is a test description"),
),
},
resource.TestStep{
Config: testAccCodeCommitRepository_withChanges,
Check: resource.ComposeTestCheckFunc(
testAccCheckCodeCommitRepositoryExists("aws_codecommit_repository.test"),
resource.TestCheckResourceAttr(
"aws_codecommit_repository.test", "description", "This is a test description - with changes"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_aws_codecommit_repository_test.go
示例17: TestAccAWSELBUpdate_Timeout
func TestAccAWSELBUpdate_Timeout(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSELBDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSELBConfigIdleTimeout,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"aws_elb.bar", "idle_timeout", "200",
),
),
},
resource.TestStep{
Config: testAccAWSELBConfigIdleTimeout_update,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"aws_elb.bar", "idle_timeout", "400",
),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:25,代码来源:resource_aws_elb_test.go
示例18: TestAccAzureInstance_separateHostedService
func TestAccAzureInstance_separateHostedService(t *testing.T) {
var dpmt virtualmachine.DeploymentResponse
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAzureInstanceDestroyed(testAccHostedServiceName),
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAzureInstance_separateHostedService,
Check: resource.ComposeTestCheckFunc(
testAccCheckAzureInstanceExists(
"azure_instance.foo", testAccHostedServiceName, &dpmt),
testAccCheckAzureInstanceBasicAttributes(&dpmt),
resource.TestCheckResourceAttr(
"azure_instance.foo", "name", instanceName),
resource.TestCheckResourceAttr(
"azure_instance.foo", "hosted_service_name", "terraform-testing-service"),
resource.TestCheckResourceAttr(
"azure_instance.foo", "location", "West US"),
resource.TestCheckResourceAttr(
"azure_instance.foo", "endpoint.2462817782.public_port", "22"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:27,代码来源:resource_azure_instance_test.go
示例19: TestAccStatusCake_withUpdate
func TestAccStatusCake_withUpdate(t *testing.T) {
var test statuscake.Test
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccTestCheckDestroy(&test),
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccTestConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccTestCheckExists("statuscake_test.google", &test),
),
},
resource.TestStep{
Config: testAccTestConfig_update,
Check: resource.ComposeTestCheckFunc(
testAccTestCheckExists("statuscake_test.google", &test),
resource.TestCheckResourceAttr("statuscake_test.google", "check_rate", "500"),
resource.TestCheckResourceAttr("statuscake_test.google", "paused", "true"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:26,代码来源:resource_statuscaketest_test.go
示例20: TestAccAzureSecurityGroupRuleBasic
func TestAccAzureSecurityGroupRuleBasic(t *testing.T) {
name := "azure_security_group_rule.foo"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAzureSecurityGroupRuleDeleted([]string{testAccSecurityGroupName}),
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAzureSecurityGroupRuleBasicConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAzureSecurityGroupRuleExists(name, testAccSecurityGroupName),
resource.TestCheckResourceAttr(name, "name", "terraform-secgroup-rule"),
resource.TestCheckResourceAttr(name,
fmt.Sprintf("security_group_names.%d", schema.HashString(testAccSecurityGroupName)),
testAccSecurityGroupName),
resource.TestCheckResourceAttr(name, "type", "Inbound"),
resource.TestCheckResourceAttr(name, "action", "Deny"),
resource.TestCheckResourceAttr(name, "priority", "200"),
resource.TestCheckResourceAttr(name, "source_address_prefix", "100.0.0.0/32"),
resource.TestCheckResourceAttr(name, "source_port_range", "1000"),
resource.TestCheckResourceAttr(name, "destination_address_prefix", "10.0.0.0/32"),
resource.TestCheckResourceAttr(name, "destination_port_range", "1000"),
resource.TestCheckResourceAttr(name, "protocol", "TCP"),
),
},
},
})
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:29,代码来源:resource_azure_security_group_rule_test.go
注:本文中的github.com/xanzy/terraform-api/helper/resource.TestCheckResourceAttr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论