Skip to content

Add test coverage for RegisterEtcdMemberReverter error handling#7

Closed
Copilot wants to merge 4 commits into
KU-4853/join-revertfrom
copilot/sub-pr-6
Closed

Add test coverage for RegisterEtcdMemberReverter error handling#7
Copilot wants to merge 4 commits into
KU-4853/join-revertfrom
copilot/sub-pr-6

Conversation

Copilot AI commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Addresses review feedback requesting test coverage for RegisterEtcdMemberReverter cleanup logic with 3+ endpoints, including error handling scenarios.

Changes

  • Extended snap mock with EtcdClientErr field to enable testing etcd client creation failures
  • Added test cases:
    • TestRegisterEtcdMemberReverter_ClientCreationFailure: Verifies directory preservation when client creation fails (3+ endpoints)
    • TestRegisterEtcdMemberReverter_Success: Verifies no cleanup occurs on successful joins
  • Documented limitations: Full RemoveNodeByName success/failure testing requires integration tests with real etcd, as etcd.Client embeds concrete types rather than interfaces

Test Coverage

Scenario Endpoints Behavior Coverage
Quorum protection <3 Skip cleanup ✅ (existing)
Client creation fails ≥3 Preserve directory ✅ (new)
Successful join ≥3 No cleanup ✅ (new)
RemoveNodeByName success/failure ≥3 Remove/preserve directory ⚠️ Requires integration testing

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

louiseschmidtgen and others added 2 commits January 27, 2026 13:58
Signed-off-by: Louise K. Schmidtgen <louise.schmidtgen@canonical.com>
Copilot AI and others added 2 commits January 27, 2026 12:38
- Extended snap mock to support EtcdClient error scenarios
- Added test for etcd client creation failure handling
- Added test for successful join scenario (reverter doesn't run)
- Tests verify directory is preserved when client creation fails
- Tests verify directory is preserved on successful joins

Co-authored-by: louiseschmidtgen <107889048+louiseschmidtgen@users.noreply.github.com>
Address code review feedback to remove defer reverter.Fail()
since reverter.Success() is explicitly called and clears hooks.

Co-authored-by: louiseschmidtgen <107889048+louiseschmidtgen@users.noreply.github.com>

Copilot AI commented Jan 27, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • git.launchpad.net
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED -fdiagnostics-color=never -I 943/shared/validate /tmp/cgo-gcc-input-1051203583.c 0.1-go1.25.5.lin-I te3@v1.14.33 | true mpile 0.1-go1.25.5.lingzip -d -qui�� t.go 0.1-go1.25.5.linGOAMD64_v1 0.1-go1.25.5.lin-o /tmp/go-build156/usr/libexec/gcc/x86_64-linux-gnu/13/cc1 -imultiarch mpile 0.1-go1.25.5.lin/tmp/go-build1566532710/b1199/ (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] WIP: Address feedback on node join reverter implementation Add test coverage for RegisterEtcdMemberReverter error handling Jan 27, 2026
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