Skip to content

Commit ca59e01

Browse files
author
wuxianrong
committed
add consostency go test
1 parent 1e131ea commit ca59e01

6 files changed

Lines changed: 864 additions & 1 deletion

File tree

.github/workflows/pika.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ jobs:
127127
chmod +x integrate_test.sh
128128
sh integrate_test.sh
129129
130+
# Raft Consistency Tests (optional - requires raft-enabled build)
131+
- name: Start Raft Cluster
132+
working-directory: ${{ github.workspace }}/build
133+
continue-on-error: true
134+
run: |
135+
chmod +x ../tests/integration/start_raft_cluster.sh
136+
../tests/integration/start_raft_cluster.sh || echo "Raft cluster start skipped or failed (may not be supported in this build)"
137+
138+
- name: Run Raft Consistency Tests
139+
working-directory: ${{ github.workspace }}/build
140+
continue-on-error: true
141+
run: |
142+
cd ../tests/integration/raft/
143+
go mod init raft-test 2>/dev/null || true
144+
go mod tidy
145+
go test -v -timeout 30m || echo "Raft consistency tests skipped or failed"
146+
130147
build_on_rocky:
131148
runs-on: ubuntu-latest
132149
container:
@@ -344,6 +361,23 @@ jobs:
344361
chmod +x integrate_test.sh
345362
sh integrate_test.sh
346363
364+
# Raft Consistency Tests (optional - requires raft-enabled build)
365+
- name: Start Raft Cluster
366+
working-directory: ${{ github.workspace }}/build
367+
continue-on-error: true
368+
run: |
369+
chmod +x ../tests/integration/start_raft_cluster.sh
370+
../tests/integration/start_raft_cluster.sh || echo "Raft cluster start skipped or failed (may not be supported in this build)"
371+
372+
- name: Run Raft Consistency Tests
373+
working-directory: ${{ github.workspace }}/build
374+
continue-on-error: true
375+
run: |
376+
cd ../tests/integration/raft/
377+
go mod init raft-test 2>/dev/null || true
378+
go mod tidy
379+
go test -v -timeout 30m || echo "Raft consistency tests skipped or failed"
380+
347381
build_on_macos:
348382

349383
runs-on: macos-14
@@ -405,6 +439,24 @@ jobs:
405439
chmod +x integrate_test.sh
406440
# sh integrate_test.sh
407441

442+
# Raft Consistency Tests (optional - requires raft-enabled build)
443+
- name: Start Raft Cluster
444+
working-directory: ${{ github.workspace }}
445+
continue-on-error: true
446+
run: |
447+
cd tests/integration/
448+
chmod +x start_raft_cluster.sh
449+
./start_raft_cluster.sh || echo "Raft cluster start skipped or failed (may not be supported in this build)"
450+
451+
- name: Run Raft Consistency Tests
452+
working-directory: ${{ github.workspace }}
453+
continue-on-error: true
454+
run: |
455+
cd tests/integration/raft/
456+
go mod init raft-test 2>/dev/null || true
457+
go mod tidy
458+
go test -v -timeout 30m || echo "Raft consistency tests skipped or failed"
459+
408460
build_pika_image:
409461
name: Build Pika Docker image
410462
runs-on: ubuntu-latest

conf/pika.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ internal-used-unfinished-full-sync :
640640
# Enable Raft consensus protocol for distributed consensus
641641
# When enabled, Pika will use Raft to ensure data consistency across nodes
642642
# Default value is no
643-
raft-enabled : no
643+
raft-enabled : yes
644644

645645
# Raft group identifier
646646
# This is used to identify the Raft cluster

tests/integration/main_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ func TestPikaWithoutCache(t *testing.T) {
3030
RegisterFailHandler(Fail)
3131
RunSpecs(t, "Pika integration test without cache")
3232
}
33+
34+
// Note: TestRaftConsistency is now in a separate package (tests/integration/raft)
35+
// Run Raft consistency tests with:
36+
// cd tests/integration/raft && go test -v -timeout 30m

0 commit comments

Comments
 (0)