Skip to content

Commit

Permalink
Add persistence domain config validation check (#2286)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 committed Jul 26, 2019
1 parent f6bbaf8 commit 2615acf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions service/frontend/domainAttrValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ func newDomainAttrValidator(
}
}

func (d *domainAttrValidatorImpl) validateDomainConfig(
config *persistence.DomainConfig,
) error {
func (d *domainAttrValidatorImpl) validateDomainConfig(config *persistence.DomainConfig) error {
if config.Retention < int32(d.minRetentionDays) {
return errInvalidRetentionPeriod
}
if config.HistoryArchivalStatus == shared.ArchivalStatusEnabled && len(config.HistoryArchivalURI) == 0 {
return errInvalidArchivalConfig
}
if config.VisibilityArchivalStatus == shared.ArchivalStatusEnabled && len(config.VisibilityArchivalURI) == 0 {
return errInvalidArchivalConfig
}
return nil
}

Expand Down
1 change: 1 addition & 0 deletions service/frontend/workflowHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ var (
errInvalidTaskStartToCloseTimeoutSeconds = &gen.BadRequestError{Message: "A valid TaskStartToCloseTimeoutSeconds is not set on request."}
errClientVersionNotSet = &gen.BadRequestError{Message: "Client version is not set on request."}
errInvalidRetentionPeriod = &gen.BadRequestError{Message: "A valid retention period is not set on request."}
errInvalidArchivalConfig = &gen.BadRequestError{Message: "Invalid to enable archival without specifying a uri."}

// err for archival
errHistoryHasPassedRetentionPeriod = &gen.BadRequestError{Message: "Requested workflow history has passed retention period."}
Expand Down

0 comments on commit 2615acf

Please sign in to comment.