Skip to content

fix: keep shared server config when deleting one of multiple contexts#422

Open
Syedowais312 wants to merge 1 commit into
microcks:masterfrom
Syedowais312:fix/context-delete-shared-config
Open

fix: keep shared server config when deleting one of multiple contexts#422
Syedowais312 wants to merge 1 commit into
microcks:masterfrom
Syedowais312:fix/context-delete-shared-config

Conversation

@Syedowais312
Copy link
Copy Markdown
Contributor

Summary

This fixes context deletion when multiple contexts reference the same server entry.

If the config contains a single server and multiple contexts pointing to it,
deleting one context could also remove shared metadata that was still needed by the
remaining context.

Changes

  • resolve the target context before deleting it
  • delete only the selected context
  • remove shared user, server, auth, and instance entries only when no
    remaining context references them
  • add a regression test for multiple contexts sharing one server

Reproducer

./microcks start
./microcks login http://localhost:8585 --name dev
./microcks context dev --delete

Testing

  go test ./cmd ./pkg/config

closes: #421

Signed-off-by: syedowais312 <syedowais312sf@gmail.com>
@Syedowais312 Syedowais312 force-pushed the fix/context-delete-shared-config branch from 5935b10 to 68a921e Compare May 23, 2026 21:39
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.

Deleting one context removes config when multiple contexts share a single server

1 participant