The radicle-cob crate provides a feature flag, stable-commit-ids to allow
for Oids to remain stable for testing by always using the same author and
timestamp when creating commits.
This can be an issue when it interplays with COB related tests that are relying
on the ordering for the DAG walk. If the Oid values change and get re-ordered
then the test will fail. The DAG for COBs are now ordered via the Oid and
Timestamp, so in this change a global RwLock is introduced for the timestamp
so that callers can mutate it while testing.
The lock can be read using read_timestamp, and with_advanced_timestamp can
be used during a test to perform an action, advancing a step counter after it
has finished. The global value is then reset to try to ensure that the global
value stays the same for all other tests.
The radicle-cob crate provides a feature flag, stable-commit-ids to allow
for Oids to remain stable for testing by always using the same author and
timestamp when creating commits.
This can be an issue when it interplays with COB related tests that are relying
on the ordering for the DAG walk. If the Oid values change and get re-ordered
then the test will fail. The DAG for COBs are now ordered via the Oid and
Timestamp, so in this change a global RwLock is introduced for the timestamp
so that callers can mutate it while testing.
The lock can be read using read_timestamp, and with_advanced_timestamp can
be used during a test to perform an action, advancing a step counter after it
has finished. The global value is then reset to try to ensure that the global
value stays the same for all other tests.
Changes:
- Use
thread_local! - Replace
RwLockwithCell - Have the
Stepbe internal, since it can be per-thread
Rebase.