@@ -500,95 +500,95 @@ func TestAccElasticsearchIndex_doctype(t *testing.T) {
500500}
501501
502502func TestAccElasticsearchIndex_mapping (t * testing.T ) {
503- g := NewGomegaWithT (t )
504- provider := Provider ()
505- diags := provider .Configure (context .Background (), & terraform.ResourceConfig {})
506- if diags .HasError () {
507- t .Skipf ("err: %#v" , diags )
508- }
503+ g := NewGomegaWithT (t )
504+ provider := Provider ()
505+ diags := provider .Configure (context .Background (), & terraform.ResourceConfig {})
506+ if diags .HasError () {
507+ t .Skipf ("err: %#v" , diags )
508+ }
509509
510- var initialUUID string
511- var err error
512-
513- resource .Test (t , resource.TestCase {
514- PreCheck : func () { testAccPreCheck (t ) },
515- Providers : testAccProviders ,
516- CheckDestroy : checkElasticsearchIndexDestroy ,
517- Steps : []resource.TestStep {
518- {
519- Config : testAccElasticsearchBasicMapping ,
520- Check : resource .ComposeTestCheckFunc (
521- checkElasticsearchIndexMapping ("terraform-test" , func (s * terraform.State , mapping map [string ]interface {}) error {
522- initialUUID , err = getElasticsearchIndexUUID ("elasticsearch_index.test_mapping" , s )
523- if err != nil {
524- return fmt .Errorf ("Failed to get index uuid: %w" , err )
525- }
526- g .Expect (mapping ).To (MatchAllKeys (Keys {
527- "terraform-test" : MatchAllKeys (Keys {
528- "mappings" : MatchAllKeys (Keys {
529- "properties" : MatchAllKeys (Keys {
530- "age" : MatchAllKeys (Keys {
531- "type" : Equal ("integer" ),
532- }),
533- "name" : MatchAllKeys (Keys {
534- "type" : Equal ("text" ),
535- }),
536- }),
537- }),
538- }),
539- }))
540- return nil
541- }),
542- ),
543- },
544- {
545- Config : testAccElasticsearchAddedMapping ,
546- Check : resource .ComposeTestCheckFunc (
547- checkElasticsearchIndexNotRecreated ("elasticsearch_index.test_mapping" , & initialUUID ),
548- checkElasticsearchIndexMapping ("terraform-test" , func (s * terraform.State , mapping map [string ]interface {}) error {
549- g .Expect (mapping ).To (MatchAllKeys (Keys {
550- "terraform-test" : MatchAllKeys (Keys {
551- "mappings" : MatchAllKeys (Keys {
552- "properties" : MatchAllKeys (Keys {
553- "age" : MatchAllKeys (Keys {
554- "type" : Equal ("integer" ),
555- }),
556- "name" : MatchAllKeys (Keys {
557- "type" : Equal ("text" ),
510+ var initialUUID string
511+ var err error
512+
513+ resource .Test (t , resource.TestCase {
514+ PreCheck : func () { testAccPreCheck (t ) },
515+ Providers : testAccProviders ,
516+ CheckDestroy : checkElasticsearchIndexDestroy ,
517+ Steps : []resource.TestStep {
518+ {
519+ Config : testAccElasticsearchBasicMapping ,
520+ Check : resource .ComposeTestCheckFunc (
521+ checkElasticsearchIndexMapping ("terraform-test" , func (s * terraform.State , mapping map [string ]interface {}) error {
522+ initialUUID , err = getElasticsearchIndexUUID ("elasticsearch_index.test_mapping" , s )
523+ if err != nil {
524+ return fmt .Errorf ("Failed to get index uuid: %w" , err )
525+ }
526+ g .Expect (mapping ).To (MatchAllKeys (Keys {
527+ "terraform-test" : MatchAllKeys (Keys {
528+ "mappings" : MatchAllKeys (Keys {
529+ "properties" : MatchAllKeys (Keys {
530+ "age" : MatchAllKeys (Keys {
531+ "type" : Equal ("integer" ),
532+ }),
533+ "name" : MatchAllKeys (Keys {
534+ "type" : Equal ("text" ),
535+ }),
536+ }),
537+ }),
538+ }),
539+ }))
540+ return nil
558541 }),
559- "surname" : MatchAllKeys (Keys {
560- "type" : Equal ("text" ),
542+ ),
543+ },
544+ {
545+ Config : testAccElasticsearchAddedMapping ,
546+ Check : resource .ComposeTestCheckFunc (
547+ checkElasticsearchIndexNotRecreated ("elasticsearch_index.test_mapping" , & initialUUID ),
548+ checkElasticsearchIndexMapping ("terraform-test" , func (s * terraform.State , mapping map [string ]interface {}) error {
549+ g .Expect (mapping ).To (MatchAllKeys (Keys {
550+ "terraform-test" : MatchAllKeys (Keys {
551+ "mappings" : MatchAllKeys (Keys {
552+ "properties" : MatchAllKeys (Keys {
553+ "age" : MatchAllKeys (Keys {
554+ "type" : Equal ("integer" ),
555+ }),
556+ "name" : MatchAllKeys (Keys {
557+ "type" : Equal ("text" ),
558+ }),
559+ "surname" : MatchAllKeys (Keys {
560+ "type" : Equal ("text" ),
561+ }),
562+ }),
563+ }),
564+ }),
565+ }))
566+ return nil
561567 }),
562- } ),
563- }) ,
564- }),
565- }))
566- return nil
567- } ),
568- ),
569- },
570- {
571- Config : testAccElasticsearchRemovedMapping ,
572- Check : resource . ComposeTestCheckFunc (
573- checkElasticsearchIndexRecreated ( "elasticsearch_index.test_mapping" , & initialUUID ),
574- checkElasticsearchIndexMapping ( "terraform-test" , func ( s * terraform. State , mapping map [ string ] interface {}) error {
575- g . Expect ( mapping ). To ( MatchAllKeys ( Keys {
576- "terraform-test" : MatchAllKeys ( Keys {
577- "mappings" : MatchAllKeys ( Keys {
578- "properties" : MatchAllKeys ( Keys {
579- "name" : MatchAllKeys ( Keys {
580- "type" : Equal ( "text" ),
568+ ),
569+ } ,
570+ {
571+ Config : testAccElasticsearchRemovedMapping ,
572+ Check : resource . ComposeTestCheckFunc (
573+ checkElasticsearchIndexRecreated ( "elasticsearch_index.test_mapping" , & initialUUID ),
574+ checkElasticsearchIndexMapping ( "terraform-test" , func ( s * terraform. State , mapping map [ string ] interface {}) error {
575+ g . Expect ( mapping ). To ( MatchAllKeys ( Keys {
576+ "terraform-test" : MatchAllKeys ( Keys {
577+ "mappings" : MatchAllKeys ( Keys {
578+ "properties" : MatchAllKeys ( Keys {
579+ "name" : MatchAllKeys ( Keys {
580+ "type" : Equal ( "text" ),
581+ }),
582+ }),
583+ }),
584+ }),
585+ }))
586+ return nil
581587 }),
582- }),
583- }),
584- }),
585- }))
586- return nil
587- }),
588- ),
589- },
590- },
591- })
588+ ),
589+ },
590+ },
591+ })
592592}
593593
594594func TestAccElasticsearchIndex_rolloverAliasXpack (t * testing.T ) {
0 commit comments