Skip to content

Commit

Permalink
Refactor/adding mutable state builder tests iv (cadence-workflow#5769)
Browse files Browse the repository at this point in the history
Grinds out some tests for a fiddly function assignEventIDToBufferedEvents who's function it is is to increment the various counters and ensure that all buffered decision tasks have assigned IDs.
Adds a few minor guards for the logging functions
  • Loading branch information
davidporter-id-au authored Mar 11, 2024
1 parent 4d513c0 commit ce25878
Show file tree
Hide file tree
Showing 2 changed files with 616 additions and 12 deletions.
31 changes: 19 additions & 12 deletions service/history/execution/mutable_state_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ func NewMutableStateBuilderWithVersionHistoriesWithEventV2(
return msBuilder
}

// todo (david.porter)
func (e *mutableStateBuilder) CopyToPersistence() *persistence.WorkflowMutableState {
state := &persistence.WorkflowMutableState{}

Expand Down Expand Up @@ -4811,24 +4812,30 @@ func (e *mutableStateBuilder) unixNanoToTime(
}

func (e *mutableStateBuilder) logInfo(msg string, tags ...tag.Tag) {
tags = append(tags, tag.WorkflowID(e.executionInfo.WorkflowID))
tags = append(tags, tag.WorkflowRunID(e.executionInfo.RunID))
tags = append(tags, tag.WorkflowDomainID(e.executionInfo.DomainID))
e.logger.Info(msg, tags...)
if e != nil && e.executionInfo != nil {
tags = append(tags, tag.WorkflowID(e.executionInfo.WorkflowID))
tags = append(tags, tag.WorkflowRunID(e.executionInfo.RunID))
tags = append(tags, tag.WorkflowDomainID(e.executionInfo.DomainID))
e.logger.Info(msg, tags...)
}
}

func (e *mutableStateBuilder) logWarn(msg string, tags ...tag.Tag) {
tags = append(tags, tag.WorkflowID(e.executionInfo.WorkflowID))
tags = append(tags, tag.WorkflowRunID(e.executionInfo.RunID))
tags = append(tags, tag.WorkflowDomainID(e.executionInfo.DomainID))
e.logger.Warn(msg, tags...)
if e != nil && e.executionInfo != nil {
tags = append(tags, tag.WorkflowID(e.executionInfo.WorkflowID))
tags = append(tags, tag.WorkflowRunID(e.executionInfo.RunID))
tags = append(tags, tag.WorkflowDomainID(e.executionInfo.DomainID))
e.logger.Warn(msg, tags...)
}
}

func (e *mutableStateBuilder) logError(msg string, tags ...tag.Tag) {
tags = append(tags, tag.WorkflowID(e.executionInfo.WorkflowID))
tags = append(tags, tag.WorkflowRunID(e.executionInfo.RunID))
tags = append(tags, tag.WorkflowDomainID(e.executionInfo.DomainID))
e.logger.Error(msg, tags...)
if e != nil && e.executionInfo != nil {
tags = append(tags, tag.WorkflowID(e.executionInfo.WorkflowID))
tags = append(tags, tag.WorkflowRunID(e.executionInfo.RunID))
tags = append(tags, tag.WorkflowDomainID(e.executionInfo.DomainID))
e.logger.Error(msg, tags...)
}
}

func (e *mutableStateBuilder) logDataInconsistency() {
Expand Down
Loading

0 comments on commit ce25878

Please sign in to comment.