File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -75,5 +75,26 @@ coverage reports is: [gocovsh](https://github.com/orlangure/gocovsh).
75
75
76
76
### Go scheduler overlay
77
77
78
+ We took another view on testing, through the lens of [ timestone] ( https://github.com/Metamogul/timestone ) ,
78
79
80
+ > a library to create deterministic and easy-to-understand unit tests for time-dependent, concurrent go code.
81
+
82
+ It requires modification of existing code (replace go routine invocations with
83
+ timestone), but after that, tests can be run in either with the system
84
+ scheduler, i.e. [ using
85
+ goroutines] ( https://github.com/Metamogul/timestone/blob/7411decd9b3e1e28ef539e2bbb0ebb67b9e059d7/system/scheduler.go#L20-L29 )
86
+ or a [ simulation
87
+ scheduler] ( https://github.com/Metamogul/timestone/blob/7411decd9b3e1e28ef539e2bbb0ebb67b9e059d7/simulation/scheduler.go#L149-L155 ) ,
88
+ that gives the caller control over the process execution.
89
+
90
+ By default, Go programs can exhibit non-determinism in a few places, among others in:
91
+
92
+ * randomized work stealing in the [ scheduler] ( https://github.com/golang/go/blob/8e714281e441f93d2865adb3c5a507fd161314e9/src/runtime/proc.go#L7198 )
93
+ * randomized map [ iteration] ( https://github.com/golang/go/blob/8b0ac33da8574b74ba50ad727b59fa8679d93e4b/src/internal/runtime/maps/map.go#L141-L142 )
94
+ * randomized[ select clause] ( https://github.com/golang/go/blob/8e714281e441f93d2865adb3c5a507fd161314e9/src/runtime/select.go#L181 )
95
+
96
+ With [ timestone] ( https://github.com/Metamogul/timestone ) , it is possible to get
97
+ around the scheduling randomness, when this interferes with test results. Check
98
+ out some of the examples included in the library, here:
99
+ [ timestone/examples] ( https://github.com/Metamogul/timestone/tree/main/examples )
79
100
You can’t perform that action at this time.
0 commit comments