Skip to content

Commit

Permalink
Switch common/testing to internal types (cadence-workflow#3793)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Dec 2, 2020
1 parent 66efd3f commit c324af8
Show file tree
Hide file tree
Showing 4 changed files with 505 additions and 503 deletions.
40 changes: 20 additions & 20 deletions common/testing/history_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

"github.com/stretchr/testify/suite"

"github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/common/types"
)

type (
Expand Down Expand Up @@ -64,21 +64,21 @@ func (s *historyEventTestSuit) Test_HistoryEvent_Generator() {

fmt.Println("########################")
for _, e := range events {
event := e.GetData().(*shared.HistoryEvent)
if maxEventID != event.GetEventId()-1 {
event := e.GetData().(*types.HistoryEvent)
if maxEventID != event.GetEventID()-1 {
s.Fail("event id sequence is incorrect")
}
maxEventID = event.GetEventId()
maxEventID = event.GetEventID()
if maxVersion > event.GetVersion() {
s.Fail("event version is incorrect")
}
maxVersion = event.GetVersion()
if maxTaskID > event.GetTaskId() {
if maxTaskID > event.GetTaskID() {
s.Fail("event task id is incorrect")
}
maxTaskID = event.GetTaskId()
maxTaskID = event.GetTaskID()
fmt.Println(e.GetName())
fmt.Println(event.GetEventId())
fmt.Println(event.GetEventID())
}
}
s.NotEmpty(s.generator.ListGeneratedVertices())
Expand All @@ -88,45 +88,45 @@ func (s *historyEventTestSuit) Test_HistoryEvent_Generator() {
events := branchGenerator1.GetNextVertices()
fmt.Println("########################")
for _, e := range events {
event := e.GetData().(*shared.HistoryEvent)
if maxEventID != event.GetEventId()-1 {
event := e.GetData().(*types.HistoryEvent)
if maxEventID != event.GetEventID()-1 {
s.Fail("event id sequence is incorrect")
}
maxEventID = event.GetEventId()
maxEventID = event.GetEventID()
if maxVersion > event.GetVersion() {
s.Fail("event version is incorrect")
}
maxVersion = event.GetVersion()
if maxTaskID > event.GetTaskId() {
if maxTaskID > event.GetTaskID() {
s.Fail("event task id is incorrect")
}
maxTaskID = event.GetTaskId()
maxTaskID = event.GetTaskID()
fmt.Println(e.GetName())
fmt.Println(event.GetEventId())
fmt.Println(event.GetEventID())
}
}
fmt.Println("==========================")
history := s.generator.ListGeneratedVertices()
maxEventID = history[len(history)-1].GetData().(*shared.HistoryEvent).GetEventId()
maxEventID = history[len(history)-1].GetData().(*types.HistoryEvent).GetEventID()
for i := 0; i < 10 && s.generator.HasNextVertex(); i++ {
events := s.generator.GetNextVertices()
fmt.Println("########################")
for _, e := range events {
event := e.GetData().(*shared.HistoryEvent)
if maxEventID != event.GetEventId()-1 {
event := e.GetData().(*types.HistoryEvent)
if maxEventID != event.GetEventID()-1 {
s.Fail("event id sequence is incorrect")
}
maxEventID = event.GetEventId()
maxEventID = event.GetEventID()
if maxVersion > event.GetVersion() {
s.Fail("event version is incorrect")
}
maxVersion = event.GetVersion()
if maxTaskID > event.GetTaskId() {
if maxTaskID > event.GetTaskID() {
s.Fail("event task id is incorrect")
}
maxTaskID = event.GetTaskId()
maxTaskID = event.GetTaskID()
fmt.Println(e.GetName())
fmt.Println(event.GetEventId())
fmt.Println(event.GetEventID())
}
}
}
Loading

0 comments on commit c324af8

Please sign in to comment.