Skip to content

Allow running Check tests on imported resources #717

@greentruff

Description

@greentruff

SDK version

v1.15.0

I checked 2.4.4 and the behavior for imported tests is identical, state is not modified.

Use-cases

The terraform plugin for datadog supports modifying certain properties of default rules. Default rules cannot be created by users and are instead a special resource which must be imported before being modified. See documentation the documentation here.

Implementation of the resource is here

We would like to implement tests which check that the fields are being modified correctly.

Attempted Solutions

The existing tests misused the test framework and use both ImportState: True and Check. The Checks are ignored in this case, testing with ImportStateCheck the state is right after import and does not take into account other changes on top of it. It is also not possible to split the check into multiple steps as ImportState will revert back to the previous state after an import step.

Proposal

Add a flag to keep state after an import step such as ImportPersistState: True which returns the updated state so that following steps can modify it.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsubsystem/testsIssues and feature requests related to the testing framework.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions