-
Notifications
You must be signed in to change notification settings - Fork 9
ci(e2e): E2E tests with CI integration #83
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
Changes from all commits
fe7cef6
ae83906
6aaf424
7dc726e
f7d782e
aeb9746
4d86b9c
1b64ca9
cd483d6
a9b081c
640fad8
72609b8
33e4326
a3d42a4
9afcae3
c480ddc
741883b
1a51004
78e1fc7
174c519
b5b2c9a
5d1d8da
8bbdb16
21f4e80
62b1e7e
f8983ac
c11c7d0
442f5bf
8b7af68
65ce0e5
cbd5370
0d482d1
c4fe9fa
1ad0e74
779035d
b3208ae
06a291c
6c74ec1
5866278
f891c50
3ee63e6
3c6a307
70e909d
9c62829
6d05f08
7be11f1
1c76270
6a0f206
c76bb9f
b2aa952
91e7e1a
37b1947
f7e118a
13904ad
90b02a6
86ebf07
ec76071
c34969d
0f6ca61
a33cff2
d049bcf
15767dd
a4d0554
961cbeb
e2c7b40
e2c1356
3419ec0
70d5b62
68748dc
354899f
35dbddd
700b4f6
f8a0e47
610d795
ea817b6
6a9cb98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| /.cargo/config.toml | ||
| /target | ||
| /Dockerfile | ||
| /launch/bin |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "js/polkadot-launch"] | ||
| path = js/polkadot-launch | ||
| url = https://github.com/paritytech/polkadot-launch.git | ||
|
Comment on lines
+1
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is obsolete now, right? since we checkout during build?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still exists QAQ, We could not avoid using the submodule in the current state I think, because the CI can not fetch this repo as well
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, guess we'd have to live with it for now.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
OO, This will not be loaded into our directory unless we |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # syntax=docker/dockerfile:experimental | ||
| # | ||
| # Copyright 2021 ChainSafe Systems | ||
| # SPDX-License-Identifier: LGPL-3.0-only | ||
| # | ||
| # This Dockerfile builds the environment of e2e tests | ||
| FROM debian:buster-slim | ||
| COPY config.json config.json | ||
| COPY js/polkadot-launch polkadot-launch | ||
| COPY --from=chainsafe/pint /usr/local/bin/pint bin/ | ||
| COPY --from=clearloop/rococo-v1 /polkadot bin/ | ||
| COPY --from=clearloop/statemint /statemint bin/ | ||
| ENV CARGO_TERM_COLOR=always | ||
| RUN apt-get update -y \ | ||
| && apt-get install openssl curl git -y \ | ||
| && curl -sL https://deb.nodesource.com/setup_15.x | bash - \ | ||
| && apt-get -qqy --no-install-recommends install nodejs -y \ | ||
| && rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb \ | ||
| && rm -f /var/cache/apt/*.bin \ | ||
| && cd polkadot-launch \ | ||
| && npm install \ | ||
| && npm run build | ||
| EXPOSE 9988 | ||
| ENTRYPOINT [ "node", "polkadot-launch/dist/index.js", "config.json" ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # syntax=docker/dockerfile:experimental | ||
| # | ||
| # Copyright 2021 ChainSafe Systems | ||
| # SPDX-License-Identifier: LGPL-3.0-only | ||
| # | ||
| # rococo-v1 | ||
| FROM paritytech/ci-linux:production as builder | ||
| COPY . . | ||
| ENV CARGO_TERM_COLOR=always | ||
| RUN --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,sharing=private,target=target \ | ||
| git clone https://github.com/paritytech/polkadot.git -b rococo-v1 --depth=1 \ | ||
| && cd polkadot \ | ||
| && cargo build --release \ | ||
| && mv target/release/polkadot /polkadot | ||
|
|
||
| # Only a binary for debian | ||
| FROM scratch | ||
| COPY --from=builder /polkadot / |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # syntax=docker/dockerfile:experimental | ||
| # | ||
| # Copyright 2021 ChainSafe Systems | ||
| # SPDX-License-Identifier: LGPL-3.0-only | ||
| # | ||
| # statemint | ||
| FROM paritytech/ci-linux:production as builder | ||
| COPY . . | ||
| ENV CARGO_TERM_COLOR=always | ||
| RUN --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,sharing=private,target=target \ | ||
| git clone https://github.com/paritytech/statemint.git --depth=1 \ | ||
| && cd statemint \ | ||
| && cargo build --release \ | ||
| && mv target/release/statemilnt /statemint | ||
|
|
||
| # Only a binary for debian | ||
| FROM scratch | ||
| COPY --from=builder /statemint / |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "tabWidth": 4, | ||
| "overrides": [ | ||
| { | ||
| "files": "*.json", | ||
| "options": { | ||
| "tabWidth": 2 | ||
| } | ||
| }, | ||
| { | ||
| "files": ".prettierrc", | ||
| "options": { | ||
| "tabWidth": 2 | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # E2E | ||
|
|
||
| E2E tests for PINT | ||
|
|
||
| This package will traverse all APIs provided written in the config | ||
|
|
||
|
|
||
| ## LICENSE | ||
|
|
||
| GNU-v3 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /** | ||
| * E2E tests for PINT | ||
| */ | ||
| import { Runner, Extrinsic } from "./src"; | ||
| import { ApiPromise } from "@polkadot/api"; | ||
|
|
||
| // Tests | ||
| const TESTS = (api: ApiPromise): Extrinsic[] => [ | ||
| { | ||
| pallet: "assetIndex", | ||
| call: "addAsset", | ||
| args: [ | ||
| 42, | ||
| 1000000, | ||
| api.createType("AssetAvailability" as any), | ||
| 1000000, | ||
| ], | ||
| }, | ||
| ]; | ||
|
Comment on lines
+7
to
+19
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can configure our api tests here in the future |
||
|
|
||
| // main | ||
| (async () => { | ||
| await Runner.run(TESTS); | ||
| })(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "name": "@pint/e2e", | ||
| "version": "1.0.0", | ||
| "description": "E2E tests for PINT", | ||
| "main": "index.js", | ||
| "repository": "https://github.com/ChainSafe/PINT", | ||
| "author": "ChainSafe", | ||
| "license": "GNU-v3", | ||
| "private": true, | ||
| "devDependencies": { | ||
| "@polkadot/types": "^4.11.2", | ||
| "@types/node": "^15.3.1", | ||
| "ts-node": "^10.0.0", | ||
| "tslint": "^6.1.3", | ||
| "typescript": "^4.2.4" | ||
| }, | ||
| "dependencies": { | ||
| "@pint/types": "^1.0.0", | ||
| "@polkadot/api": "^4.11.2", | ||
| "@polkadot/keyring": "^6.5.1", | ||
| "find-up": "^5.0.0" | ||
| }, | ||
| "scripts": { | ||
| "start": "ts-node index.ts", | ||
| "build": "tsc --strict", | ||
| "lint": "tsc --noEmit --strict && tslint --project ./tsconfig.json" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * Config of E2E tests | ||
| */ | ||
| import { ApiPromise } from "@polkadot/api"; | ||
| import { KeyringPair } from "@polkadot/keyring/types"; | ||
|
|
||
| /** | ||
| * Extrinsic definition | ||
| */ | ||
| export interface Extrinsic { | ||
| pallet: string; | ||
| call: string; | ||
| args: any[]; | ||
| block?: number; | ||
| timeout?: number; | ||
| } | ||
|
|
||
| /** | ||
| * The config of e2e tests | ||
| */ | ||
| export interface Config { | ||
| api: ApiPromise; | ||
| pair: KeyringPair; | ||
| exs: Extrinsic[]; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /** | ||
| * E2E tests for PINT | ||
| */ | ||
| import Runner from "./runner"; | ||
| import { Config, Extrinsic } from "./config"; | ||
| import * as Launch from "./launch"; | ||
|
|
||
| export { Config, Runner, Launch, Extrinsic }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this as a submodule?