Skip to content

Commit 0ee1db7

Browse files
committed
added github workflow
1 parent c21060e commit 0ee1db7

File tree

5 files changed

+54
-28
lines changed

5 files changed

+54
-28
lines changed

.github/workflows/test.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on: [push, pull_request]
2+
name: Test
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Install Go
8+
uses: actions/setup-go@v4
9+
with:
10+
go-version: '^1.21.0'
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
- uses: actions/cache@v3
14+
with:
15+
path: ~/go/pkg/mod
16+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
17+
restore-keys: |
18+
${{ runner.os }}-go-
19+
- name: Test
20+
run: go test -coverprofile=coverage.txt -covermode=atomic -race ./...

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ lint:
99

1010
.PHONY: test
1111
test:
12-
go test -v ./...
12+
go test -coverprofile=coverage.txt -covermode=atomic -v -race ./...

benchmark/spanner_oltp.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515

1616
const (
1717
stmtSpannerPointSelects = "SELECT c FROM sbtest%d WHERE id=@Id"
18-
stmtSpannerSimpleRanges = "SELECT c FROM sbtest%d WHERE id BETWEEN %d AND %d"
19-
stmtSpannerSumRanges = "SELECT SUM(k) FROM sbtest%d WHERE id BETWEEN %d AND %d"
18+
stmtSpannerSimpleRanges = "SELECT c FROM sbtest%d WHERE id BETWEEN @Begin AND @End"
19+
stmtSpannerSumRanges = "SELECT SUM(k) FROM sbtest%d WHERE id BETWEEN @Begin AND @End"
2020
stmtSpannerOrderRanges = "SELECT c FROM sbtest%d WHERE id BETWEEN %d AND %d ORDER BY c"
2121
stmtSpannerDistinctRanges = "SELECT DISTINCT c FROM sbtest%d WHERE id BETWEEN %d AND %d ORDER BY c"
2222
stmtSpannerIndexUpdates = "UPDATE sbtest%d SET k=k+1 WHERE id=%d"
@@ -80,6 +80,19 @@ func (s *SpannerOLTP) Event(ctx context.Context) (reads uint64, writes uint64, o
8080
}
8181
numReads += 1
8282
}
83+
for i := 0; i < numSimpleRanges; i++ {
84+
begin := sbRand(0, s.opts.TableSize)
85+
stmt := spanner.Statement{
86+
SQL: fmt.Sprintf(stmtSpannerSimpleRanges, tableNum),
87+
Params: map[string]interface{}{"Begin": begin, "End": begin + rangeSize - 1},
88+
}
89+
_, err := txn.Query(ctx, stmt).Next()
90+
if err != nil && err != iterator.Done {
91+
return err
92+
}
93+
numReads += 1
94+
}
95+
8396
return nil
8497
})
8598
return numReads, 0, 0, 0, err

cmd/go-sysbench/main.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@ package main
22

33
// TODO
44
// 1. Spanner Session Pool の様子を観測する
5-
// 2. パフォーマンス差分を埋める
6-
// 2-2. thread fairness の計算
7-
// 3. SSL/ON OFF
5+
// 2. Spannerのパラメータクエリが有効化できていることを確認する
6+
// 3. SpannerのBIT_REVERSEを試す
7+
// 4. Spannerのシナリオの作成
8+
// 5. SpannerでDeadlineexceeded
89

9-
// 5. Spannerのシナリオの作成
10-
// 5-2. PostgreSQL の DSN のエスケープ
11-
// 5-3. 空振りクエリはotherにカウントする
12-
// 5-4. Spannerのパラメータクエリが有効化できていることを確認する
10+
// 10. パフォーマンス差分を埋める
11+
// 11. thread fairness の計算
1312

14-
// 6. 乱数生成をクエリを投げる前段階で行う
15-
// 11. PreparedStatement の実装
13+
// 20. SSL/ON OFF
1614

17-
// 7. README を書く
18-
// 10. カスタムシナリオを書く
15+
// 31. PostgreSQL の DSN のエスケープ
16+
// 32. 空振りクエリはotherにカウントする
17+
18+
// 41. 乱数生成をクエリを投げる前段階で行う
19+
// 42. PreparedStatement の実装
20+
21+
// 51. カスタムシナリオを書く
22+
23+
// 60. --mysql-ignore-errors のサポート
24+
25+
// 70. README を書く
1926

2027
import (
2128
"log"

runner/histogram_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package runner
22

33
import (
44
"testing"
5-
// "fmt"
65
)
76

87
func TestHistogramAdd(t *testing.T) {
@@ -43,16 +42,3 @@ func TestGetPercentile(t *testing.T) {
4342
t.Errorf("Expected 100th percentile to be 99999.0, got %f", p100)
4443
}
4544
}
46-
47-
func TestPrint(t *testing.T) {
48-
h := NewHistogram(1024, 0.001, 100000)
49-
50-
h.Add(0.002)
51-
h.Add(0.01)
52-
h.Add(0.01)
53-
h.Add(1.0)
54-
h.Add(500.0)
55-
h.Add(99999.0)
56-
57-
h.Print()
58-
}

0 commit comments

Comments
 (0)