Skip to content

Add diagcheck package for testing deprecation warnings#619

Draft
ansgarm wants to merge 1 commit intomainfrom
add-diagcheck-deprecation-testing
Draft

Add diagcheck package for testing deprecation warnings#619
ansgarm wants to merge 1 commit intomainfrom
add-diagcheck-deprecation-testing

Conversation

@ansgarm
Copy link
Member

@ansgarm ansgarm commented Feb 23, 2026

Introduces a new diagcheck package that enables provider developers to test
deprecation messages in acceptance tests. The package follows the established
plancheck/statecheck pattern and integrates with terraform validate command.

Key features:

  • DiagnosticCheck interface for validating terraform diagnostics
  • ExpectNoDiagnostics(), ExpectNoWarnings(), ExpectNoErrors() checks
  • ExpectDiagnostic() and ExpectWarning() for specific diagnostic assertions
  • ExpectDiagnosticCount() and ExpectWarningCount() for count validation
  • ConfigValidateChecks field on TestStep for validation-time checks
  • Validate() method on WorkingDir to execute terraform validate
  • 100% test coverage with 23 unit tests

This addresses the need to test deprecation messages introduced across the
Terraform plugin ecosystem (terraform-plugin-framework#1276,
terraform-plugin-sdk#1553, terraform-core#38135).

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Related Issue

Fixes #

Description

In plain English, describe your approach to addressing the issue linked above. For example, if you made a particular design decision, let us know why you chose this path instead of another solution.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Introduces a new diagcheck package that enables provider developers to test
deprecation messages in acceptance tests. The package follows the established
plancheck/statecheck pattern and integrates with terraform validate command.

Key features:
- DiagnosticCheck interface for validating terraform diagnostics
- ExpectNoDiagnostics(), ExpectNoWarnings(), ExpectNoErrors() checks
- ExpectDiagnostic() and ExpectWarning() for specific diagnostic assertions
- ExpectDiagnosticCount() and ExpectWarningCount() for count validation
- ConfigValidateChecks field on TestStep for validation-time checks
- Validate() method on WorkingDir to execute terraform validate
- 100% test coverage with 23 unit tests

This addresses the need to test deprecation messages introduced across the
Terraform plugin ecosystem (terraform-plugin-framework#1276,
terraform-plugin-sdk#1553, terraform-core#38135).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant