Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Fix x86 tests (#3317)
Browse files Browse the repository at this point in the history
x86 tests broke with #3298
(Not exactly the tests modified here, but
`TestMessageHistoryVisibility`)
  • Loading branch information
S7evinK authored Jan 29, 2024
1 parent 87f028d commit a3a18fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
8 changes: 4 additions & 4 deletions syncapi/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ func NewTopologyTokenFromString(tok string) (token TopologyToken, err error) {
if i > len(positions) {
break
}
var pos int
pos, err = strconv.Atoi(p)
var pos int64
pos, err = strconv.ParseInt(p, 10, 64)
if err != nil {
return
}
Expand Down Expand Up @@ -318,8 +318,8 @@ func NewStreamTokenFromString(tok string) (token StreamingToken, err error) {
if i >= len(positions) {
break
}
var pos int
pos, err = strconv.Atoi(p)
var pos int64
pos, err = strconv.ParseInt(p, 10, 64)
if err != nil {
err = ErrMalformedSyncToken
return
Expand Down
17 changes: 17 additions & 0 deletions syncapi/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package types
import (
"context"
"encoding/json"
"math"
"reflect"
"testing"

Expand Down Expand Up @@ -33,12 +34,28 @@ func TestSyncTokens(t *testing.T) {
"s3_1_0_0_0_0_2_0_5": StreamingToken{3, 1, 0, 0, 0, 0, 2, 0, 5}.String(),
"s3_1_2_3_5_0_0_0_6": StreamingToken{3, 1, 2, 3, 5, 0, 0, 0, 6}.String(),
"t3_1": TopologyToken{3, 1}.String(),
"t9223372036854775807_9223372036854775807": TopologyToken{Depth: math.MaxInt64, PDUPosition: math.MaxInt64}.String(),
"s9223372036854775807_1_2_3_5_0_0_0_6": StreamingToken{math.MaxInt64, 1, 2, 3, 5, 0, 0, 0, 6}.String(),
}

for a, b := range shouldPass {
if a != b {
t.Errorf("expected %q, got %q", a, b)
}

// parse as topology token
if a[0] == 't' {
if _, err := NewTopologyTokenFromString(a); err != nil {
t.Errorf("expected %q to pass, but got %q", a, err)
}
}

// parse as sync token
if a[0] == 's' {
if _, err := NewStreamTokenFromString(a); err != nil {
t.Errorf("expected %q to pass, but got %q", a, err)
}
}
}

shouldFail := []string{
Expand Down

0 comments on commit a3a18fb

Please sign in to comment.