Skip to content

test: fix context deletion test setup and assert config cleanup#385

Open
Syedowais312 wants to merge 1 commit into
microcks:masterfrom
Syedowais312:fix/context-test
Open

test: fix context deletion test setup and assert config cleanup#385
Syedowais312 wants to merge 1 commit into
microcks:masterfrom
Syedowais312:fix/context-test

Conversation

@Syedowais312
Copy link
Copy Markdown

Summary

This PR fixes TestDeleteContext in cmd/context_test.go.

The test previously wrote to ./testdata/local.config, but cmd/testdata/ does not exist in the repository, causing go test ./cmd to fail before exercising the actual
context deletion logic.

Changes

  • replace the hardcoded ./testdata/local.config path with a file under t.TempDir()
  • keep the test isolated from repository-local filesystem state
  • add an assertion for the last-context deletion path:
    • ReadLocalConfig() returns nil
    • the config file is removed from disk

Why

This makes the test reliable and covers the localCfg.IsEmpty() branch in deleteContext().

Verification

go test ./cmd

Previous Failure
Screenshot from 2026-05-14 23-11-59

Signed-off-by: syedowais312 <syedowais312sf@gmail.com>
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.

1 participant