Skip to content

Commit

Permalink
Fix history load tests and actually run them
Browse files Browse the repository at this point in the history
Tests are now run by default (as they should be)
  • Loading branch information
tdeebswihart committed Oct 3, 2023
1 parent b7493bd commit cbe2bb4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$(VERBOSE).SILENT:
all: install test
############################# Main targets #############################
# Install everything, update submodule, and compile proto files.
install: mockgen-install goimports-install update-proto
Expand Down Expand Up @@ -36,7 +37,7 @@ update-proto-submodule:


##### Compile proto files for go #####
grpc: go-grpc fix-path fix-enums
grpc: go-grpc fix-path fix-enums copy-helpers

go-grpc: clean $(PROTO_OUT)
printf $(COLOR) "Compiling for go-gRPC..."
Expand All @@ -45,6 +46,8 @@ go-grpc: clean $(PROTO_OUT)

fix-path: go-grpc
mv -f $(PROTO_OUT)/temporal/api/* $(PROTO_OUT) && rm -rf $(PROTO_OUT)/temporal

copy-helpers:
# Also copy the payload and history JSON helpers
cp $(PROTO_OUT)/internal/temporalcommonv1/payload_json.go $(PROTO_OUT)/common/v1/
cp $(PROTO_OUT)/internal/temporalhistoryv1/load*.go $(PROTO_OUT)/history/v1/
Expand Down Expand Up @@ -100,7 +103,7 @@ gomodtidy:

##### Test #####

test:
test: copy-helpers
go test ./serviceerror/... ./proxy/... ./history/...

##### Check #####
Expand Down
6 changes: 3 additions & 3 deletions history/v1/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ type testCase struct {
func TestLoadHistoryFromJSON_Compatible(t *testing.T) {
t.Parallel()
// Ensure both new and old enums deserialize the same way
oldHist, err := history.LoadFromJSON(strings.NewReader(oldEnums))
oldHist, err := history.LoadFromJSON(strings.NewReader(oldEnums), int64(0))
if err != nil {
t.Errorf("Unexpected error loading old history json: %s", err)
}
newHist, err := history.LoadFromJSON(strings.NewReader(oldEnums))
newHist, err := history.LoadFromJSON(strings.NewReader(oldEnums), int64(0))
if err != nil {
t.Errorf("Unexpected error loading new history json: %s", err)
}
Expand All @@ -271,7 +271,7 @@ func TestLoadHistoryFromJSON_Compatible(t *testing.T) {
func TestLoadHistoryFromJSON_LastEventID(t *testing.T) {
t.Parallel()

hist, err := history.LoadFromJSON(strings.NewReader(longHistory))
hist, err := history.LoadFromJSON(strings.NewReader(longHistory), int64(0))
if err != nil {
t.Errorf("Unexpected error loading history json: %s", err)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/temporalhistoryv1/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ type testCase struct {
func TestLoadHistoryFromJSON_Compatible(t *testing.T) {
t.Parallel()
// Ensure both new and old enums deserialize the same way
oldHist, err := history.LoadFromJSON(strings.NewReader(oldEnums))
oldHist, err := history.LoadFromJSON(strings.NewReader(oldEnums), int64(0))
if err != nil {
t.Errorf("Unexpected error loading old history json: %s", err)
}
newHist, err := history.LoadFromJSON(strings.NewReader(oldEnums))
newHist, err := history.LoadFromJSON(strings.NewReader(oldEnums), int64(0))
if err != nil {
t.Errorf("Unexpected error loading new history json: %s", err)
}
Expand All @@ -271,7 +271,7 @@ func TestLoadHistoryFromJSON_Compatible(t *testing.T) {
func TestLoadHistoryFromJSON_LastEventID(t *testing.T) {
t.Parallel()

hist, err := history.LoadFromJSON(strings.NewReader(longHistory))
hist, err := history.LoadFromJSON(strings.NewReader(longHistory), int64(0))
if err != nil {
t.Errorf("Unexpected error loading history json: %s", err)
}
Expand Down

0 comments on commit cbe2bb4

Please sign in to comment.