Skip to content

Commit

Permalink
Bug fix: add missing filed for create/update domain on replication (#…
Browse files Browse the repository at this point in the history
…1061)

* Bug fix: add missing filed for create/update domain on replication

* fix unit tests

* fix unit tests
  • Loading branch information
longquanzheng authored Aug 21, 2018
1 parent 71e126f commit 2cf0577
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions service/frontend/domainReplicationTaskHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (domainReplicator *domainReplicatorImpl) HandleTransmissionTask(domainOpera
Status: status,
Description: common.StringPtr(info.Description),
OwnerEmail: common.StringPtr(info.OwnerEmail),
Data: info.Data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(config.Retention),
Expand Down
6 changes: 6 additions & 0 deletions service/frontend/domainReplicationTaskHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (s *domainReplicatorSuite) TestHandleTransmissionTask_RegisterDomainTask()
status := shared.DomainStatusRegistered
description := "some random test description"
ownerEmail := "some random test owner"
data := map[string]string{"k": "v"}
retention := int32(10)
emitMetric := true
clusterActive := "some random active cluster name"
Expand All @@ -100,6 +101,7 @@ func (s *domainReplicatorSuite) TestHandleTransmissionTask_RegisterDomainTask()
Status: persistence.DomainStatusRegistered,
Description: description,
OwnerEmail: ownerEmail,
Data: data,
}
config := &persistence.DomainConfig{
Retention: retention,
Expand All @@ -120,6 +122,7 @@ func (s *domainReplicatorSuite) TestHandleTransmissionTask_RegisterDomainTask()
Status: &status,
Description: common.StringPtr(description),
OwnerEmail: common.StringPtr(ownerEmail),
Data: data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
Expand All @@ -145,6 +148,7 @@ func (s *domainReplicatorSuite) TestHandleTransmissionTask_UpdateDomainTask() {
status := shared.DomainStatusDeprecated
description := "some random test description"
ownerEmail := "some random test owner"
data := map[string]string{"k": "v"}
retention := int32(10)
emitMetric := true
clusterActive := "some random active cluster name"
Expand All @@ -167,6 +171,7 @@ func (s *domainReplicatorSuite) TestHandleTransmissionTask_UpdateDomainTask() {
Status: persistence.DomainStatusDeprecated,
Description: description,
OwnerEmail: ownerEmail,
Data: data,
}
config := &persistence.DomainConfig{
Retention: retention,
Expand All @@ -187,6 +192,7 @@ func (s *domainReplicatorSuite) TestHandleTransmissionTask_UpdateDomainTask() {
Status: &status,
Description: common.StringPtr(description),
OwnerEmail: common.StringPtr(ownerEmail),
Data: data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
Expand Down
1 change: 1 addition & 0 deletions service/worker/domainReplicationTaskHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func (domainReplicator *domainReplicatorImpl) handleDomainUpdateReplicationTask(
Status: status,
Description: task.Info.GetDescription(),
OwnerEmail: task.Info.GetOwnerEmail(),
Data: task.Info.Data,
}
request.Config = &persistence.DomainConfig{
Retention: task.Config.GetWorkflowExecutionRetentionPeriodInDays(),
Expand Down
23 changes: 23 additions & 0 deletions service/worker/domainReplicationTaskHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_RegisterDomainTask() {
status := shared.DomainStatusRegistered
description := "some random test description"
ownerEmail := "some random test owner"
data := map[string]string{"k": "v"}
retention := int32(10)
emitMetric := true
clusterActive := "some random active cluster name"
Expand All @@ -100,6 +101,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_RegisterDomainTask() {
Status: &status,
Description: common.StringPtr(description),
OwnerEmail: common.StringPtr(ownerEmail),
Data: data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
Expand Down Expand Up @@ -127,6 +129,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_RegisterDomainTask() {
s.Equal(persistence.DomainStatusRegistered, resp.Info.Status)
s.Equal(description, resp.Info.Description)
s.Equal(ownerEmail, resp.Info.OwnerEmail)
s.Equal(data, resp.Info.Data)
s.Equal(retention, resp.Config.Retention)
s.Equal(emitMetric, resp.Config.EmitMetric)
s.Equal(clusterActive, resp.ReplicationConfig.ActiveClusterName)
Expand Down Expand Up @@ -214,6 +217,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
status := shared.DomainStatusRegistered
description := "some random test description"
ownerEmail := "some random test owner"
data := map[string]string{"k": "v"}
retention := int32(10)
emitMetric := true
clusterActive := "some random active cluster name"
Expand All @@ -237,6 +241,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
Status: &status,
Description: common.StringPtr(description),
OwnerEmail: common.StringPtr(ownerEmail),
Data: data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
Expand All @@ -258,6 +263,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
updateStatus := shared.DomainStatusDeprecated
updateDescription := "other random domain test description"
updateOwnerEmail := "other random domain test owner"
updatedData := map[string]string{"k": "v1"}
updateRetention := int32(122)
updateEmitMetric := true
updateClusterActive := "other random active cluster name"
Expand All @@ -280,6 +286,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
Status: &updateStatus,
Description: common.StringPtr(updateDescription),
OwnerEmail: common.StringPtr(updateOwnerEmail),
Data: updatedData,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(updateRetention),
Expand All @@ -305,6 +312,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
s.Equal(persistence.DomainStatusDeprecated, resp.Info.Status)
s.Equal(updateDescription, resp.Info.Description)
s.Equal(updateOwnerEmail, resp.Info.OwnerEmail)
s.Equal(updatedData, resp.Info.Data)
s.Equal(updateRetention, resp.Config.Retention)
s.Equal(updateEmitMetric, resp.Config.EmitMetric)
s.Equal(updateClusterActive, resp.ReplicationConfig.ActiveClusterName)
Expand All @@ -322,6 +330,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
status := shared.DomainStatusRegistered
description := "some random test description"
ownerEmail := "some random test owner"
data := map[string]string{"k": "v"}
retention := int32(10)
emitMetric := true
clusterActive := "some random active cluster name"
Expand All @@ -345,6 +354,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
Status: &status,
Description: common.StringPtr(description),
OwnerEmail: common.StringPtr(ownerEmail),
Data: data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
Expand All @@ -366,6 +376,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
updateStatus := shared.DomainStatusDeprecated
updateDescription := "other random domain test description"
updateOwnerEmail := "other random domain test owner"
updateData := map[string]string{"k": "v2"}
updateRetention := int32(122)
updateEmitMetric := true
updateClusterActive := "other random active cluster name"
Expand All @@ -388,6 +399,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
Status: &updateStatus,
Description: common.StringPtr(updateDescription),
OwnerEmail: common.StringPtr(updateOwnerEmail),
Data: updateData,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(updateRetention),
Expand All @@ -413,6 +425,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_UpdateC
s.Equal(persistence.DomainStatusDeprecated, resp.Info.Status)
s.Equal(updateDescription, resp.Info.Description)
s.Equal(updateOwnerEmail, resp.Info.OwnerEmail)
s.Equal(updateData, resp.Info.Data)
s.Equal(updateRetention, resp.Config.Retention)
s.Equal(updateEmitMetric, resp.Config.EmitMetric)
s.Equal(clusterActive, resp.ReplicationConfig.ActiveClusterName)
Expand All @@ -430,6 +443,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
status := shared.DomainStatusRegistered
description := "some random test description"
ownerEmail := "some random test owner"
data := map[string]string{"k": "v"}
retention := int32(10)
emitMetric := true
clusterActive := "some random active cluster name"
Expand All @@ -453,6 +467,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
Status: &status,
Description: common.StringPtr(description),
OwnerEmail: common.StringPtr(ownerEmail),
Data: data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
Expand All @@ -474,6 +489,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
updateStatus := shared.DomainStatusDeprecated
updateDescription := "other random domain test description"
updateOwnerEmail := "other random domain test owner"
updatedData := map[string]string{"k": "v2"}
updateRetention := int32(122)
updateEmitMetric := true
updateClusterActive := "other random active cluster name"
Expand All @@ -496,6 +512,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
Status: &updateStatus,
Description: common.StringPtr(updateDescription),
OwnerEmail: common.StringPtr(updateOwnerEmail),
Data: updatedData,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(updateRetention),
Expand All @@ -521,6 +538,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
s.Equal(persistence.DomainStatusRegistered, resp.Info.Status)
s.Equal(description, resp.Info.Description)
s.Equal(ownerEmail, resp.Info.OwnerEmail)
s.Equal(data, resp.Info.Data)
s.Equal(retention, resp.Config.Retention)
s.Equal(emitMetric, resp.Config.EmitMetric)
s.Equal(updateClusterActive, resp.ReplicationConfig.ActiveClusterName)
Expand All @@ -538,6 +556,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
status := shared.DomainStatusRegistered
description := "some random test description"
ownerEmail := "some random test owner"
data := map[string]string{"k": "v"}
retention := int32(10)
emitMetric := true
clusterActive := "some random active cluster name"
Expand All @@ -561,6 +580,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
Status: &status,
Description: common.StringPtr(description),
OwnerEmail: common.StringPtr(ownerEmail),
Data: data,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
Expand All @@ -584,6 +604,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
updateStatus := shared.DomainStatusDeprecated
updateDescription := "other random domain test description"
updateOwnerEmail := "other random domain test owner"
updatedData := map[string]string{"k": "v2"}
updateRetention := int32(122)
updateEmitMetric := true
updateClusterActive := "other random active cluster name"
Expand All @@ -606,6 +627,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
Status: &updateStatus,
Description: common.StringPtr(updateDescription),
OwnerEmail: common.StringPtr(updateOwnerEmail),
Data: updatedData,
},
Config: &shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(updateRetention),
Expand All @@ -628,6 +650,7 @@ func (s *domainReplicatorSuite) TestHandleReceivingTask_UpdateDomainTask_NoUpdat
s.Equal(persistence.DomainStatusRegistered, resp.Info.Status)
s.Equal(description, resp.Info.Description)
s.Equal(ownerEmail, resp.Info.OwnerEmail)
s.Equal(data, resp.Info.Data)
s.Equal(retention, resp.Config.Retention)
s.Equal(emitMetric, resp.Config.EmitMetric)
s.Equal(clusterActive, resp.ReplicationConfig.ActiveClusterName)
Expand Down

0 comments on commit 2cf0577

Please sign in to comment.