Skip to content

Commit

Permalink
fix: check order
Browse files Browse the repository at this point in the history
Signed-off-by: Clément Salaün <[email protected]>
  • Loading branch information
altitude committed Jul 11, 2024
1 parent 959c1bc commit 4435d5e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions workload/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"math"
"math/big"
"os"

"github.com/alitto/pond"
"github.com/antithesishq/antithesis-sdk-go/assert"
Expand Down Expand Up @@ -49,22 +50,23 @@ func runWorkload(ctx context.Context, client *sdk.Formance) {
}

idSeq.Register(id)

err = idSeq.Check()
assert.Always(err == nil, "IDSeq check should pass", Details{
"count": idSeq.Count,
"sum": idSeq.Sum,
})

if err != nil {
hasError.CompareAndSwap(false, true)
return
}
})
}

pool.StopAndWait()

err = idSeq.Check()
assert.Always(err == nil, "IDSeq check should pass", Details{
"count": idSeq.Count,
"sum": idSeq.Sum,
})

if err != nil {
hasError.CompareAndSwap(false, true)
os.Exit(1)
return
}

cond = !hasError.Load()
if assert.Always(cond, "all transactions should have been written", Details{
"error": fmt.Sprintf("%+v\n", err),
Expand Down

0 comments on commit 4435d5e

Please sign in to comment.