Skip to content

Commit

Permalink
Merge branch 'master' into unit-test-for-dynamicconfig-config
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekj720 authored Apr 6, 2024
2 parents 44658f1 + 9024217 commit c4d44e0
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
30 changes: 30 additions & 0 deletions common/domain/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,36 @@ func TestRegisterDomain(t *testing.T) {
wantErr: true,
expectedErr: &types.BadRequestError{},
},
{
name: "invalid history archival configuration",
request: &types.RegisterDomainRequest{
Name: "test-domain-invalid-archival-config",
HistoryArchivalStatus: types.ArchivalStatusEnabled.Ptr(),
HistoryArchivalURI: "invalid-uri",
IsGlobalDomain: true,
},
isPrimaryCluster: true,
mockSetup: func(mockDomainMgr *persistence.MockDomainManager, request *types.RegisterDomainRequest) {
mockDomainMgr.EXPECT().GetDomain(gomock.Any(), &persistence.GetDomainRequest{Name: request.Name}).Return(nil, &types.EntityNotExistsError{})
},
wantErr: true,
expectedErr: errInvalidArchivalConfig,
},
{
name: "error during domain creation",
request: &types.RegisterDomainRequest{
Name: "domain-creation-error",
WorkflowExecutionRetentionPeriodInDays: 2,
IsGlobalDomain: false,
},
isPrimaryCluster: true,
mockSetup: func(mockDomainMgr *persistence.MockDomainManager, request *types.RegisterDomainRequest) {
mockDomainMgr.EXPECT().GetDomain(gomock.Any(), &persistence.GetDomainRequest{Name: request.Name}).Return(nil, &types.EntityNotExistsError{})

mockDomainMgr.EXPECT().CreateDomain(gomock.Any(), gomock.Any()).Return(nil, errors.New("creation failed"))
},
wantErr: true,
},
}

for _, tc := range tests {
Expand Down
2 changes: 2 additions & 0 deletions common/domain/transmissionTaskHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination transmissionTaskHandler_mock.go

package domain

import (
Expand Down
74 changes: 74 additions & 0 deletions common/domain/transmissionTaskHandler_mock.go

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

0 comments on commit c4d44e0

Please sign in to comment.