Skip to content

Commit

Permalink
test(e2e): add e2e framework (bats), add e2e CI, and update source …
Browse files Browse the repository at this point in the history
…code of test files (#17)
  • Loading branch information
Marcin Nowak-Liebiediew authored Jun 30, 2023
1 parent 4d88e5d commit 02d11ad
Show file tree
Hide file tree
Showing 26 changed files with 705 additions and 48 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run e2e tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
pull_request:

jobs:
test-extension:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-12, ubuntu-22.04 ]
test_file_path: [ extensions/nns/e2e/tests/nns.bash, extensions/sns/e2e/tests/sns.bash ]
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install brew
uses: Homebrew/actions/setup-homebrew@master
if: contains(matrix.os, 'macos-12') == false
- name: Install sponge and timeout
run: brew install coreutils sponge
- name: Install IC SDK (dfx)
run: DFX_VERSION="0.14.2-beta.1" sh -ci "$(curl -sSL https://internetcomputer.org/install.sh)"
- name: run test
run: timeout 2400 e2e/bats/bin/bats ${{ matrix.test_file_path }}

aggregate:
name: e2e:required
if: ${{ always() }}
needs: [test-extension]
runs-on: ubuntu-latest
steps:
- name: check e2e test result
if: ${{ needs.test-extension.result != 'success' }}
run: exit 1
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
matrix:
# For these target platforms
include:
- os: macos-11
- os: macos-12
dist-args: --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin
install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.5/cargo-dist-v0.0.5-installer.sh | sh
- os: ubuntu-20.04
Expand Down
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "e2e/bats"]
path = e2e/bats
url = https://github.com/bats-core/bats-core.git
[submodule "e2e/bats-support"]
path = e2e/bats-support
url = https://github.com/bats-core/bats-support.git
[submodule "e2e/bats-assert"]
path = e2e/bats-assert
url = https://github.com/bats-core/bats-assert.git
1 change: 1 addition & 0 deletions e2e/bats
Submodule bats added at 4417a9
1 change: 1 addition & 0 deletions e2e/bats-assert
Submodule bats-assert added at 44913f
1 change: 1 addition & 0 deletions e2e/bats-support
Submodule bats-support added at 3c8fad
5 changes: 5 additions & 0 deletions e2e/get_ephemeral_port.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import socket

with socket.socket() as s:
s.bind(('', 0))
print(s.getsockname()[1], end='')
Loading

0 comments on commit 02d11ad

Please sign in to comment.