Skip to content

fix: fixed failing tests and commercetools-mock image#638

Merged
demeyerthom merged 1 commit intomainfrom
fix/mock-service
Mar 24, 2026
Merged

fix: fixed failing tests and commercetools-mock image#638
demeyerthom merged 1 commit intomainfrom
fix/mock-service

Conversation

@demeyerthom
Copy link
Copy Markdown
Member

This pull request introduces several improvements and cleanups to the development workflow, test infrastructure, and documentation for the terraform-provider-commercetools project. The most significant changes include the addition of a comprehensive engineering guide (AGENTS.md), updates to the mock server version, improvements to test assertions, and the removal of legacy VSCode configuration files. There are also minor fixes to acceptance test handling and Taskfile/test commands.

Documentation and Developer Experience:

  • Added a detailed engineering guide in AGENTS.md, covering project architecture, build/test commands, code style, naming conventions, resource/test patterns, and utility functions to help onboard and guide contributors.

Test Infrastructure and Workflow:

  • Updated the commercetools mock server image to version 3.0.0-beta.1 in both docker-compose.yaml and GitHub Actions workflow, ensuring a consistent and up-to-date test environment. [1] [2]
  • Improved test assertion logic in TestAccChannel_AllFields to use granular field checks with assert.EqualValues and assert.NotNil, making test failures easier to diagnose and increasing test robustness. [1] [2]
  • Fixed acceptance test enablement logic to properly parse TF_ACC as a boolean, preventing accidental test runs or skips due to string comparison errors. [1] [2] [3]
  • Changed the test and testacc commands in Taskfile.yml to use go test ./... (removing -v for less noisy output) and switched from docker-compose to docker compose for better compatibility. [1] [2]

Code and Test Cleanups:

  • Removed .vscode/launch.json and .vscode/settings.json files, cleaning up legacy editor configurations that are now superseded by Taskfile and environment variable documentation. [1] [2]
  • In resource_shipping_method.go, ensured ZoneRates is always set to an empty array to prevent API errors when no shipping rates are present at creation.
  • Minor fix in TestAccProjectCreate_basic to assert the correct business unit configuration status rather than checking for nil.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the provider’s dev/test workflow and acceptance test infrastructure, including documentation for contributors and consistency improvements across local and CI environments.

Changes:

  • Add an engineering guide (AGENTS.md) describing architecture, conventions, and workflows.
  • Update acceptance test enablement (TF_ACC) parsing and refine acceptance test assertions.
  • Standardize test + mock-server tooling (docker compose usage, mock image tag, quieter go test output) and remove legacy VS Code configs.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/resources/project/resource_test.go Adjusts an acceptance assertion for business unit config status.
internal/acctest/acctest.go Parses TF_ACC as a boolean to enable acceptance tests more reliably.
docker-compose.yaml Pins commercetools mock-server image to 3.0.0-beta.1.
commercetools/resource_shipping_method.go Sets ZoneRates to an empty slice to avoid API errors on create.
commercetools/resource_channel_test.go Replaces whole-struct equality with more granular assertions.
Taskfile.yml Switches to docker compose, reduces verbosity in test commands, and tweaks teardown.
AGENTS.md Adds detailed engineering documentation for the repo.
.vscode/settings.json Removed legacy editor-specific configuration.
.vscode/launch.json Removed legacy editor-specific configuration.
.gitignore Ignores /.vscode moving forward.
.github/workflows/tests.yaml Aligns CI mock image tag and reduces go test verbosity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/resources/project/resource_test.go Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
@demeyerthom demeyerthom merged commit 0c1d732 into main Mar 24, 2026
2 checks passed
@demeyerthom demeyerthom deleted the fix/mock-service branch March 24, 2026 11:08
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