How to use Check method of main Package

Best Syzkaller code snippet using main.Check

resource_aws_route53_record_test.go

Source:resource_aws_route53_record_test.go Github

copy

Full Screen

...70 }71}72func TestAccAWSRoute53Record_basic(t *testing.T) {73 resource.Test(t, resource.TestCase{74 PreCheck: func() { testAccPreCheck(t) },75 IDRefreshName: "aws_route53_record.default",76 Providers: testAccProviders,77 CheckDestroy: testAccCheckRoute53RecordDestroy,78 Steps: []resource.TestStep{79 resource.TestStep{80 Config: testAccRoute53RecordConfig,81 Check: resource.ComposeTestCheckFunc(82 testAccCheckRoute53RecordExists("aws_route53_record.default"),83 ),84 },85 },86 })87}88func TestAccAWSRoute53Record_basic_fqdn(t *testing.T) {89 resource.Test(t, resource.TestCase{90 PreCheck: func() { testAccPreCheck(t) },91 IDRefreshName: "aws_route53_record.default",92 Providers: testAccProviders,93 CheckDestroy: testAccCheckRoute53RecordDestroy,94 Steps: []resource.TestStep{95 resource.TestStep{96 Config: testAccRoute53RecordConfig_fqdn,97 Check: resource.ComposeTestCheckFunc(98 testAccCheckRoute53RecordExists("aws_route53_record.default"),99 ),100 },101 // Ensure that changing the name to include a trailing "dot" results in102 // nothing happening, because the name is stripped of trailing dots on103 // save. Otherwise, an update would occur and due to the104 // create_before_destroy, the record would actually be destroyed, and a105 // non-empty plan would appear, and the record will fail to exist in106 // testAccCheckRoute53RecordExists107 resource.TestStep{108 Config: testAccRoute53RecordConfig_fqdn_no_op,109 Check: resource.ComposeTestCheckFunc(110 testAccCheckRoute53RecordExists("aws_route53_record.default"),111 ),112 },113 },114 })115}116func TestAccAWSRoute53Record_txtSupport(t *testing.T) {117 resource.Test(t, resource.TestCase{118 PreCheck: func() { testAccPreCheck(t) },119 IDRefreshName: "aws_route53_record.default",120 IDRefreshIgnore: []string{"zone_id"}, // just for this test121 Providers: testAccProviders,122 CheckDestroy: testAccCheckRoute53RecordDestroy,123 Steps: []resource.TestStep{124 resource.TestStep{125 Config: testAccRoute53RecordConfigTXT,126 Check: resource.ComposeTestCheckFunc(127 testAccCheckRoute53RecordExists("aws_route53_record.default"),128 ),129 },130 },131 })132}133func TestAccAWSRoute53Record_spfSupport(t *testing.T) {134 resource.Test(t, resource.TestCase{135 PreCheck: func() { testAccPreCheck(t) },136 IDRefreshName: "aws_route53_record.default",137 Providers: testAccProviders,138 CheckDestroy: testAccCheckRoute53RecordDestroy,139 Steps: []resource.TestStep{140 resource.TestStep{141 Config: testAccRoute53RecordConfigSPF,142 Check: resource.ComposeTestCheckFunc(143 testAccCheckRoute53RecordExists("aws_route53_record.default"),144 resource.TestCheckResourceAttr(145 "aws_route53_record.default", "records.2930149397", "include:notexample.com"),146 ),147 },148 },149 })150}151func TestAccAWSRoute53Record_caaSupport(t *testing.T) {152 resource.Test(t, resource.TestCase{153 PreCheck: func() { testAccPreCheck(t) },154 IDRefreshName: "aws_route53_record.default",155 Providers: testAccProviders,156 CheckDestroy: testAccCheckRoute53RecordDestroy,157 Steps: []resource.TestStep{158 resource.TestStep{159 Config: testAccRoute53RecordConfigCAA,160 Check: resource.ComposeTestCheckFunc(161 testAccCheckRoute53RecordExists("aws_route53_record.default"),162 resource.TestCheckResourceAttr(163 "aws_route53_record.default", "records.2965463512", "0 issue \"exampleca.com;\""),164 ),165 },166 },167 })168}169func TestAccAWSRoute53Record_generatesSuffix(t *testing.T) {170 resource.Test(t, resource.TestCase{171 PreCheck: func() { testAccPreCheck(t) },172 IDRefreshName: "aws_route53_record.default",173 Providers: testAccProviders,174 CheckDestroy: testAccCheckRoute53RecordDestroy,175 Steps: []resource.TestStep{176 resource.TestStep{177 Config: testAccRoute53RecordConfigSuffix,178 Check: resource.ComposeTestCheckFunc(179 testAccCheckRoute53RecordExists("aws_route53_record.default"),180 ),181 },182 },183 })184}185func TestAccAWSRoute53Record_wildcard(t *testing.T) {186 resource.Test(t, resource.TestCase{187 PreCheck: func() { testAccPreCheck(t) },188 IDRefreshName: "aws_route53_record.wildcard",189 Providers: testAccProviders,190 CheckDestroy: testAccCheckRoute53RecordDestroy,191 Steps: []resource.TestStep{192 resource.TestStep{193 Config: testAccRoute53WildCardRecordConfig,194 Check: resource.ComposeTestCheckFunc(195 testAccCheckRoute53RecordExists("aws_route53_record.wildcard"),196 ),197 },198 // Cause a change, which will trigger a refresh199 resource.TestStep{200 Config: testAccRoute53WildCardRecordConfigUpdate,201 Check: resource.ComposeTestCheckFunc(202 testAccCheckRoute53RecordExists("aws_route53_record.wildcard"),203 ),204 },205 },206 })207}208func TestAccAWSRoute53Record_failover(t *testing.T) {209 resource.Test(t, resource.TestCase{210 PreCheck: func() { testAccPreCheck(t) },211 IDRefreshName: "aws_route53_record.www-primary",212 Providers: testAccProviders,213 CheckDestroy: testAccCheckRoute53RecordDestroy,214 Steps: []resource.TestStep{215 resource.TestStep{216 Config: testAccRoute53FailoverCNAMERecord,217 Check: resource.ComposeTestCheckFunc(218 testAccCheckRoute53RecordExists("aws_route53_record.www-primary"),219 testAccCheckRoute53RecordExists("aws_route53_record.www-secondary"),220 ),221 },222 },223 })224}225func TestAccAWSRoute53Record_weighted_basic(t *testing.T) {226 resource.Test(t, resource.TestCase{227 PreCheck: func() { testAccPreCheck(t) },228 IDRefreshName: "aws_route53_record.www-live",229 Providers: testAccProviders,230 CheckDestroy: testAccCheckRoute53RecordDestroy,231 Steps: []resource.TestStep{232 resource.TestStep{233 Config: testAccRoute53WeightedCNAMERecord,234 Check: resource.ComposeTestCheckFunc(235 testAccCheckRoute53RecordExists("aws_route53_record.www-dev"),236 testAccCheckRoute53RecordExists("aws_route53_record.www-live"),237 testAccCheckRoute53RecordExists("aws_route53_record.www-off"),238 ),239 },240 },241 })242}243func TestAccAWSRoute53Record_alias(t *testing.T) {244 rs := acctest.RandString(10)245 config := fmt.Sprintf(testAccRoute53ElbAliasRecord, rs)246 resource.Test(t, resource.TestCase{247 PreCheck: func() { testAccPreCheck(t) },248 IDRefreshName: "aws_route53_record.alias",249 Providers: testAccProviders,250 CheckDestroy: testAccCheckRoute53RecordDestroy,251 Steps: []resource.TestStep{252 resource.TestStep{253 Config: config,254 Check: resource.ComposeTestCheckFunc(255 testAccCheckRoute53RecordExists("aws_route53_record.alias"),256 ),257 },258 },259 })260}261func TestAccAWSRoute53Record_s3_alias(t *testing.T) {262 resource.Test(t, resource.TestCase{263 PreCheck: func() { testAccPreCheck(t) },264 Providers: testAccProviders,265 CheckDestroy: testAccCheckRoute53RecordDestroy,266 Steps: []resource.TestStep{267 resource.TestStep{268 Config: testAccRoute53S3AliasRecord,269 Check: resource.ComposeTestCheckFunc(270 testAccCheckRoute53RecordExists("aws_route53_record.alias"),271 ),272 },273 },274 })275}276func TestAccAWSRoute53Record_weighted_alias(t *testing.T) {277 resource.Test(t, resource.TestCase{278 PreCheck: func() { testAccPreCheck(t) },279 IDRefreshName: "aws_route53_record.elb_weighted_alias_live",280 Providers: testAccProviders,281 CheckDestroy: testAccCheckRoute53RecordDestroy,282 Steps: []resource.TestStep{283 resource.TestStep{284 Config: testAccRoute53WeightedElbAliasRecord,285 Check: resource.ComposeTestCheckFunc(286 testAccCheckRoute53RecordExists("aws_route53_record.elb_weighted_alias_live"),287 testAccCheckRoute53RecordExists("aws_route53_record.elb_weighted_alias_dev"),288 ),289 },290 resource.TestStep{291 Config: testAccRoute53WeightedR53AliasRecord,292 Check: resource.ComposeTestCheckFunc(293 testAccCheckRoute53RecordExists("aws_route53_record.green_origin"),294 testAccCheckRoute53RecordExists("aws_route53_record.r53_weighted_alias_live"),295 testAccCheckRoute53RecordExists("aws_route53_record.blue_origin"),296 testAccCheckRoute53RecordExists("aws_route53_record.r53_weighted_alias_dev"),297 ),298 },299 },300 })301}302func TestAccAWSRoute53Record_geolocation_basic(t *testing.T) {303 resource.Test(t, resource.TestCase{304 PreCheck: func() { testAccPreCheck(t) },305 Providers: testAccProviders,306 CheckDestroy: testAccCheckRoute53RecordDestroy,307 Steps: []resource.TestStep{308 resource.TestStep{309 Config: testAccRoute53GeolocationCNAMERecord,310 Check: resource.ComposeTestCheckFunc(311 testAccCheckRoute53RecordExists("aws_route53_record.default"),312 testAccCheckRoute53RecordExists("aws_route53_record.california"),313 testAccCheckRoute53RecordExists("aws_route53_record.oceania"),314 testAccCheckRoute53RecordExists("aws_route53_record.denmark"),315 ),316 },317 },318 })319}320func TestAccAWSRoute53Record_latency_basic(t *testing.T) {321 resource.Test(t, resource.TestCase{322 PreCheck: func() { testAccPreCheck(t) },323 Providers: testAccProviders,324 CheckDestroy: testAccCheckRoute53RecordDestroy,325 Steps: []resource.TestStep{326 resource.TestStep{327 Config: testAccRoute53LatencyCNAMERecord,328 Check: resource.ComposeTestCheckFunc(329 testAccCheckRoute53RecordExists("aws_route53_record.us-east-1"),330 testAccCheckRoute53RecordExists("aws_route53_record.eu-west-1"),331 testAccCheckRoute53RecordExists("aws_route53_record.ap-northeast-1"),332 ),333 },334 },335 })336}337func TestAccAWSRoute53Record_TypeChange(t *testing.T) {338 resource.Test(t, resource.TestCase{339 PreCheck: func() { testAccPreCheck(t) },340 IDRefreshName: "aws_route53_record.sample",341 Providers: testAccProviders,342 CheckDestroy: testAccCheckRoute53RecordDestroy,343 Steps: []resource.TestStep{344 resource.TestStep{345 Config: testAccRoute53RecordTypeChangePre,346 Check: resource.ComposeTestCheckFunc(347 testAccCheckRoute53RecordExists("aws_route53_record.sample"),348 ),349 },350 // Cause a change, which will trigger a refresh351 resource.TestStep{352 Config: testAccRoute53RecordTypeChangePost,353 Check: resource.ComposeTestCheckFunc(354 testAccCheckRoute53RecordExists("aws_route53_record.sample"),355 ),356 },357 },358 })359}360func TestAccAWSRoute53Record_SetIdentiferChange(t *testing.T) {361 resource.Test(t, resource.TestCase{362 PreCheck: func() { testAccPreCheck(t) },363 IDRefreshName: "aws_route53_record.basic_to_weighted",364 Providers: testAccProviders,365 CheckDestroy: testAccCheckRoute53RecordDestroy,366 Steps: []resource.TestStep{367 resource.TestStep{368 Config: testAccRoute53RecordSetIdentifierChangePre,369 Check: resource.ComposeTestCheckFunc(370 testAccCheckRoute53RecordExists("aws_route53_record.basic_to_weighted"),371 ),372 },373 // Cause a change, which will trigger a refresh374 resource.TestStep{375 Config: testAccRoute53RecordSetIdentifierChangePost,376 Check: resource.ComposeTestCheckFunc(377 testAccCheckRoute53RecordExists("aws_route53_record.basic_to_weighted"),378 ),379 },380 },381 })382}383func TestAccAWSRoute53Record_AliasChange(t *testing.T) {384 resource.Test(t, resource.TestCase{385 PreCheck: func() { testAccPreCheck(t) },386 IDRefreshName: "aws_route53_record.elb_alias_change",387 Providers: testAccProviders,388 CheckDestroy: testAccCheckRoute53RecordDestroy,389 Steps: []resource.TestStep{390 resource.TestStep{391 Config: testAccRoute53RecordAliasChangePre,392 Check: resource.ComposeTestCheckFunc(393 testAccCheckRoute53RecordExists("aws_route53_record.elb_alias_change"),394 ),395 },396 // Cause a change, which will trigger a refresh397 resource.TestStep{398 Config: testAccRoute53RecordAliasChangePost,399 Check: resource.ComposeTestCheckFunc(400 testAccCheckRoute53RecordExists("aws_route53_record.elb_alias_change"),401 ),402 },403 },404 })405}406func TestAccAWSRoute53Record_empty(t *testing.T) {407 resource.Test(t, resource.TestCase{408 PreCheck: func() { testAccPreCheck(t) },409 IDRefreshName: "aws_route53_record.empty",410 Providers: testAccProviders,411 CheckDestroy: testAccCheckRoute53RecordDestroy,412 Steps: []resource.TestStep{413 resource.TestStep{414 Config: testAccRoute53RecordConfigEmptyName,415 Check: resource.ComposeTestCheckFunc(416 testAccCheckRoute53RecordExists("aws_route53_record.empty"),417 ),418 },419 },420 })421}422// Regression test for https://github.com/hashicorp/terraform/issues/8423423func TestAccAWSRoute53Record_longTXTrecord(t *testing.T) {424 resource.Test(t, resource.TestCase{425 PreCheck: func() { testAccPreCheck(t) },426 IDRefreshName: "aws_route53_record.long_txt",427 Providers: testAccProviders,428 CheckDestroy: testAccCheckRoute53RecordDestroy,429 Steps: []resource.TestStep{430 resource.TestStep{431 Config: testAccRoute53RecordConfigLongTxtRecord,432 Check: resource.ComposeTestCheckFunc(433 testAccCheckRoute53RecordExists("aws_route53_record.long_txt"),434 ),435 },436 },437 })438}439func testAccCheckRoute53RecordDestroy(s *terraform.State) error {440 conn := testAccProvider.Meta().(*AWSClient).r53conn441 for _, rs := range s.RootModule().Resources {442 if rs.Type != "aws_route53_record" {443 continue444 }445 parts := parseRecordId(rs.Primary.ID)446 zone := parts[0]447 name := parts[1]448 rType := parts[2]449 en := expandRecordName(name, "notexample.com")450 lopts := &route53.ListResourceRecordSetsInput{451 HostedZoneId: aws.String(cleanZoneID(zone)),452 StartRecordName: aws.String(en),453 StartRecordType: aws.String(rType),454 }455 resp, err := conn.ListResourceRecordSets(lopts)456 if err != nil {457 if awsErr, ok := err.(awserr.Error); ok {458 // if NoSuchHostedZone, then all the things are destroyed459 if awsErr.Code() == "NoSuchHostedZone" {460 return nil461 }462 }463 return err464 }465 if len(resp.ResourceRecordSets) == 0 {466 return nil467 }468 rec := resp.ResourceRecordSets[0]469 if FQDN(*rec.Name) == FQDN(name) && *rec.Type == rType {470 return fmt.Errorf("Record still exists: %#v", rec)471 }472 }473 return nil474}475func testAccCheckRoute53RecordExists(n string) resource.TestCheckFunc {476 return func(s *terraform.State) error {477 conn := testAccProvider.Meta().(*AWSClient).r53conn478 rs, ok := s.RootModule().Resources[n]479 if !ok {480 return fmt.Errorf("Not found: %s", n)481 }482 if rs.Primary.ID == "" {483 return fmt.Errorf("No hosted zone ID is set")484 }485 parts := parseRecordId(rs.Primary.ID)486 zone := parts[0]487 name := parts[1]488 rType := parts[2]489 en := expandRecordName(name, "notexample.com")...

Full Screen

Full Screen

resource_aws_api_gateway_usage_plan_test.go

Source:resource_aws_api_gateway_usage_plan_test.go Github

copy

Full Screen

...13 var conf apigateway.UsagePlan14 name := acctest.RandString(10)15 updatedName := acctest.RandString(10)16 resource.Test(t, resource.TestCase{17 PreCheck: func() { testAccPreCheck(t) },18 Providers: testAccProviders,19 CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy,20 Steps: []resource.TestStep{21 {22 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),23 Check: resource.ComposeTestCheckFunc(24 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),25 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),26 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""),27 ),28 },29 {30 Config: testAccAWSApiGatewayUsagePlanBasicUpdatedConfig(updatedName),31 Check: resource.ComposeTestCheckFunc(32 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", updatedName),33 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""),34 ),35 },36 {37 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),38 Check: resource.ComposeTestCheckFunc(39 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),40 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),41 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""),42 ),43 },44 },45 })46}47func TestAccAWSAPIGatewayUsagePlan_description(t *testing.T) {48 var conf apigateway.UsagePlan49 name := acctest.RandString(10)50 resource.Test(t, resource.TestCase{51 PreCheck: func() { testAccPreCheck(t) },52 Providers: testAccProviders,53 CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy,54 Steps: []resource.TestStep{55 {56 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),57 Check: resource.ComposeTestCheckFunc(58 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),59 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""),60 ),61 },62 {63 Config: testAccAWSApiGatewayUsagePlanDescriptionConfig(name),64 Check: resource.ComposeTestCheckFunc(65 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),66 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", "This is a description"),67 ),68 },69 {70 Config: testAccAWSApiGatewayUsagePlanDescriptionUpdatedConfig(name),71 Check: resource.ComposeTestCheckFunc(72 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", "This is a new description"),73 ),74 },75 {76 Config: testAccAWSApiGatewayUsagePlanDescriptionConfig(name),77 Check: resource.ComposeTestCheckFunc(78 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),79 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", "This is a description"),80 ),81 },82 {83 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),84 Check: resource.ComposeTestCheckFunc(85 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),86 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""),87 ),88 },89 },90 })91}92func TestAccAWSAPIGatewayUsagePlan_productCode(t *testing.T) {93 var conf apigateway.UsagePlan94 name := acctest.RandString(10)95 resource.Test(t, resource.TestCase{96 PreCheck: func() { testAccPreCheck(t) },97 Providers: testAccProviders,98 CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy,99 Steps: []resource.TestStep{100 {101 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),102 Check: resource.ComposeTestCheckFunc(103 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),104 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", ""),105 ),106 },107 {108 Config: testAccAWSApiGatewayUsagePlanProductCodeConfig(name),109 Check: resource.ComposeTestCheckFunc(110 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),111 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", "MYCODE"),112 ),113 },114 {115 Config: testAccAWSApiGatewayUsagePlanProductCodeUpdatedConfig(name),116 Check: resource.ComposeTestCheckFunc(117 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", "MYCODE2"),118 ),119 },120 {121 Config: testAccAWSApiGatewayUsagePlanProductCodeConfig(name),122 Check: resource.ComposeTestCheckFunc(123 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),124 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", "MYCODE"),125 ),126 },127 {128 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),129 Check: resource.ComposeTestCheckFunc(130 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),131 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", ""),132 ),133 },134 },135 })136}137func TestAccAWSAPIGatewayUsagePlan_throttling(t *testing.T) {138 var conf apigateway.UsagePlan139 name := acctest.RandString(10)140 resource.Test(t, resource.TestCase{141 PreCheck: func() { testAccPreCheck(t) },142 Providers: testAccProviders,143 CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy,144 Steps: []resource.TestStep{145 {146 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),147 Check: resource.ComposeTestCheckFunc(148 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),149 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),150 resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings"),151 ),152 },153 {154 Config: testAccAWSApiGatewayUsagePlanThrottlingConfig(name),155 Check: resource.ComposeTestCheckFunc(156 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),157 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),158 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.4173790118.burst_limit", "2"),159 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.4173790118.rate_limit", "5"),160 ),161 },162 {163 Config: testAccAWSApiGatewayUsagePlanThrottlingModifiedConfig(name),164 Check: resource.ComposeTestCheckFunc(165 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),166 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),167 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.1779463053.burst_limit", "3"),168 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.1779463053.rate_limit", "6"),169 ),170 },171 {172 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),173 Check: resource.ComposeTestCheckFunc(174 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),175 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),176 resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings"),177 ),178 },179 },180 })181}182func TestAccAWSAPIGatewayUsagePlan_quota(t *testing.T) {183 var conf apigateway.UsagePlan184 name := acctest.RandString(10)185 resource.Test(t, resource.TestCase{186 PreCheck: func() { testAccPreCheck(t) },187 Providers: testAccProviders,188 CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy,189 Steps: []resource.TestStep{190 {191 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),192 Check: resource.ComposeTestCheckFunc(193 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),194 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),195 resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings"),196 ),197 },198 {199 Config: testAccAWSApiGatewayUsagePlanQuotaConfig(name),200 Check: resource.ComposeTestCheckFunc(201 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),202 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),203 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.1956747625.limit", "100"),204 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.1956747625.offset", "6"),205 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.1956747625.period", "WEEK"),206 ),207 },208 {209 Config: testAccAWSApiGatewayUsagePlanQuotaModifiedConfig(name),210 Check: resource.ComposeTestCheckFunc(211 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),212 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),213 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.3909168194.limit", "200"),214 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.3909168194.offset", "20"),215 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.3909168194.period", "MONTH"),216 ),217 },218 {219 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),220 Check: resource.ComposeTestCheckFunc(221 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),222 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),223 resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings"),224 ),225 },226 },227 })228}229func TestAccAWSAPIGatewayUsagePlan_apiStages(t *testing.T) {230 var conf apigateway.UsagePlan231 name := acctest.RandString(10)232 resource.Test(t, resource.TestCase{233 PreCheck: func() { testAccPreCheck(t) },234 Providers: testAccProviders,235 CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy,236 Steps: []resource.TestStep{237 // Create UsagePlan WITH Stages as the API calls are different238 // when creating or updating.239 {240 Config: testAccAWSApiGatewayUsagePlanApiStagesConfig(name),241 Check: resource.ComposeTestCheckFunc(242 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),243 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),244 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "api_stages.0.stage", "test"),245 ),246 },247 // Handle api stages removal248 {249 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),250 Check: resource.ComposeTestCheckFunc(251 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),252 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),253 resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "api_stages"),254 ),255 },256 // Handle api stages additions257 {258 Config: testAccAWSApiGatewayUsagePlanApiStagesConfig(name),259 Check: resource.ComposeTestCheckFunc(260 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),261 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),262 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "api_stages.0.stage", "test"),263 ),264 },265 // Handle api stages updates266 {267 Config: testAccAWSApiGatewayUsagePlanApiStagesModifiedConfig(name),268 Check: resource.ComposeTestCheckFunc(269 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),270 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),271 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "api_stages.0.stage", "foo"),272 ),273 },274 {275 Config: testAccAWSApiGatewayUsagePlanBasicConfig(name),276 Check: resource.ComposeTestCheckFunc(277 testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf),278 resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name),279 resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "api_stages"),280 ),281 },282 },283 })284}285func testAccCheckAWSAPIGatewayUsagePlanExists(n string, res *apigateway.UsagePlan) resource.TestCheckFunc {286 return func(s *terraform.State) error {287 rs, ok := s.RootModule().Resources[n]288 if !ok {289 return fmt.Errorf("Not found: %s", n)290 }291 if rs.Primary.ID == "" {292 return fmt.Errorf("No API Gateway Usage Plan ID is set")293 }294 conn := testAccProvider.Meta().(*AWSClient).apigateway295 req := &apigateway.GetUsagePlanInput{296 UsagePlanId: aws.String(rs.Primary.ID),297 }298 up, err := conn.GetUsagePlan(req)299 if err != nil {300 return err301 }302 if *up.Id != rs.Primary.ID {303 return fmt.Errorf("APIGateway Usage Plan not found")304 }305 *res = *up306 return nil307 }308}309func testAccCheckAWSAPIGatewayUsagePlanDestroy(s *terraform.State) error {310 conn := testAccProvider.Meta().(*AWSClient).apigateway311 for _, rs := range s.RootModule().Resources {312 if rs.Type != "aws_api_gateway_usage_plan" {313 continue314 }315 req := &apigateway.GetUsagePlanInput{316 UsagePlanId: aws.String(s.RootModule().Resources["aws_api_gateway_rest_api.test"].Primary.ID),317 }318 describe, err := conn.GetUsagePlan(req)319 if err == nil {320 if describe.Id != nil && *describe.Id == rs.Primary.ID {321 return fmt.Errorf("API Gateway Usage Plan still exists")322 }323 }...

Full Screen

Full Screen

resource_aws_cognito_identity_pool_test.go

Source:resource_aws_cognito_identity_pool_test.go Github

copy

Full Screen

...13func TestAccAWSCognitoIdentityPool_basic(t *testing.T) {14 name := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))15 updatedName := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))16 resource.Test(t, resource.TestCase{17 PreCheck: func() { testAccPreCheck(t) },18 Providers: testAccProviders,19 CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy,20 Steps: []resource.TestStep{21 {22 Config: testAccAWSCognitoIdentityPoolConfig_basic(name),23 Check: resource.ComposeAggregateTestCheckFunc(24 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),25 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),26 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "allow_unauthenticated_identities", "false"),27 ),28 },29 {30 Config: testAccAWSCognitoIdentityPoolConfig_basic(updatedName),31 Check: resource.ComposeAggregateTestCheckFunc(32 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),33 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", updatedName)),34 ),35 },36 },37 })38}39func TestAccAWSCognitoIdentityPool_supportedLoginProviders(t *testing.T) {40 name := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))41 resource.Test(t, resource.TestCase{42 PreCheck: func() { testAccPreCheck(t) },43 Providers: testAccProviders,44 CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy,45 Steps: []resource.TestStep{46 {47 Config: testAccAWSCognitoIdentityPoolConfig_supportedLoginProviders(name),48 Check: resource.ComposeAggregateTestCheckFunc(49 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),50 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),51 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "supported_login_providers.graph.facebook.com", "7346241598935555"),52 ),53 },54 {55 Config: testAccAWSCognitoIdentityPoolConfig_supportedLoginProvidersModified(name),56 Check: resource.ComposeAggregateTestCheckFunc(57 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),58 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),59 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "supported_login_providers.graph.facebook.com", "7346241598935552"),60 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "supported_login_providers.accounts.google.com", "123456789012.apps.googleusercontent.com"),61 ),62 },63 {64 Config: testAccAWSCognitoIdentityPoolConfig_basic(name),65 Check: resource.ComposeAggregateTestCheckFunc(66 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),67 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),68 ),69 },70 },71 })72}73func TestAccAWSCognitoIdentityPool_openidConnectProviderArns(t *testing.T) {74 name := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))75 resource.Test(t, resource.TestCase{76 PreCheck: func() { testAccPreCheck(t) },77 Providers: testAccProviders,78 CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy,79 Steps: []resource.TestStep{80 {81 Config: testAccAWSCognitoIdentityPoolConfig_openidConnectProviderArns(name),82 Check: resource.ComposeAggregateTestCheckFunc(83 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),84 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),85 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "openid_connect_provider_arns.#", "1"),86 ),87 },88 {89 Config: testAccAWSCognitoIdentityPoolConfig_openidConnectProviderArnsModified(name),90 Check: resource.ComposeAggregateTestCheckFunc(91 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),92 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),93 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "openid_connect_provider_arns.#", "2"),94 ),95 },96 {97 Config: testAccAWSCognitoIdentityPoolConfig_basic(name),98 Check: resource.ComposeAggregateTestCheckFunc(99 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),100 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),101 ),102 },103 },104 })105}106func TestAccAWSCognitoIdentityPool_samlProviderArns(t *testing.T) {107 name := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))108 resource.Test(t, resource.TestCase{109 PreCheck: func() { testAccPreCheck(t) },110 Providers: testAccProviders,111 CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy,112 Steps: []resource.TestStep{113 {114 Config: testAccAWSCognitoIdentityPoolConfig_samlProviderArns(name),115 Check: resource.ComposeAggregateTestCheckFunc(116 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),117 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),118 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "saml_provider_arns.#", "1"),119 ),120 },121 {122 Config: testAccAWSCognitoIdentityPoolConfig_samlProviderArnsModified(name),123 Check: resource.ComposeAggregateTestCheckFunc(124 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),125 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),126 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "saml_provider_arns.#", "1"),127 ),128 },129 {130 Config: testAccAWSCognitoIdentityPoolConfig_basic(name),131 Check: resource.ComposeAggregateTestCheckFunc(132 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),133 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),134 resource.TestCheckNoResourceAttr("aws_cognito_identity_pool.main", "saml_provider_arns.#"),135 ),136 },137 },138 })139}140func TestAccAWSCognitoIdentityPool_cognitoIdentityProviders(t *testing.T) {141 name := fmt.Sprintf("%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))142 resource.Test(t, resource.TestCase{143 PreCheck: func() { testAccPreCheck(t) },144 Providers: testAccProviders,145 CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy,146 Steps: []resource.TestStep{147 {148 Config: testAccAWSCognitoIdentityPoolConfig_cognitoIdentityProviders(name),149 Check: resource.ComposeAggregateTestCheckFunc(150 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),151 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),152 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.66456389.client_id", "7lhlkkfbfb4q5kpp90urffao"),153 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.66456389.provider_name", "cognito-idp.us-east-1.amazonaws.com/us-east-1_Zr231apJu"),154 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.66456389.server_side_token_check", "false"),155 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.3571192419.client_id", "7lhlkkfbfb4q5kpp90urffao"),156 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.3571192419.provider_name", "cognito-idp.us-east-1.amazonaws.com/us-east-1_Ab129faBb"),157 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.3571192419.server_side_token_check", "false"),158 ),159 },160 {161 Config: testAccAWSCognitoIdentityPoolConfig_cognitoIdentityProvidersModified(name),162 Check: resource.ComposeAggregateTestCheckFunc(163 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),164 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),165 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.3661724441.client_id", "6lhlkkfbfb4q5kpp90urffae"),166 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.3661724441.provider_name", "cognito-idp.us-east-1.amazonaws.com/us-east-1_Zr231apJu"),167 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.3661724441.server_side_token_check", "false"),168 ),169 },170 {171 Config: testAccAWSCognitoIdentityPoolConfig_basic(name),172 Check: resource.ComposeAggregateTestCheckFunc(173 testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"),174 resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)),175 ),176 },177 },178 })179}180func testAccCheckAWSCognitoIdentityPoolExists(n string) resource.TestCheckFunc {181 return func(s *terraform.State) error {182 rs, ok := s.RootModule().Resources[n]183 if !ok {184 return fmt.Errorf("Not found: %s", n)185 }186 if rs.Primary.ID == "" {187 return errors.New("No Cognito Identity Pool ID is set")188 }189 conn := testAccProvider.Meta().(*AWSClient).cognitoconn190 _, err := conn.DescribeIdentityPool(&cognitoidentity.DescribeIdentityPoolInput{191 IdentityPoolId: aws.String(rs.Primary.ID),192 })193 if err != nil {194 return err195 }196 return nil197 }198}199func testAccCheckAWSCognitoIdentityPoolDestroy(s *terraform.State) error {200 conn := testAccProvider.Meta().(*AWSClient).cognitoconn201 for _, rs := range s.RootModule().Resources {202 if rs.Type != "aws_cognito_identity_pool" {203 continue204 }205 _, err := conn.DescribeIdentityPool(&cognitoidentity.DescribeIdentityPoolInput{206 IdentityPoolId: aws.String(rs.Primary.ID),207 })208 if err != nil {209 if wserr, ok := err.(awserr.Error); ok && wserr.Code() == "ResourceNotFoundException" {210 return nil211 }212 return err213 }...

Full Screen

Full Screen

Check

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4 t := testing.T{}5 t.Check(1 == 2, "1 is not equal to 2")6}

Full Screen

Full Screen

Check

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(main.Check(5))4}5import (6func main() {7 fmt.Println(main.Check(15))8}9We can also create a package in a separate directory. For example, we can create a package named mypackage in a directory named mypackage. In this case, we need to define the path of the package in the import statement. For example, if we want to import the package mypackage in a file named 1.go, then we need to write the following code in 1.go:10import (11func main() {12 fmt.Println(mypackage.Check(5))13}14We can also create a package in a separate directory and use it in another directory. For example, we can create a package named mypackage in a directory named mypackage. We can also create a directory named mymodule and store the main file in it. In this case, we need to define the path of the package in the import statement. For example, if we want to import the package mypackage in a file named 1.go, then we need to write the following code in 1.go:15import (16func main() {17 fmt.Println(mypackage.Check(5))18}

Full Screen

Full Screen

Check

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello, playground")4 fmt.Println(math.Sqrt(7))5}6import (7func main() {8 fmt.Println("Hello, playground")9 fmt.Println(math.Sqrt(7))10}11import (12func main() {13 fmt.Println("Hello, playground")14 fmt.Println(math.Sqrt(7))15}16import (17func main() {18 fmt.Println("Hello, playground")19 fmt.Println(math.Sqrt(7))20}21import (22func main() {23 fmt.Println("Hello, playground")24 fmt.Println(math.Sqrt(7))25}26import (27func main() {28 fmt.Println("Hello, playground")29 fmt.Println(math.Sqrt(7))30}31import (32func main() {33 fmt.Println("Hello, playground")34 fmt.Println(math.Sqrt(7))35}36import (37func main() {38 fmt.Println("Hello, playground")39 fmt.Println(math.Sqrt(7))40}41import (42func main() {43 fmt.Println("Hello, playground")44 fmt.Println(math.Sqrt(7))45}46import (47func main() {48 fmt.Println("Hello, playground")49 fmt.Println(math

Full Screen

Full Screen

Check

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4}5import (6func Check() {7 fmt.Println("Check")8}9import (10func Check() {11 fmt.Println("Check")12}13import (14func Check() {15 fmt.Println("Check")16}17import (18func main() {19 fmt.Println("Hello World")20 main.Check()21}22import (23func main() {24 fmt.Println("Hello World")25 main.Check()26}27import (28func main() {29 fmt.Println("Hello World")30 main.Check()31}32import (33func main() {34 fmt.Println("Hello World")35 main.Check()36}37import (38func main() {39 fmt.Println("Hello World")40 main.Check()41}42import (43func main() {44 fmt.Println("Hello World")45 main.Check()46}47import (48func main() {49 fmt.Println("Hello World")50 main.Check()51}52import (53func main() {54 fmt.Println("Hello World")55 main.Check()56}57import (58func main() {59 fmt.Println("Hello World")60 main.Check()61}62import (63func main() {64 fmt.Println("Hello World")65 main.Check()66}67import (

Full Screen

Full Screen

Check

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Enter a number to check if it is prime or not")4 fmt.Scanln(&num)5 prime = Check(num)6 if prime == true {7 fmt.Println("The number " + strconv.Itoa(num) + " is prime")8 } else {9 fmt.Println("The number " + strconv.Itoa(num) + " is not prime")10 }11}12import (13func Check(num int) bool {14 for i = 2; i <= int(math.Sqrt(float64(num))); i++ {15 if num%i == 0 {16 }17 }18}

Full Screen

Full Screen

Check

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 Check()4}5func Check() {6 fmt.Println("I am in Check method")7}

Full Screen

Full Screen

Check

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4 mylib.Check()5}6import "fmt"7func Check() {8 fmt.Println("This is mylib")9}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Syzkaller automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful