Add a script to run tests and update gitea workflow
Some checks failed
Tests / cli_tests (18.x) (pull_request) Failing after 41s
Some checks failed
Tests / cli_tests (18.x) (pull_request) Failing after 41s
This commit is contained in:
parent
abe9195615
commit
395e8bddee
@ -12,34 +12,45 @@ env:
|
|||||||
DOCKER_HOST: unix:///var/run/dind.sock
|
DOCKER_HOST: unix:///var/run/dind.sock
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sdk_tests:
|
cli_tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [18.x]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies and build
|
||||||
|
run: yarn && yarn build
|
||||||
|
- name: Install registry-cli
|
||||||
|
run: yarn global add file:$PWD
|
||||||
|
- name: Log CLI version
|
||||||
|
run: laconic --version
|
||||||
|
|
||||||
- name: Checkout laconicd
|
- name: Checkout laconicd
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: "./laconicd/"
|
path: "/tmp/laconicd/"
|
||||||
repository: cerc-io/laconicd
|
repository: cerc-io/laconicd
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: main
|
ref: main
|
||||||
- name: Environment
|
- name: Environment
|
||||||
run: ls -tlh && env
|
run: ls -tlh && env
|
||||||
- name: Start dockerd
|
|
||||||
run: |
|
- name: Build laconicd container
|
||||||
dockerd -H $DOCKER_HOST --userland-proxy=false &
|
working-directory: /tmp/laconicd/tests/sdk_tests
|
||||||
sleep 5
|
|
||||||
- name: build registry-cli container
|
|
||||||
run: docker build -t cerc/laconic-registry-cli:local-test --build-arg CERC_NPM_URL=https://git.vdb.to/api/packages/cerc-io/npm/ --build-arg CERC_NPM_AUTH_TOKEN="${{ secrets.CICD_PUBLISH_TOKEN }}" .
|
|
||||||
- name: build containers scripts
|
|
||||||
working-directory: laconicd/tests/sdk_tests
|
|
||||||
run: ./build-laconicd-container.sh
|
run: ./build-laconicd-container.sh
|
||||||
- name: start laconicd container
|
- name: Start laconicd container
|
||||||
working-directory: laconicd/tests/sdk_tests
|
env:
|
||||||
|
TEST_AUCTION_ENABLED: true
|
||||||
run: docker compose up laconicd -d
|
run: docker compose up laconicd -d
|
||||||
|
|
||||||
- name: Run registry-cli demo commands in registry-cli container
|
- name: Run registry-cli tests
|
||||||
run : ls -tla
|
run: ./test/run-tests.sh
|
||||||
- name: stop containers
|
|
||||||
working-directory: laconicd/tests/sdk_tests
|
- name: Stop containers
|
||||||
run: docker compose down
|
run: docker compose down
|
||||||
|
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@ -1,3 +1,4 @@
|
|||||||
|
# TODO: Remove
|
||||||
name: Tests
|
name: Tests
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
@ -1,28 +1,25 @@
|
|||||||
services:
|
services:
|
||||||
laconicd:
|
laconicd:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: cerc-io/laconicd:local-test
|
image: cerc/laconicd:local
|
||||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
||||||
|
environment:
|
||||||
|
- TEST_AUCTION_ENABLED
|
||||||
|
- TEST_REGISTRY_EXPIRY
|
||||||
|
- LOGLEVEL
|
||||||
volumes:
|
volumes:
|
||||||
- laconicd/init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
- /tmp/laconicd/init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
||||||
interval: 1s
|
interval: 1s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 30
|
retries: 30
|
||||||
ports:
|
ports:
|
||||||
- "6060"
|
- "9473:9473"
|
||||||
- "26657"
|
- "1317:1317"
|
||||||
- "26656"
|
|
||||||
- "9473"
|
|
||||||
- "8545"
|
|
||||||
- "8546"
|
|
||||||
- "9090"
|
|
||||||
- "9091"
|
|
||||||
- "1317"
|
|
||||||
|
|
||||||
cli-test-runner:
|
cli-test-runner:
|
||||||
image: cerc/laconic-registry-cli:local-test
|
image: cerc/laconic-registry-cli:local
|
||||||
depends_on:
|
depends_on:
|
||||||
laconicd:
|
laconicd:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"yargs": "^17.4.1"
|
"yargs": "^17.4.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --runInBand --verbose --testPathPattern=test",
|
"test": "jest --runInBand --verbose test/cli.test.ts",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"clean": "rm -rf ./dist",
|
"clean": "rm -rf ./dist",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
|
29
test/run-tests.sh
Executable file
29
test/run-tests.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Get the key from laconicd
|
||||||
|
laconicd_key=$(yes | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe)
|
||||||
|
|
||||||
|
# Set parameters for the test suite
|
||||||
|
cosmos_chain_id=laconic_9000-1
|
||||||
|
laconicd_rest_endpoint=http://127.0.0.1:1317
|
||||||
|
laconicd_gql_endpoint=http://127.0.0.1:9473/api
|
||||||
|
|
||||||
|
# Create the required config
|
||||||
|
config_file="config.yml"
|
||||||
|
config=$(cat <<EOL
|
||||||
|
services:
|
||||||
|
cns:
|
||||||
|
restEndpoint: $laconicd_rest_endpoint
|
||||||
|
gqlEndpoint: $laconicd_gql_endpoint
|
||||||
|
userKey: $laconicd_key
|
||||||
|
bondId:
|
||||||
|
chainId: $cosmos_chain_id
|
||||||
|
EOL
|
||||||
|
)
|
||||||
|
echo "$config" > "$config_file"
|
||||||
|
|
||||||
|
# Wait for the laconid endpoint to come up
|
||||||
|
docker compose exec laconicd sh -c "curl --retry 10 --retry-delay 3 --retry-connrefused http://127.0.0.1:9473/api"
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
yarn test
|
Loading…
Reference in New Issue
Block a user