Skip to content

Commit 815637d

Browse files
authored
Go fixes (#62)
Fixes: - missing test workflow for CI testing - Page endpoint test which was failing
2 parents 741f00e + 0b18e52 commit 815637d

2 files changed

Lines changed: 36 additions & 7 deletions

File tree

.github/workflows/go-tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Go Tests
2+
3+
# Security: grants only the minimal scopes required.
4+
permissions:
5+
contents: read
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- "go/**"
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v6
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: "1.24"
24+
cache-dependency-path: go/go.sum
25+
26+
# Runs test with shuffle and count to expose flaky tests.
27+
- name: Run tests
28+
working-directory: go
29+
run: go test -count=5 -shuffle=on ./...

go/client_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,22 @@ func TestClient_GetLatestReport(t *testing.T) {
160160
}
161161

162162
func TestClient_GetReportPage(t *testing.T) {
163-
expectedInitialTS := uint64(1234567891)
163+
expectedInitialTS := uint64(1234567890)
164164

165165
expectedReportPage1 := &ReportPage{
166166
Reports: []*ReportResponse{
167-
{FeedID: feed1, FullReport: hexutil.Bytes(`report1 payload`)},
168-
{FeedID: feed1, FullReport: hexutil.Bytes(`report2 payload`)},
167+
{FeedID: feed1, ObservationsTimestamp: 1234567890, FullReport: hexutil.Bytes(`report1 payload`)},
168+
{FeedID: feed1, ObservationsTimestamp: 1234567891, FullReport: hexutil.Bytes(`report2 payload`)},
169169
},
170-
NextPageTS: 1234567899,
170+
NextPageTS: 1234567892,
171171
}
172172

173173
expectedReportPage2 := &ReportPage{
174174
Reports: []*ReportResponse{
175-
{FeedID: feed1, FullReport: hexutil.Bytes(`report3 payload`)},
176-
{FeedID: feed1, FullReport: hexutil.Bytes(`report4 payload`)},
175+
{FeedID: feed1, ObservationsTimestamp: 1234567892, FullReport: hexutil.Bytes(`report3 payload`)},
176+
{FeedID: feed1, ObservationsTimestamp: 1234567893, FullReport: hexutil.Bytes(`report4 payload`)},
177177
},
178-
NextPageTS: 1234567999,
178+
NextPageTS: 1234567894,
179179
}
180180

181181
ms := newMockServer(func(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)