diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml new file mode 100644 index 0000000..d829aae --- /dev/null +++ b/.github/workflows/go-tests.yml @@ -0,0 +1,29 @@ +name: Go Tests + +# Security: grants only the minimal scopes required. +permissions: + contents: read + +on: + pull_request: + paths: + - "go/**" + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + cache-dependency-path: go/go.sum + + # Runs test with shuffle and count to expose flaky tests. + - name: Run tests + working-directory: go + run: go test -count=5 -shuffle=on ./... diff --git a/go/client_test.go b/go/client_test.go index 8b86cf6..d5253c1 100644 --- a/go/client_test.go +++ b/go/client_test.go @@ -160,22 +160,22 @@ func TestClient_GetLatestReport(t *testing.T) { } func TestClient_GetReportPage(t *testing.T) { - expectedInitialTS := uint64(1234567891) + expectedInitialTS := uint64(1234567890) expectedReportPage1 := &ReportPage{ Reports: []*ReportResponse{ - {FeedID: feed1, FullReport: hexutil.Bytes(`report1 payload`)}, - {FeedID: feed1, FullReport: hexutil.Bytes(`report2 payload`)}, + {FeedID: feed1, ObservationsTimestamp: 1234567890, FullReport: hexutil.Bytes(`report1 payload`)}, + {FeedID: feed1, ObservationsTimestamp: 1234567891, FullReport: hexutil.Bytes(`report2 payload`)}, }, - NextPageTS: 1234567899, + NextPageTS: 1234567892, } expectedReportPage2 := &ReportPage{ Reports: []*ReportResponse{ - {FeedID: feed1, FullReport: hexutil.Bytes(`report3 payload`)}, - {FeedID: feed1, FullReport: hexutil.Bytes(`report4 payload`)}, + {FeedID: feed1, ObservationsTimestamp: 1234567892, FullReport: hexutil.Bytes(`report3 payload`)}, + {FeedID: feed1, ObservationsTimestamp: 1234567893, FullReport: hexutil.Bytes(`report4 payload`)}, }, - NextPageTS: 1234567999, + NextPageTS: 1234567894, } ms := newMockServer(func(w http.ResponseWriter, r *http.Request) {