From 98933a6f861c983e43ed3918c564f978e02cbf60 Mon Sep 17 00:00:00 2001 From: Milos Milosevic Date: Tue, 4 Apr 2023 14:38:12 +0200 Subject: [PATCH] Run python e2e tests in the pipeline --- .gitlab-ci.yml | 43 +++++++++++++++++++++++++++++++++++++++---- Dockerfile | 16 ++++++++++------ 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61afce6e..ce405947 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,9 +6,10 @@ include: - template: Secret-Detection.gitlab-ci.yml stages: - - build - - test - dockerize + - build + - python-test + - test build-mainnet: stage: build @@ -49,18 +50,52 @@ dockerize-mainnet: before_script: - docker info - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - df -BM $pwd script: + - docker images + - docker builder prune -a -f - docker build --no-cache -t $IMAGE . + - docker images - docker push $IMAGE after_script: - docker rmi $IMAGE + - docker images tags: - builder - when: - manual timeout: 3h +test-e2e: + stage: python-test + variables: + IMAGE: $CI_REGISTRY_IMAGE/mainnet/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA + dependencies: + - dockerize-mainnet + before_script: + - docker info + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - git clone https://gitlab.com/PBSA/tools-libs/peerplays-utils.git + - cd peerplays-utils/peerplays-qa-environment + - cd e2e-tests/ + - python3 -m venv venv + - source venv/bin/activate + - pip3 install -r requirements.txt + - docker ps -a + - python3 main.py --stop + - docker ps -a + - python3 main.py --start btc hive + - docker ps -a + - python3 -m pytest test_btc_init_state.py test_hive_inital_state.py + - docker pull $IMAGE + - docker run -d peerplays-utils/peerplays-qa-environment/peerplays/config.ini:/home/peerplays/peerplays-network/witness_node_data_dir/config.ini -v peerplays-utils/peerplays-qa-environment/peerplays/genesis.json:/home/peerplays/peerplays-network/genensis.json -v peerplays-utils/peerplays-qa-environment/peerplays/init_network.sh:/home/peerplays/peerplays-network/init_network.sh $IMAGE + - docker ps -a + - ./main.py --stop + - deactivate + - docker ps -a + tags: + - python-tests + build-testnet: stage: build script: diff --git a/Dockerfile b/Dockerfile index 7a229aa7..1d45a601 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,8 +50,14 @@ RUN echo 'peerplays:peerplays' | chpasswd # SSH EXPOSE 22 +RUN \ + df -h -BM $pwd + WORKDIR /home/peerplays/src +RUN \ + df -h -BM $pwd + #=============================================================================== # Boost setup #=============================================================================== @@ -133,6 +139,9 @@ RUN \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ libsodium-dev +RUN \ + df -h -BM $pwd + RUN \ git clone https://github.com/libbitcoin/libbitcoin-build.git && \ cd libbitcoin-build && \ @@ -190,11 +199,9 @@ ADD . peerplays RUN \ cd peerplays && \ git submodule update --init --recursive && \ - git symbolic-ref --short HEAD && \ - git log --oneline -n 5 && \ mkdir build && \ cd build && \ - cmake -DCMAKE_BUILD_TYPE=Release .. + cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_PEERPLAYS_TESTNET=1 .. # Build Peerplays RUN \ @@ -208,9 +215,6 @@ RUN \ ln -s /home/peerplays/src/peerplays/build/programs/cli_wallet/cli_wallet ./ && \ ln -s /home/peerplays/src/peerplays/build/programs/witness_node/witness_node ./ -RUN ./witness_node --create-genesis-json genesis.json && \ - rm genesis.json - RUN chown peerplays:root -R /home/peerplays/peerplays-network # Peerplays RPC