Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): fix monitor test and add to CI #295

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,23 @@ jobs:
- run: yarn test:esm # full e2e integration tests
working-directory: ./ar-io-sdk
env:
IO_PROCESS_ID: ${{ vars.IO_NETWORK_PROCESS_ID }}
ARIO_NETWORK_PROCESS_ID: ${{ vars.ARIO_NETWORK_PROCESS_ID }}
AO_CU_URL: ${{ vars.AO_CU_URL }}

monitor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- run: yarn --frozen-lockfile
- run: yarn monitor
env:
ARIO_NETWORK_PROCESS_ID: ${{ vars.ARIO_NETWORK_PROCESS_ID }}

evolve:
runs-on: ubuntu-latest
needs: [integration, unit, sdk, lint]
Expand All @@ -97,7 +111,7 @@ jobs:
- run: yarn evolve
env:
WALLET: ${{ secrets.WALLET }}
IO_NETWORK_PROCESS_ID: ${{ vars.IO_NETWORK_PROCESS_ID }}
ARIO_NETWORK_PROCESS_ID: ${{ vars.ARIO_NETWORK_PROCESS_ID }}
AO_CU_URL: ${{ vars.AO_CU_URL }}
- name: Notify Success
if: success()
Expand All @@ -120,12 +134,12 @@ jobs:
},
{
"title": "Process ID",
"value": "${{ vars.IO_NETWORK_PROCESS_ID }}",
"value": "${{ vars.ARIO_NETWORK_PROCESS_ID }}",
"short": true
},
{
"title": "View on ao.link",
"value": "https://www.ao.link/#/entity/${{ vars.IO_NETWORK_PROCESS_ID }}?tab=source-code",
"value": "https://www.ao.link/#/entity/${{ vars.ARIO_NETWORK_PROCESS_ID }}?tab=source-code",
"short": false
}
,
Expand All @@ -151,15 +165,15 @@ jobs:
"fallback": "Failed to update IO Process!",
"color": "danger",
"title": "Details",
"text": 'The IO "${{ github.ref_name == 'main' && 'testnet' || 'devnet' }} Process ( ${{ vars.IO_NETWORK_PROCESS_ID }}) FAILED to update!',
"text": 'The IO "${{ github.ref_name == 'main' && 'testnet' || 'devnet' }} Process ( ${{ vars.ARIO_NETWORK_PROCESS_ID }}) FAILED to update!',
"fields": [{
"title": "Network",
"value": "${{ github.ref_name == 'main' && 'testnet' || 'devnet' }}",
"short": true
},
{
"title": "Process ID",
"value": "${{ vars.IO_NETWORK_PROCESS_ID }}",
"value": "${{ vars.ARIO_NETWORK_PROCESS_ID }}",
"short": true
},
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: yarn monitor
id: monitor
env:
IO_PROCESS_ID: ${{ matrix.network == 'testnet' && 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA' || 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc' }}
ARIO_NETWORK_PROCESS_ID: ${{ matrix.network == 'testnet' && 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA' || 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc' }}

- name: Notify Failure
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:unit": "rm -rf coverage && mkdir -p coverage && busted . && luacov",
"test:coverage": "rm -rf luacov-html && yarn test:unit && luacov --reporter html && open luacov-html/index.html",
"monitor": "node --test tests/monitor/monitor.test.mjs",
"monitor:devnet": "IO_PROCESS_ID=GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc node --test tests/monitor/monitor.test.mjs",
"monitor:testnet": "IO_PROCESS_ID=agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA node --test tests/monitor/monitor.test.mjs",
"monitor:devnet": "ARIO_NETWORK_PROCESS_ID=GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc node --test tests/monitor/monitor.test.mjs",
"monitor:testnet": "ARIO_NETWORK_PROCESS_ID=agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA node --test tests/monitor/monitor.test.mjs",
"evolve": "yarn build && node tools/evolve.mjs",
"prepare": "husky"
},
Expand Down
6 changes: 4 additions & 2 deletions tests/monitor/monitor.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { connect } from '@permaweb/aoconnect';
import { strict as assert } from 'node:assert';
import { describe, it, before, after } from 'node:test';
import { DockerComposeEnvironment, Wait } from 'testcontainers';
import { ARIOToMARIO } from '../helpers.mjs';

// set debug level logs for to get detailed messages
Logger.default.setLogLevel('info');

const processId = process.env.IO_PROCESS_ID || ARIO_DEVNET_PROCESS_ID;
export const mARIOPerARIO = 1_000_000;
export const ARIOToMARIO = (amount) => amount * mARIOPerARIO;

const processId = process.env.ARIO_NETWORK_PROCESS_ID || ARIO_DEVNET_PROCESS_ID;
const io = ARIO.init({
process: new AOProcess({
processId,
Expand Down
Loading