Skip to content

[schema-coverage] elasticstack_elasticsearch_index_mappings #5033

Description

@github-actions

Schema coverage report: elasticstack_elasticsearch_index_mappings (resource)

  • Entity type: resource
  • Implementation directory: internal/elasticsearch/index/indexmappings/ (schema.go, resource.go, create.go, update.go, read.go, delete.go)
  • Acceptance tests: internal/elasticsearch/index/indexmappings/acc_test.go, configs under internal/elasticsearch/index/indexmappings/testdata/

1) Attributes with no coverage

  • elasticsearch_connection (Optional block, injected by the envelope): not configured in any testdata config and not asserted in acc_test.go. Other Elasticsearch resources/data sources in this repo cover the entity-local connection block; this resource does not.

2) Attributes with poor coverage

  • mappings (Required, string with index.MappingsType{ExactDynamicTemplateNames: true} and StringIsJSONObject{NonEmpty: true})
    • Observed: validated indirectly via the custom helpers checkStateMappingsProperties, checkStateMappingsTopLevelKeys, checkStateMappingsDynamic*, etc.; the only direct attribute check is TestCheckResourceAttrSet(mappings) in _allTopLevelKeys.
    • Gaps:
      • No test that semantically-equal JSON (different key order / whitespace) produces an empty plan, which is the main reason for the custom type.
      • No test of an invalid (non-JSON / non-object, e.g. array) value. Only the empty-object case (_emptyMappings) is covered.
      • No test of field removal from the config on update (only additions: one_field -> two_fields, base -> with_dynamic, and full -> narrow after import).
  • id (Computed, string): matched against a regexp in several tests but never asserted to equal <cluster_uuid>/<index_name> with the actual index name, and explicitly ignored in ImportStateVerifyIgnore.
  • index (Required, string, RequiresReplace): force-new covered by _indexForceNew, but the check does not assert that the old index's mappings remain untouched after replacement (destroy is a no-op).

Prioritized top 5 gaps

  1. elasticsearch_connection: add a test using the entity-local connection block (endpoints, insecure, auth) and assert elasticsearch_connection.#, .0.endpoints.*, .0.insecure plus auth via the shared acctest helpers.
  2. mappings semantic-equality: add a step whose config has the same mappings with reordered keys / different whitespace and assert plancheck.ExpectEmptyPlan().
  3. mappings invalid input: add steps with mappings = "not json" and mappings = "[]" using ExpectError.
  4. mappings field removal on update: add a step removing a previously declared field and assert the plan/state tracks only the remaining fields while the field remains on the index (no-op removal semantics).
  5. id value: add an assertion that id ends with /<index_name> (use TestCheckResourceAttrWith or a regexp built from indexName) and compare with the import ID in _import.

Concrete acceptance-test additions

  • TestAccResourceIndexMappings_elasticsearchConnection with a new testdata/.../apply config containing an elasticsearch_connection block (see existing tests for other resources using acctest.PreCheckWithExplicitElasticsearchEndpoint-style helpers).
  • TestAccResourceIndexMappings_semanticEquality (reordered keys -> empty plan).
  • TestAccResourceIndexMappings_invalidMappings (non-JSON and array inputs).
  • Add a field-removal step to _update.
  • Tighten id assertions in _basic and _import.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.anthropic.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by Schema Coverage Rotation · claude · sonnet55 · 61.4 AIC · ⌖ 29.3 AIC · ⊞ 8.1K · ◷

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions