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

test: cli tests automation #107

Closed
wants to merge 1 commit into from
Closed
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/test-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests

on: pull_request


jobs:
preparation_and_running_tests:
permissions:
contents: read
strategy:
matrix:
os: [
ubuntu-latest,
windows-latest,
macos-latest
]
node-version: ['lts/*', '18.17.1'] # or 18.17.1
tags: [
"default"
]
runs-on: ${{matrix.os}}

name: 'Node ${{ matrix.node-version}} / ${{ matrix.os}}'
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: |
npm i zksync-cli

- name: Run tests
run: |
./src/tests/test_zksync_cli.sh
shell: bash

107 changes: 107 additions & 0 deletions src/tests/test_zksync_cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash

declare -i counter_failed=0
declare -i counter_total=0
declare -i RESULT=0

verify_result () {
RESULT=$?
counter_total+=1
if [ $RESULT -eq 0 ]; then
echo ""
echo "-----------> SUCCESS <-----------"
echo " "
else
echo ""
echo "-----------> FAILED <-----------"
echo " "
counter_failed+=1
fi
}

echo "INFO"

echo "node:"
node --version
echo "npm:"
npm --version
echo "docker:"
docker --version

#BASIC

echo "Test #1717"
echo "---------------------------------"

echo "> npx zksync-cli -V"
npx zksync-cli -V
verify_result

echo "> npx zksync-cli --version"
npx zksync-cli --version
verify_result

###

echo "Test #1734"
echo "---------------------------------"

echo "> npx zksync-cli --help"
npx zksync-cli --help
verify_result

echo "---------------------------------"
echo "> npx zksync-cli --help deposit"
npx zksync-cli --help deposit
verify_result

###

echo "Test #1714"
echo "---------------------------------"

echo "> npx zksync-cli -h"
npx zksync-cli -h
verify_result

echo "---------------------------------"
echo "> npx zksync-cli --help"
npx zksync-cli --help
verify_result

###

echo "Test #1715"
echo "---------------------------------"

echo "npx zksync-cli dev -h"
npx zksync-cli dev -h
verify_result

echo "---------------------------------"
echo "npx zksync-cli dev --help"
npx zksync-cli dev --help
verify_result

echo "---------------------------------"
echo "npx zksync-cli dev --help start"
npx zksync-cli dev --help start
verify_result

###

echo "Test #1719"
echo "---------------------------------"

echo "> zksync-cli dev modules"
npx zksync-cli dev modules
verify_result

###

if [ $counter_failed == 0 ]; then
echo "$counter_total tests Passed"
else
echo "Fail. $counter_failed failed test(s)"
exit 1 # terminate and indicate error
fi