Skip to content

test: add unit tests and terraform configs for post-rc4 features - #298

Draft
Aaron ("AJ") Steers (aaronsteers) wants to merge 4 commits into
mainfrom
devin/1770754137-test-post-rc4-features
Draft

test: add unit tests and terraform configs for post-rc4 features#298
Aaron ("AJ") Steers (aaronsteers) wants to merge 4 commits into
mainfrom
devin/1770754137-test-post-rc4-features

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Feb 10, 2026

Copy link
Copy Markdown
Member

Summary

Adds Go unit tests, Terraform test project configurations, and a migration guide improvement to validate and document the two major features added since v1.0.0-rc4:

  1. Pardot v5_page_size fixterraform plan with the pardot test config confirms v5_page_size no longer appears as a computed default. Previously it would force v5_page_size = 1000 even when omitted.

  2. MoveState typed-to-generic migration — Go tests verify the helper functions and interface implementation. Terraform configs provide a two-step workflow (step1: deploy typed resources, step2: migrate via moved blocks to generic airbyte_source/airbyte_destination).

  3. Migration guide improvement — Updated docs/MIGRATION_GUIDE.md with a critical warning about definition_id matching: using the wrong ID silently triggers forces replacement instead of a clean move. Added concrete terraform state show | grep definition_id command and clearer plan verification criteria. This was discovered during E2E testing when incorrect definition_id values caused force-replacement instead of moves.

E2E verification completed against Airbyte Cloud

The full move workflow was run end-to-end against the Devin sandbox workspace (266ebdfe-0d7b-4540-9817-de7e4505ba61):

  1. Step 1terraform apply created typed resources (airbyte_source_faker, airbyte_destination_dev_null, airbyte_connection)
  2. Step 2 — State was copied, terraform plan with moved blocks showed:
    # airbyte_source_faker.my_source has moved to airbyte_source.my_source
    # airbyte_destination_dev_null.my_dest has moved to airbyte_destination.my_dest
    
    No destroy/create pairs for source or destination. Resource IDs were preserved after apply.
  3. Cleanup — All resources destroyed successfully.

Known issue encountered (pre-existing, not introduced here): airbyte_connection returns unknown values for schedule.basic_timing and schedule.cron_expression after apply, which taints the resource. Root cause: the generated RefreshFromSharedConnectionResponse only populates schedule fields when r.Schedule == nil, so user-provided schedule configs cause the API response values to be silently dropped. This caused the connection to be recreated during step 2, but the source and destination moves worked correctly.

What was verified locally (in addition to E2E):

  • All Go unit tests pass (go test ./internal/provider/ -run "TestExtract|TestMoveState")
  • terraform validate succeeds for all 3 configs using a locally-built provider binary
  • terraform plan on the pardot config confirms v5_page_size is absent from the planned configuration
  • golangci-lint / staticcheck passes

Updates since last revision

  • Improved docs/MIGRATION_GUIDE.md with a prominent warning about definition_id matching, a concrete terraform state show command, and clearer plan verification criteria (look for has moved to, watch for forces replacement).
  • Fixed definition_id values in step2-generic/main.tf to match actual Airbyte Cloud registry values (faker: dfd88b22-b603-4c3d-aad7-3701784586b1, dev-null: a7bcc9d8-13b3-4e49-b80d-d020b90045e3). The original values were incorrect and caused force-replacement instead of clean moves.
  • Fixed staticcheck lint error: replaced nil context with context.Background() in test calls to MoveState().

Review & Testing Checklist for Human

  • Review migration guide changes — The docs/MIGRATION_GUIDE.md updates add a critical warning about definition_id matching. Verify the wording is clear and the terraform state show | grep definition_id command is the right approach.
  • Verify the pardot fix against the real API — The pardot test was only verified at terraform plan level (no real Pardot OAuth credentials available). A reviewer with Pardot access should terraform apply the v1-pardot-no-page-size config and confirm no 422/validation errors from phantom default values.
  • Re-run the move workflow yourself if desired — The E2E test was completed successfully, but a second run by a human would increase confidence. Follow the test plan below.
  • Note the pre-existing connection bug — The airbyte_connection resource has a bug where schedule.basic_timing and schedule.cron_expression remain unknown after apply. This is unrelated to this PR but affects the test workflow. Consider filing a separate issue.

Suggested end-to-end test plan

# 1. Build provider from this branch
go build -o terraform-provider-airbyte

# 2. Set up provider override and creds
export TF_CLI_CONFIG_FILE=./.terraformrc
set -a; source .env; set +a

# 3. Pardot test: verify plan has no v5_page_size
cd test-projects/v1-pardot-no-page-size
terraform plan  # Confirm v5_page_size is absent

# 4. Move workflow step 1: create typed resources
cd ../v1-move-workflow/step1-typed
terraform apply -auto-approve

# 5. Move workflow step 2: migrate to generic
cd ../step2-generic
cp ../step1-typed/terraform.tfstate .
terraform plan  # Should show "moved" not "destroy/create"
terraform apply -auto-approve

# 6. Cleanup
terraform destroy -auto-approve

Notes

- Go unit tests for MoveState helpers (extractJSONString, extractJSONTypesString, extractJSONInt64)
- Go unit tests verifying MoveState interface implementation for Source and Destination
- Terraform test project: pardot source without v5_page_size (validates no default sent)
- Terraform test project: typed-to-generic move workflow (step1: typed, step2: moved)

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for opening this pull request!

Your contribution is appreciated. Here are some helpful tips and resources.

💡 Show Tips and Tricks

Terraform Example Commands

  • /tf-examples project=pre-1.0 action=plan - Run terraform plan on the pre-1.0 example project
  • /tf-examples project=1.0 action=plan - Run terraform plan on the 1.0 example project
  • /tf-examples project=all action=plan - Run terraform plan on all example projects
  • /tf-examples project=pre-1.0 action=apply - Apply terraform changes to the pre-1.0 example project
  • /tf-examples project=pre-1.0 action=destroy - Destroy terraform resources in the pre-1.0 example project
📚 Show Repo Guidance

About This Repository

This repository uses Speakeasy to generate the Terraform provider from the Airbyte OpenAPI specification. The CI will automatically build the provider, validate code generation, and run acceptance tests across Terraform versions 1.0-1.4.

Note: This is a generated codebase. Direct modifications to generated files are not accepted - changes must be made to the upstream OpenAPI spec.

📝 Edit this welcome message.

devin-ai-integration Bot and others added 3 commits February 10, 2026 20:24
…iccheck

Co-Authored-By: AJ Steers <aj@airbyte.io>
…lues

Co-Authored-By: AJ Steers <aj@airbyte.io>
…plan verification

Co-Authored-By: AJ Steers <aj@airbyte.io>
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.

2 participants