@@ -69,18 +69,26 @@ var workloadCmd = &cobra.Command{
6969 // and verifies that the cluster is strict serializable.
7070 sig := make (chan os.Signal , 1 )
7171 signal .Notify (sig , syscall .SIGINT , syscall .SIGTERM )
72+ var iterations int
7273 for {
7374 select {
7475 case <- sig :
7576 os .Exit (0 )
7677 default :
77- exerciseAndVerify (logger , addrs , checkTimeout , artifactDir )
78+ exerciseAndVerify (iterations , logger , addrs , checkTimeout , artifactDir )
79+ iterations ++
7880 }
7981 }
8082 },
8183}
8284
83- func exerciseAndVerify (logger * slog.Logger , addrs []net.Addr , timeout time.Duration , artifactDir string ) {
85+ func exerciseAndVerify (
86+ iteration int ,
87+ logger * slog.Logger ,
88+ addrs []net.Addr ,
89+ timeout time.Duration ,
90+ artifactDir string ,
91+ ) {
8492 seeds := []uint64 {rand .Uint64 (), rand .Uint64 ()}
8593 logger = logger .With ("pcg_seeds" , seeds , "cluster_addrs" , addrs )
8694
@@ -105,6 +113,15 @@ func exerciseAndVerify(logger *slog.Logger, addrs []net.Addr, timeout time.Durat
105113 logger .Debug ("generating new workload" )
106114 r := rand .New (rand .NewPCG (seeds [0 ], seeds [1 ]))
107115 workloads := proptest .GenWorkloads (r )
116+ // In each test run, start without concurrency. This is purely for
117+ // demonstration purposes - real workloads don't need this!
118+ const serialIterations = 128
119+ if iteration < serialIterations && len (workloads ) > 1 {
120+ workloads = workloads [:1 ]
121+ }
122+ if iteration == serialIterations {
123+ logger .Info ("allowing concurrent workloads" )
124+ }
108125
109126 // Run the workload, recording the timing and result of each operation. To
110127 // maximize concurrent work, we block each client until all the clients are
0 commit comments