Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Unit test resource and data source schemas in Terraform Plugin Framework #1646

Merged
merged 6 commits into from
Nov 21, 2023

Conversation

lantoli
Copy link
Member

@lantoli lantoli commented Nov 21, 2023

Description

Jira ticket: INTMDB-1306

Unit test resource and data source schemas in Terraform Plugin Framework, more info here.

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.

Further comments

Example of schema problem detection:

--- FAIL: TestDataSourceSchemas (0.00s)
    --- FAIL: TestDataSourceSchemas/mongodbatlas_database_users (0.00s)
        fw_provider_test.go:70: Schema validation diagnostics: [{detail:When validating the resource or data source schema, an implementation issue was found. This is always an issue with the provider and should be reported to the provider developers.
            
            "count" is a reserved root attribute/block name. This is to prevent practitioners from needing special Terraform configuration syntax. summary:Reserved Root Attribute/Block Name}]
--- FAIL: TestResourceSchemas (0.00s)
    --- FAIL: TestResourceSchemas/mongodbatlas_database_user (0.00s)
        fw_provider_test.go:38: Schema validation diagnostics: [{detail:When validating the resource or data source schema, an implementation issue was found. This is always an issue with the provider and should be reported to the provider developers.
            
            "connection" is a reserved root attribute/block name. This is to prevent practitioners from needing special Terraform configuration syntax. summary:Reserved Root Attribute/Block Name}]
    --- FAIL: TestResourceSchemas/mongodbatlas_alert_configuration (0.00s)
        fw_provider_test.go:38: Schema validation diagnostics: [{detail:When validating the resource or data source schema, an implementation issue was found. This is always an issue with the provider and should be reported to the provider developers.
            
            "count" is a reserved root attribute/block name. This is to prevent practitioners from needing special Terraform configuration syntax. summary:Reserved Root Attribute/Block Name}]
FAIL

Copy link
Contributor

Code Coverage

Package Line Rate Health
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas 3%
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/validator 68%
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/testutils 46%
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util 17%
Summary 3% (328 / 10541)

@lantoli lantoli marked this pull request as ready for review November 21, 2023 10:57
@lantoli lantoli requested a review from a team as a code owner November 21, 2023 10:57
Copy link
Member

@AgustinBettati AgustinBettati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@lantoli lantoli merged commit 7dde9cc into master Nov 21, 2023
32 checks passed
@lantoli lantoli deleted the INTMDB-1306_schema_uni_tests branch November 21, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants