git.delta.rocks / unique-network / refs/commits / 3887d6d2abc5

difftreelog

tests: add before upgrade tests and after upgrade tests

Alexander Aksenov2022-08-23parent: #cd63f09.patch.diff
in: master

2 files changed

deleted.github/workflows/build-test-master.ymldiffbeforeafterboth

no changes

modified.github/workflows/nodes-only-update.ymldiffbeforeafterboth
--- a/.github/workflows/nodes-only-update.yml
+++ b/.github/workflows/nodes-only-update.yml
@@ -144,39 +144,81 @@
       - name: Build the stack
         run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" up -d --build  --force-recreate --timeout 300
 
+      #  🚀 POLKADOT LAUNCH COMPLETE 🚀
+      - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.
+        if: success()
+        run: |
+          counter=160
+          function check_container_status {
+                docker inspect -f {{.State.Running}} node-parachain
+          }
+          function do_docker_logs {
+                docker logs --details node-parachain  2>&1
+          }
+          function is_started {
+                if [ "$(check_container_status)" == "true" ]; then
+                        echo "Container: node-parachain RUNNING";
+                        echo "Check Docker logs"
+                        DOCKER_LOGS=$(do_docker_logs)
+                        if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then
+                                echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"
+                                return 0
+                        else
+                                echo "Message not found in logs output, repeating..."
+                                return 1
+                        fi
+                else
+                        echo "Container node-parachain NOT RUNNING"
+                        echo "Halting all future checks"
+                        exit 1
+                fi
+          echo "something goes wrong"
+          exit 1
+          }
+          while ! is_started; do
+                echo "Waiting for special message in log files "
+                sleep 30s
+                counter=$(( $counter - 1 ))
+                echo "Counter: $counter"
+                if [ "$counter" -gt "0" ]; then
+                         continue
+                else
+                         break
+                fi
+          done
+          echo "Halting script"
+          exit 0
+        shell: bash
 
-      - name: Temp Wait. Will be remove after send SIGUSER to polkadot-launch
-        run: sleep 30s
+      - name: Run tests before Node Parachain upgrade
+        run: |
+          cd tests
+          yarn install
+          yarn add mochawesome
+          echo "Ready to start tests"
+          node scripts/readyness.js
+          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}
+        env:
+          RPC_URL: http://127.0.0.1:9933/
 
-#      - name: Run tests before Node Parachain upgrade
-#        run: |
-#          cd tests
-#          yarn install
-#          yarn add mochawesome
-#          echo "Ready to start tests"
-#          node scripts/readyness.js
-#          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}
-#        env:
-#          RPC_URL: http://127.0.0.1:9933/
-#
-#      - name: Test Report Before Node upgrade
-#        uses: phoenix-actions/test-reporting@v8
-#        id: test-report-before
-#        if: success() || failure()    # run this step even if previous step failed
-#        with:
-#          name: Tests before node upgrade ${{ matrix.network }}            # Name of the check run which will be created
-#          path: tests/mochawesome-report/test-*.json    # Path to test results
-#          reporter: mochawesome-json
-#          fail-on-error: 'false'
+      - name: Test Report Before Node upgrade
+        uses: phoenix-actions/test-reporting@v8
+        id: test-report-before
+        if: success() || failure()    # run this step even if previous step failed
+        with:
+          name: Tests before node upgrade ${{ matrix.network }}            # Name of the check run which will be created
+          path: tests/mochawesome-report/test-*.json    # Path to test results
+          reporter: mochawesome-json
+          fail-on-error: 'false'
 
       - name: Send SIGUSR1 to polkadotlaunch process
         if: success()
         run: |
           #Get PID of polkadot-launch
           PID=$(docker exec node-parachain pidof 'polkadot-launch')
-          echo $PID
+          echo "Polkadot-launch PID: $PID"
           #Send SIGUSR1 signal to $PID
-          docker exec node-parachain kill -SIGUSR1 $PID
+          docker exec node-parachain kill -SIGUSR1 ${PID}
 
       #  🌗 All parachain collators restarted with the new binaries.
       - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.