Skip to content
New issue

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

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

Already on GitHub? # to your account

Acceptance test CICD #120

Merged
merged 4 commits into from
May 31, 2022
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
41 changes: 41 additions & 0 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Acceptance Tests

on:
pull_request:
branches: [ main, release/** ]
push:
branches: [ main, release/** ]
tags: [ v* ]

jobs:
setup-local-hedera:
name: Acceptance Tests
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16

- name: Checkout repo
uses: actions/checkout@v2

- name: Install packages
run: npm ci

- name: Create .env file
run: cp ./packages/server/tests/localAcceptance.env .env

- name: Lerna Bootstrap
run: npm run setup

- name: Install pnpm
run: npm install -g pnpm

- name: Build Typescript
run: npx lerna run build

- name: Run acceptance tests
run: npm run acceptancetest
8 changes: 5 additions & 3 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"pino-pretty": "^7.6.1"
},
"devDependencies": {
"@hashgraph/hedera-local": "^1.0.1",
"@hashgraph/hedera-local": "github:hashgraph/hedera-local-node",
"@koa/cors": "^3.1.0",
"@types/chai": "^4.3.0",
"@types/cors": "^2.8.12",
Expand All @@ -40,7 +40,7 @@
"compile": "tsc -b tsconfig.json",
"acceptancetest": "ts-mocha ./tests/acceptance.spec.ts",
"start": "node dist/index.js",
"test": "nyc ts-mocha --recursive ./tests/*.spec.ts"
"test": "nyc ts-mocha --recursive ./tests/server.spec.ts"
},
"nyc": {
"check-coverage": false,
Expand Down
11 changes: 11 additions & 0 deletions packages/server/tests/acceptance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,17 @@ describe('RPC Server Integration Tests', async function () {
return { executedTimestamp, executedTransactionId };
};

const getRecordResponseDetails = async (resp: TransactionResponse) => {
const record = await resp.getRecord(client);
const nanoString = record.consensusTimestamp.nanos.toString();
const executedTimestamp = `${record.consensusTimestamp.seconds}.${nanoString.padStart(9, '0')}`;
const transactionId = record.transactionId;
const transactionIdNanoString = transactionId.validStart.nanos.toString();
const executedTransactionId = `${transactionId.accountId}@${transactionIdNanoString.padStart(9, '0')}`;
console.log(`executedTimestamp: ${executedTimestamp}, executedTransactionId: ${executedTransactionId}`);
return { executedTimestamp, executedTransactionId };
};

const numberTo0x = (input: number): string => {
return `0x${input.toString(16)}`;
};
Expand Down
7 changes: 7 additions & 0 deletions packages/server/tests/localAcceptance.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
HEDERA_NETWORK={"127.0.0.1:50211":"0.0.3"}
OPERATOR_ID_MAIN=0.0.2
OPERATOR_KEY_MAIN=302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137
CHAIN_ID=0x12a
MIRROR_NODE_URL=http://127.0.0.1:5551
LOCAL_NODE=true
SERVER_PORT=7546