Skip to content

Commit

Permalink
Add unit tests for domain manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll committed Oct 22, 2024
1 parent 675049b commit 35bf9fd
Show file tree
Hide file tree
Showing 5 changed files with 828 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/persistence/client/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (f *factoryImpl) NewDomainManager() (p.DomainManager, error) {
if err != nil {
return nil, err
}
result := p.NewDomainManagerImpl(store, f.logger)
result := p.NewDomainManagerImpl(store, f.logger, p.NewPayloadSerializer())
if errorRate := f.config.ErrorInjectionRate(); errorRate != 0 {
result = errorinjectors.NewDomainManager(result, errorRate, f.logger)
}
Expand Down
2 changes: 1 addition & 1 deletion common/persistence/data_store_interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/uber/cadence/common/types"
)

//go:generate mockgen -package $GOPACKAGE -destination data_store_interfaces_mock.go -self_package github.com/uber/cadence/common/persistence github.com/uber/cadence/common/persistence ExecutionStore,ShardStore
//go:generate mockgen -package $GOPACKAGE -destination data_store_interfaces_mock.go -self_package github.com/uber/cadence/common/persistence github.com/uber/cadence/common/persistence ExecutionStore,ShardStore,DomainStore
//go:generate mockgen -package $GOPACKAGE -destination visibility_store_mock.go -self_package github.com/uber/cadence/common/persistence github.com/uber/cadence/common/persistence VisibilityStore

type (
Expand Down
153 changes: 152 additions & 1 deletion common/persistence/data_store_interfaces_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ type (
}
)

var _ DomainManager = (*domainManagerImpl)(nil)

// NewDomainManagerImpl returns new DomainManager
func NewDomainManagerImpl(persistence DomainStore, logger log.Logger) DomainManager {
func NewDomainManagerImpl(persistence DomainStore, logger log.Logger, serializer PayloadSerializer) DomainManager {
return &domainManagerImpl{
serializer: NewPayloadSerializer(),
serializer: serializer,
persistence: persistence,
logger: logger,
}
Expand Down Expand Up @@ -168,6 +166,7 @@ func (m *domainManagerImpl) ListDomains(
FailoverNotificationVersion: d.FailoverNotificationVersion,
PreviousFailoverVersion: d.PreviousFailoverVersion,
NotificationVersion: d.NotificationVersion,
LastUpdatedTime: d.LastUpdatedTime.UnixNano(),
}
if d.FailoverEndTime != nil {
currResp.FailoverEndTime = common.Int64Ptr(d.FailoverEndTime.UnixNano())
Expand Down
Loading

0 comments on commit 35bf9fd

Please sign in to comment.