- Notifications
You must be signed in to change notification settings - Fork4
PermalinkChoose a base ref {{ refName }}default Choose a head ref {{ refName }}default
Comparing changes
Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also orlearn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also.Learn more about diff comparisons here.
base repository:coder/quartz
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
Uh oh!
There was an error while loading.Please reload this page.
base:v0.1.3
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}defaultLoading
...
head repository:coder/quartz
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
Uh oh!
There was an error while loading.Please reload this page.
compare:v0.2.0
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}defaultLoading
- 3commits
- 4files changed
- 1contributor
Commits on May 23, 2025
feat: fail test on trapped but unreleased calls (#15)
part of#13Will fail test with an error message if you trap a call and don't release it.I've also added 2 test cases to the unit test.One is a skipped test that you can unskip to see what it looks like if you don't release the trapped call.One tests what happens if two different traps catch the same call. It gets a little awkward because when you `Release()` the call, it waits for the call to complete. One of the main purposes is to ensure that a timer or ticker is set, and if we don't wait for the call to complete, you can't ensure the timer is set before you advance the clock. The awkward consequence is that the `Release()` calls will deadlock if they happen on the same goroutine because _all_ traps have to release the call before it will return.We separate out the trapping of the call and releasing of the call so that you have a chance to manipulate the clock before the call returns. But, actually, there are really 3 phases to a trapped call:1. Call is trapped2. All traps released, we get the time and do the work (e.g. actually setting the timer)3. Call completesAfter `trap.Wait()` returns, we know phase 1 is complete. But, `Release()` actually conflates phase 2 and 3, so there is no way to release the trap without waiting for phase 3.Generally we don't care that much about the distinction, it's really only in the case of multple traps that you'd need to release without waiting to avoid the deadlock.We could make those phases explicit: `trap.Wait().Release().WaitForComplete()`, but that seems pretty involved for what I think is generally an edge case.WDYT?
feat: log clock calls, traps, time advancement (#16)
fixes#13Adds logging of traps, calls, and advancing the clock like:```=== CONT Test_MultipleTraps mock.go:438: Mock Clock - Trap Now(..., [0]) mock.go:438: Mock Clock - Trap Now(..., [1]) mock.go:200: Mock Clock - Now([0 1]) call, matched 2 traps mock_test.go:340: Mock Clock - Advance(1s) mock_test.go:350: Mock Clock - Advance(1s) mock.go:200: Mock Clock - Now([end]) call, matched 0 traps```This should make it easier to debug a variety of issues, including not setting the trap before the call happens.
!feat: Call.Release takes context; add MustRelease (#17)
**BREAKING CHANGE**Adds a `context.Context` to `(*Call.).Release()` and a new `MustRelease()`, since releasing a call can be blocking. Use like```err := call.Release(ctx)if err != nil { t.Error(err.Error())}```or more succinctly```call.MustRelease(ctx)```This, combined with a per-test timeout context, should make it much easier to debug issues if you have a call that gets trapped by more than one trap.
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:git diff v0.1.3...v0.2.0
Uh oh!
There was an error while loading.Please reload this page.