Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cob: mutable stable time for testing
Merged fintohaps opened 1 year ago

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.

fintohaps opened with revision bda48846 on base ccc0297b +110 -19 1 year ago

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.

fintohaps pushed revision 2 114e9e90 on base ccc0297b +111 -19 1 year ago

Changes:

  • Use thread_local!
  • Replace RwLock with Cell
  • Have the Step be internal, since it can be per-thread
did:key:z6MksFqX...wzpT pushed revision 3 94db14f8 on base 259adf7d +0 -0 1 year ago

Rebase.

did:key:z6MksFqX...wzpT merged revision 94db14f8 at 259adf7d 1 year ago