Skip to content

Commit 6a92a1d

Browse files
authored
docs: group generated tag test options with headings (#41612)
As tag test generation has expanded across the provider, the number of parameters which can be passed to the tags test annotation has grown significantly. Given the number of options, the contributor documentation on this section has become difficult to read in its entirety. This change bundles the various parameters into related groups and adds headings to break up the available options into smaller standalone sections.
1 parent 077d986 commit 6a92a1d

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

docs/resource-tagging.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ If a resource or data source type supports tags but does not use transparent tag
472472

473473
Additional `@Testing(...)` parameters can be used to control the generated tests.
474474

475+
##### Required Argument parameters
476+
475477
Most testing configurations take a single parameter, often a name or a domain name.
476478
The most common case is parameter `rName` with a value generated by `sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)`, so this is the default.
477479
If no `rName` is required, add the annotation `@Testing(generator=false)`.
@@ -495,6 +497,8 @@ and sets the annotation `@Testing(tlsKeyDomain=rName)` to reference it.
495497
No additional parameters can be defined currently.
496498
If additional parameters are required, and cannot be derived from `rName`, the resource type must use manually created acceptance tests as described below.
497499

500+
##### Exists and Destroy parameters
501+
498502
Most `Exists` functions used in acceptance tests take a pointer to the returned API object.
499503
To specify the type of this parameter, use the annotion `@Testing(existsType=<reference>)`.
500504
This references a Go type and package path with optional package alias, using the format
@@ -508,6 +512,11 @@ For example, the S3 Object uses
508512
Some services or resource types are using a new variant of the standard `Exists` and `DestroyCheck` functions that use `acctest.ProviderMeta` internally, and thus take a `testing.T` as a parameter.
509513
In that case, add the annotations `@Testing(existsTakesT=true)` and `@Testing(destroyTakesT=true)`, respectively.
510514

515+
Some resource types use the no-op `CheckDestroy` function `acctest.CheckDestroyNoop`.
516+
Use the annotation `@Testing(checkDestroyNoop=true)`.
517+
518+
##### Import parameters
519+
511520
The generated acceptance tests use `ImportState` steps.
512521
In most cases, these will work as-is.
513522
To ignore the values of certain parameters when importing, set the annotation `@Testing(importIgnore="...")` to a list of the parameter names separated by semi-colons (`;`).
@@ -517,29 +526,36 @@ If the identifier can be retrieved from a specific resource attribute, use the a
517526
If the identifier can be retrieved from a `resource.ImportStateIdFunc`, use the annotation `@Testing(importStateIdFunc=<func name>)`.
518527
If the resource type does not support importing, use the annotation `@Testing(noImport=true)`.
519528

520-
If the tests need to be serialized, use the annotion `@Testing(serialize=true)`.
529+
##### Serialization parameters
530+
531+
If the tests need to be serialized, use the annotation `@Testing(serialize=true)`.
521532
If a delay is needed between serialized tests, also use the annotation `@Testing(serializeDelay=<duration>)` with a duration in the format used by [`time.ParseDuration()`](https://pkg.go.dev/time#ParseDuration).
522533
For example, 3 minutes and 30 seconds is `3m30s`.
523534

535+
##### Empty and Null Tag parameters
536+
524537
Some services do not support tags with an empty string value.
525538
In that case, use the annotation `@Testing(skipEmptyTags=true)`.
526539

527540
Some services do not support tags with an null string value.
528541
In that case, use the annotation `@Testing(skipNullTags=true)`.
529542

530-
Some resource types use the no-op `CheckDestroy` function `acctest.CheckDestroyNoop`.
531-
Use the annotation `@Testing(checkDestroyNoop=true)`.
543+
##### Tag Update parameters
532544

533545
For some resource types, tags cannot be modified without recreating the resource.
534546
Use the annotation `@Testing(tagsUpdateForceNew=true)`.
535547

536548
Resource types which pass the result of `getTagsIn` directly onto their Update Input may have an error where ignored tags are not correctly excluded from the update.
537549
Use the annotation `@Testing(tagsUpdateGetTagsIn=true)`.
538550

551+
##### Resource Identifier parameters
552+
539553
Some tests read the tag values directly from the AWS API.
540554
If the resource type does not specify `identifierAttribute` in its `@Tags` annotation, specify a `@Testing(tagsIdentifierAttribute=<attribute name>)` annotation to identify which attribute value should be used by the `listTags` function.
541555
If a resource type is also needed for the `listTags` function, also specify the `tagsResourceType` annotation.
542556

557+
##### Tag Removal parameters
558+
543559
At least one resource type, the Service Catalog Provisioned Product, does not support removing tags.
544560
This is likely an error on the AWS side.
545561
Add the annotation `@Testing(noRemoveTags=true)` as a workaround.

0 commit comments

Comments
 (0)