test: isolates temp test fixtures (#1569)

## Motivation and Context

Replace shared temp paths with `t.TempDir()`` so each test gets its own
cleanup-scoped directory.
- This avoids leftover files and cross-test interference. No production
code changed.

## How Has This Been Tested?

GitHub CI passed.
- https://github.com/yowainwright/registry/pull/1

## Breaking Changes

No breaking changes; just tests.

## Types of changes

- [x] chore

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [x] I have added or updated documentation as needed

## Additional context

Small test-only cleanup. No production code paths are changed.

Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>
This commit is contained in:
Jeff Wainwright 2026-09-05 14:31:12 -07:00 • committed by GitHub
commit dd4b2939e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -95,9 +95,7 @@ func SetupTestToken(t *testing.T, registryURL, token string) string {
func CreateTestServerJSON(t *testing.T, serverJSON apiv0.ServerJSON) (string, string) {
t.Helper()
tempDir, err := os.MkdirTemp("", "mcp-publisher-test")
require.NoError(t, err)
t.Cleanup(func() { os.RemoveAll(tempDir) })
tempDir := t.TempDir()
jsonData, err := json.MarshalIndent(serverJSON, "", " ")
require.NoError(t, err)