Skip to content

Commit

Permalink
Make transcripts more deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jan 23, 2025
1 parent 6fd6220 commit 5d2aa19
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions unison-src/transcripts/idempotent/api-list-projects-branches.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
# List Projects And Branches Test

I create projects and branches in reverse alphabetical order, and starting with `z`
to place them after `main` alphabetically.
This is because the results from the listing endpoints is sorted by (timestamp, name); but
the default sqlite timestamp only has second-level precision and the transcript will sometimes
lump many of those together. Doing it this way ensures both the creation timestamp and name sort
the same direction so we don't end up with flaky non-deterministic tests.

``` ucm :hide
scratch/main> project.create-empty project-apple
scratch/main> project.create-empty project-cherry
scratch/main> project.create-empty project-banana
scratch/main> project.create-empty project-cherry
scratch/main> project.create-empty project-apple
project-apple/main> branch branch-apple
project-apple/main> branch z-branch-cherry
project-apple/main> branch branch-banana
project-apple/main> branch z-branch-banana
project-apple/main> branch branch-cherry
project-apple/main> branch z-branch-apple
```

``` api
-- Should list all projects
GET /api/projects
[
{
"activeBranchRef": "branch-cherry",
"activeBranchRef": "z-branch-apple",
"projectName": "project-apple"
},
{
Expand Down Expand Up @@ -47,23 +54,23 @@ GET /api/projects?query=bana
GET /api/projects/project-apple/branches
[
{
"branchName": "branch-apple"
"branchName": "main"
},
{
"branchName": "branch-banana"
"branchName": "z-branch-apple"
},
{
"branchName": "branch-cherry"
"branchName": "z-branch-banana"
},
{
"branchName": "main"
"branchName": "z-branch-cherry"
}
]
-- Can query for some infix of the project name
GET /api/projects/project-apple/branches?query=bana
[
{
"branchName": "branch-banana"
"branchName": "z-branch-banana"
}
]
```

0 comments on commit 5d2aa19

Please sign in to comment.