fix: make action acceptance test idempotent#70
Merged
Conversation
Add pre-test cleanup for dangling webhooks in TestAccActionResource_basic. When sharing a single smoke-test project, a previous failed test run can leave a webhook behind, causing subsequent runs to fail with "Hook Already Exists". The cleanup detects and removes the dangling webhook before the test creates a new one.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds pre-test cleanup to TestAccActionResource_basic to make the test idempotent when reusing a shared smoke-test project. The cleanup function detects and removes dangling webhooks left behind by previous failed test runs, preventing "Hook Already Exists" errors that cause test failures.
Changes:
- Added
cleanupDanglingWebhookhelper function to detect and remove test webhooks before test execution - Modified
TestAccActionResource_basicPreCheck to call the cleanup function - Added explicit webhook URL and hook path variables for the test
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Derive config path segments from hookPath parameter instead of hardcoding - Add nil check after map lookups to prevent panic on missing segments - Remove only the matching webhook, preserving other hooks at the same path
Demonsthere
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add pre-test cleanup for dangling webhooks in
TestAccActionResource_basic. When sharing a single smoke-test project, a previous failed test run can leave a webhook behind, causing subsequent runs to fail with "Hook Already Exists".The cleanup function:
This makes the test resilient to previous failures without changing any resource logic.
Related Issues
Fixes flaky
TestAccActionResource_basicin CI (observed on PRs #68 and #69).Type of Change
Checklist
make test)make format)Testing
Screenshots/Output
With dangling webhook (cleanup in action):
Without dangling webhook (normal run):