Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/unblock-queries
Browse files Browse the repository at this point in the history
  • Loading branch information
davidporter-id-au authored Apr 23, 2024
2 parents bf17390 + c76970e commit 4944c5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions service/frontend/wrappers/clusterredirection/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ func (policy *selectedOrAllAPIsForwardingRedirectionPolicy) WithDomainIDRedirect
return err
}
if domainEntry.IsDeprecatedOrDeleted() {
return fmt.Errorf("domain %v is deprecated or deleted", domainEntry.GetInfo().Name)
return types.DomainNotActiveError{
Message: "domain is deprecated.",
DomainName: domainEntry.GetInfo().Name,
CurrentCluster: policy.currentClusterName,
ActiveCluster: policy.currentClusterName,
}
}
return policy.withRedirect(ctx, domainEntry, apiName, call)
}
Expand All @@ -207,7 +212,12 @@ func (policy *selectedOrAllAPIsForwardingRedirectionPolicy) WithDomainNameRedire
return err
}
if domainEntry.IsDeprecatedOrDeleted() {
return fmt.Errorf("domain %v is deprecated or deleted", domainName)
return types.DomainNotActiveError{
Message: "domain is deprecated or deleted",
DomainName: domainName,
CurrentCluster: policy.currentClusterName,
ActiveCluster: policy.currentClusterName,
}
}
return policy.withRedirect(ctx, domainEntry, apiName, call)
}
Expand Down
4 changes: 2 additions & 2 deletions service/frontend/wrappers/clusterredirection/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ func (s *selectedAPIsForwardingRedirectionPolicySuite) TestGetTargetDataCenter_G
for apiName := range selectedAPIsForwardingRedirectionPolicyAPIAllowlist {
err := s.policy.WithDomainIDRedirect(context.Background(), s.domainID, apiName, callFn)
s.Error(err)
s.Equal(fmt.Sprintf("domain %v is deprecated or deleted", s.domainName), err.Error())
s.Equal("domain is deprecated.", err.Error())

err = s.policy.WithDomainNameRedirect(context.Background(), s.domainName, apiName, callFn)
s.Error(err)
s.Equal(fmt.Sprintf("domain %v is deprecated or deleted", s.domainName), err.Error())
s.Equal("domain is deprecated or deleted", err.Error())
}

s.Equal(0, currentClustercallCount)
Expand Down

0 comments on commit 4944c5d

Please sign in to comment.