Skip to content

Commit

Permalink
fix(apps/playground-api): fix PlaygroundProbeIndicator not registered (
Browse files Browse the repository at this point in the history
…#2022)

#### What this PR does / why we need it:

As per title, this PR add the missing `PlaygroundProbeIndicator` to
`ActuatorProbes`.

Additionally fixed a few deprecated usage.
  • Loading branch information
fuxingloh authored Feb 3, 2023
1 parent b239ba4 commit d08f4f4
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ describe('no peers', () => {
details: {
blockchain: {
status: 'up'
},
playground: {
status: 'up'
}
},
error: {},
info: {
blockchain: {
status: 'up'
},
playground: {
status: 'up'
}
},
status: 'ok'
Expand All @@ -52,6 +58,9 @@ describe('no peers', () => {
initialBlockDownload: expect.any(Boolean),
peers: 0,
status: 'down'
},
playground: {
status: 'up'
}
},
error: {
Expand All @@ -63,7 +72,11 @@ describe('no peers', () => {
status: 'down'
}
},
info: {},
info: {
playground: {
status: 'up'
}
},
status: 'error'
},
error: {
Expand Down Expand Up @@ -101,12 +114,18 @@ describe('with peers', () => {
details: {
blockchain: {
status: 'up'
},
playground: {
status: 'up'
}
},
error: {},
info: {
blockchain: {
status: 'up'
},
playground: {
status: 'up'
}
},
status: 'ok'
Expand All @@ -130,8 +149,10 @@ describe('with peers', () => {
initialBlockDownload: false,
peers: 1,
status: 'up'
},
playground: {
status: 'up'
}

},
error: {},
info: {
Expand All @@ -141,6 +162,9 @@ describe('with peers', () => {
initialBlockDownload: false,
peers: 1,
status: 'up'
},
playground: {
status: 'up'
}
},
status: 'ok'
Expand Down
7 changes: 5 additions & 2 deletions apps/playground-api/src/bots/Bot.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { ApiClient } from '@defichain/jellyfish-api-core'
import { RegTestFoundationKeys } from '@defichain/jellyfish-network'
import { Injectable } from '@nestjs/common'
import { GenesisKeys } from '@defichain/testcontainers'
import { Interval } from '@nestjs/schedule'

/**
* @template Each
*/
@Injectable()
export abstract class PlaygroundBot<Each> {
static MN_KEY = GenesisKeys[0]
static MN_KEY = RegTestFoundationKeys[0]

/**
* @return {string} address that should be used for everything
Expand Down
3 changes: 3 additions & 0 deletions apps/playground-api/src/modules/PlaygroundModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { SetupLoanCollateral } from '../setups/setup.loan.collateral'
import { SetupGov } from '../setups/setup.gov'
import { VaultBot } from '../bots/VaultBot'
import { ScheduleModule } from '@nestjs/schedule'
import { ActuatorProbes } from '@defichain-apps/libs/actuator'

@Module({
imports: [
Expand Down Expand Up @@ -47,6 +48,7 @@ export class PlaygroundModule implements OnApplicationBootstrap {

constructor (
private readonly client: ApiClient,
private readonly probes: ActuatorProbes,
private readonly indicator: PlaygroundProbeIndicator,
utxo: SetupUtxo,
token: SetupToken,
Expand All @@ -69,6 +71,7 @@ export class PlaygroundModule implements OnApplicationBootstrap {
dex,
gov
]
this.probes.add(indicator)
}

async onApplicationBootstrap (): Promise<void> {
Expand Down
3 changes: 3 additions & 0 deletions apps/playground-api/src/setups/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Injectable, Logger } from '@nestjs/common'
import { RegTestFoundationKeys } from '@defichain/jellyfish-network'
import { PlaygroundBlock } from '../PlaygroundBlock'

/**
* @template Each
*/
@Injectable()
export abstract class PlaygroundSetup<Each> {
static MN_KEY = RegTestFoundationKeys[0]
Expand Down

0 comments on commit d08f4f4

Please sign in to comment.