-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from redpanda-data/nv/write-caching
verifier: tolerate data loss
- Loading branch information
Showing
14 changed files
with
473 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: {} | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [ 'stable' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Display Go version | ||
run: go version | ||
- name: Test & Build | ||
run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ kgo-repeater | |
kgo-verifier | ||
valid_offsets*.json | ||
|
||
.idea | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package util_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/redpanda-data/kgo-verifier/pkg/util" | ||
) | ||
|
||
func TestLoopStateDefault(t *testing.T) { | ||
s := util.NewLoopState(false) | ||
if !s.Next() { | ||
t.Error("Next must returns true on first pass") | ||
} | ||
if s.Next() { | ||
t.Error("Next must return false after first pass") | ||
} | ||
} | ||
|
||
func TestLoopStateDoLoop(t *testing.T) { | ||
s := util.NewLoopState(true) | ||
for i := 0; i < 3; i++ { | ||
if !s.Next() { | ||
t.Error("Next must return true as long as Loop is set to true") | ||
} | ||
} | ||
s.RequestLastPass() | ||
if !s.Next() { | ||
t.Error("Next must return true after RequestLastPass") | ||
} | ||
if s.Next() { | ||
t.Error("Next must return false after RequestLastPass") | ||
} | ||
|
||
func() { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
t.Error("Next must panic after RequestLastPass and third Next call") | ||
} | ||
}() | ||
s.Next() | ||
}() | ||
} | ||
|
||
func TestLoopStateDoLoopStopImmediately(t *testing.T) { | ||
s := util.NewLoopState(true) | ||
s.RequestLastPass() | ||
if !s.Next() { | ||
t.Error("Next must return true after RequestLastPass") | ||
} | ||
if s.Next() { | ||
t.Error("Next must return false after RequestLastPass") | ||
} | ||
|
||
func() { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
t.Error("Next must panic after RequestLastPass and third Next call") | ||
} | ||
}() | ||
s.Next() | ||
}() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.