Skip to content

test(fixture): derive the ProjectFixture profile name from a uuid - #161

Merged
ehennestad merged 1 commit into
devfrom
make-project-fixture-profile-name-unique
Nov 6, 2026
Merged

ehennestad merged 1 commit into
devfrom
make-project-fixture-profile-name-unique

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

nansen.fixture.ProjectFixture creates a NANSEN user profile under prefdir, a folder shared by every MATLAB process on the machine, and named it sprintf('test%d', randi(999)). A fresh MATLAB process always starts from the same default RNG seed, so two test processes that start at the same time draw the same number and share one profile folder.

With a shared profile, the second process fails in nansen.mock.createMockProject with "A project with name MockProject already exists", and the first process's teardown then removes the profile folder underneath the second, which fails again in its own teardown with "Cannot create 'project_catalog.mat' because '.../Nansen/test814/projects' does not exist".

The profile name is now sprintf('test_%s', nansen.util.getuuid()), which is unique per process and per fixture instance. The test prefix stays so leftover profiles remain recognisable. The teardown is unchanged, and nothing else in code/ or tests/ depends on the test<number> form.

🤖 Generated with Claude Code

ProjectFixture creates a NANSEN user profile under prefdir, a folder
shared by every MATLAB process on the machine, and named it
sprintf('test%d', randi(999)). A fresh MATLAB process always starts
from the same default RNG seed, so two test processes that start
together draw the same number and share one profile folder: the
second one fails in nansen.mock.createMockProject with "A project
with name MockProject already exists", and the first one's teardown
then removes the shared folder underneath the second, which fails
again in its own teardown.

The name is now sprintf('test_%s', nansen.util.getuuid()), unique per
process and per fixture instance. The "test" prefix stays so leftover
profiles remain recognisable. The teardown is unchanged, and nothing
else in code/ or tests/ depends on the test<number> form.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

407 tests   407 ✅  43s ⏱️
 31 suites    0 💤
  1 files      0 ❌

Results for commit 7ad918d.

@ehennestad

Copy link
Copy Markdown
Collaborator Author

Review

Verdict: ready to merge. No findings.

  • nansen.util.getuuid returns a 36-character uuid with hyphens. The profile name is used only as a folder name under prefdir/Nansen (NansenUserSession.getPrefdir) and in string comparisons in NansenUserSession.instance, so the hyphens are safe.
  • No code in code/, tests/, tools/ or .github/ matches the old test<number> form.
  • CI passed on 7ad918d.

Merge note: #127, #121 and #126 also edit tests/+nansen/+fixture/ProjectFixture.m. Each needs a rebase after this PR merges.

🤖 Generated with Claude Code

@ehennestad
ehennestad merged commit fde5162 into dev Nov 6, 2026
5 checks passed
@ehennestad
ehennestad deleted the make-project-fixture-profile-name-unique branch November 8, 2026 16:37
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