Skip to content

Commit

Permalink
added unit test for orchestrator method Stop()
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Jul 4, 2024
1 parent e46e0e4 commit 4b850b3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions zetaclient/orchestrator/orchestrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func MockOrchestrator(
evmChain.ChainId: evmObserver,
btcChain.ChainId: btcObserver,
},
stop: make(chan struct{}),
stopped: false,
}
return orchestrator
}
Expand Down Expand Up @@ -92,6 +94,28 @@ func CreateTestAppContext(
return appContext
}

func Test_Stop(t *testing.T) {
// initial parameters for orchestrator creation
evmChain := chains.Ethereum
btcChain := chains.BitcoinMainnet
evmChainParams := &observertypes.ChainParams{
ChainId: evmChain.ChainId,
}
btcChainParams := &observertypes.ChainParams{
ChainId: btcChain.ChainId,
}

// create orchestrator
appCtx := CreateTestAppContext(evmChain, btcChain, evmChainParams, btcChainParams)
orchestrator := MockOrchestrator(t, appCtx, nil, evmChain, btcChain, evmChainParams, btcChainParams)

// stop orchestrator 1st time
orchestrator.Stop()

// stop orchestrator 2nd time without panic
orchestrator.Stop()
}

func Test_GetUpdatedSigner(t *testing.T) {
// initial parameters for orchestrator creation
evmChain := chains.Ethereum
Expand Down

0 comments on commit 4b850b3

Please sign in to comment.