Skip to content

Commit

Permalink
Channel cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal Lemire committed Oct 27, 2023
1 parent 4168178 commit 25155aa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions protocol/daemons/pricefeed/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,8 @@ func TestHealthCheck(t *testing.T) {
client := newClient()

// Act.
// Run the price updater for a single tick with a successful update. Expect the daemon to be healthy.
// Run the price updater for a single tick with a successful update. Expect the daemon to toggle to a
// healthy state
subTaskRunnerImpl.StartPriceUpdater(
client,
grpc_util.Ctx,
Expand All @@ -781,14 +782,18 @@ func TestHealthCheck(t *testing.T) {
// Assert.
require.NoError(t, client.HealthCheck(grpc_util.Ctx))

// Cleanup.
close(stop)

// Act.
// Mock a failed update. In this case, we expect to see the daemon toggle to unhealthy.
mockPriceFeedClient.On("UpdateMarketPrices", grpc_util.Ctx, mock.Anything).
Return(nil, fmt.Errorf("failed to update market prices")).Once()

ticker, stop = singleTickTickerAndStop()

// Run the price updater for a single tick with a failed update. Expect the daemon to be unhealthy.
// Run the price updater for a single tick with a failed update. Expect the daemon to be toggled
// into an unhealthy state.
subTaskRunnerImpl.StartPriceUpdater(
client,
grpc_util.Ctx,
Expand All @@ -800,6 +805,9 @@ func TestHealthCheck(t *testing.T) {
)
// Assert.
require.Error(t, client.HealthCheck(grpc_util.Ctx))

// Cleanup.
close(stop)
}

// TestMarketUpdater_Mixed tests the `RunMarketParamUpdaterTaskLoop` function invokes the grpc
Expand Down

0 comments on commit 25155aa

Please sign in to comment.