Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/domain/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
errInvalidGracefulFailover = &types.BadRequestError{Message: "Cannot start graceful failover without updating active cluster or in local domain."}
errActiveClusterNameRequired = &types.BadRequestError{Message: "ActiveClusterName is required for all global domains."}
errLocalDomainsCannotFailover = &types.BadRequestError{Message: "Local domains cannot perform failovers or change replication configuration"}

errInvalidRetentionPeriod = &types.BadRequestError{Message: "A valid retention period is not set on request."}
errInvalidArchivalConfig = &types.BadRequestError{Message: "Invalid to enable archival without specifying a uri."}
errDomainDeprecated = &types.BadRequestError{Message: "Domain is deprecated."}
errInvalidRetentionPeriod = &types.BadRequestError{Message: "A valid retention period is not set on request."}
errInvalidArchivalConfig = &types.BadRequestError{Message: "Invalid to enable archival without specifying a uri."}
)
4 changes: 4 additions & 0 deletions common/domain/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ func (d *handlerImpl) UpdateDomain(
if err != nil {
return nil, err
}
// Check if domain is deprecated
if currentDomainState.Info != nil && currentDomainState.Info.Status == persistence.DomainStatusDeprecated {
return nil, errDomainDeprecated
}

// todo (david.porter) remove this and push the deepcopy into each of the branches
getResponse := currentDomainState.DeepCopy()
Expand Down
37 changes: 37 additions & 0 deletions common/domain/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,43 @@ func TestHandler_UpdateDomain(t *testing.T) {
},
err: errors.New("handle-transmission-task-error"),
},
{
name: "Error case - update deprecated domain should return errDomainDeprecated",
setupMock: func(domainManager *persistence.MockDomainManager, updateRequest *types.UpdateDomainRequest, archivalMetadata *archiver.MockArchivalMetadata, timeSource clock.MockedTimeSource, _ *MockReplicator) {
domainResponse := &persistence.GetDomainResponse{
ReplicationConfig: &persistence.DomainReplicationConfig{
ActiveClusterName: cluster.TestCurrentClusterName,
Clusters: []*persistence.ClusterReplicationConfig{
{ClusterName: cluster.TestCurrentClusterName}, {ClusterName: cluster.TestAlternativeClusterName}},
},
Config: &persistence.DomainConfig{
Retention: 1,
EmitMetric: true,
HistoryArchivalStatus: types.ArchivalStatusDisabled,
VisibilityArchivalStatus: types.ArchivalStatusDisabled,
BadBinaries: types.BadBinaries{Binaries: map[string]*types.BadBinaryInfo{}},
IsolationGroups: types.IsolationGroupConfiguration{},
AsyncWorkflowConfig: types.AsyncWorkflowConfiguration{Enabled: true},
},
Info: &persistence.DomainInfo{
Name: constants.TestDomainName,
ID: constants.TestDomainID,
Status: persistence.DomainStatusDeprecated,
},
IsGlobalDomain: true,
LastUpdatedTime: timeSource.Now().UnixNano(),
FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion,
}
domainManager.EXPECT().GetMetadata(ctx).Return(&persistence.GetMetadataResponse{}, nil).Times(1)
domainManager.EXPECT().GetDomain(ctx, &persistence.GetDomainRequest{Name: updateRequest.GetName()}).
Return(domainResponse, nil).Times(1)
},
request: &types.UpdateDomainRequest{
Name: constants.TestDomainName,
ActiveClusterName: common.Ptr(cluster.TestAlternativeClusterName),
},
err: errDomainDeprecated,
},
}

for _, tc := range testCases {
Expand Down