From ed8bc71ecd1e6706f553e895d869db092c54376d Mon Sep 17 00:00:00 2001 From: Sergio Cazzolato Date: Mon, 23 Sep 2024 10:59:33 -0300 Subject: [PATCH 1/3] Squashed 'tests/lib/external/snapd-testing-tools/' changes from 1c8efb77e1..912131f2a6 912131f2a6 fix another shellcheck d27cc72346 update tests.pkgs to fix shellchecks 33c1d672c6 update os.query test 5a428a71ea fix shellcheck 8b423d177a support opensuse 15.6 ab1fa59719 support tests.pkgs download 1e39b307b6 udpate image names for openstack 2a85365d51 remove support for fedora-38 and ubuntu mantic 112bc0a315 append in log-filter 1d4350a818 Make sure the tools are at the begining of the path 45c2f45004 address comments 8743ceaf8c tools: fix support for multi-arch packages on apt-based systems (#54) 33aa8d1e53 fix details in remote.retry test e43b9e314d rename test libraries to avoid static check errors in snapd 4ab8b00afb New spread-filter tool (#53) cdf5cfd47b Remove centos-7 support f3996cc3fa change the spread label 1e309f41c6 change how legacy parameter is determine in remote.pull c43c35f7e3 run remote refresh and wait-for for xenial (skip bionic) 5262d30da7 make sure the test jobs are executed in runners with the spread label cb74259b7a add openstack systems 0b41fd40d3 fix tests.pkgs on arch-linux 558e109793 run fedora-40 spread tests in openstack 6f6187416d fix list implementation b4a5439c9b added more type annotatios to log_helper 58da1e36c3 mypy cleaned 1ff651e680 update wording of remote.pull 18615b1667 just usc scp -O when ssh version is -ge 9 cc68c9868b Added type annotations for log-filter 66f90d10cd Adding -O to scp command to make it compatible in uc24 tests 496cb7b5b3 removing support for centos-8 f2eef30db4 Updated the log helper and log parser 5a375ebf73 Formatting for python utils d3eed3faa5 fix codespell in CODE_OF_CONDUCT.md 18bcca6b14 new log helper d60381fcd9 add run number to filtered filename 5dde2d67b8 consider the tests execution in main 6b9a3aabcc change filtered log name b2756aa579 default file is .filtered.log 500b9dace4 Fix tests workflow 45db26a3d2 fix shellcheck error in log-filter fe45c27b7d create a var to store filter params 5a9b66d7dc filter spread results 51f9b055af New tool used to filter the spread.log output b8d20c1d5b fix snaps.name test with correct siffix spelling f640ac72e3 Add missing test details f0754df304 Filter the error y debug output in log-parser fc10196efd Add suggestions to details 94ac5ffe58 Add details on tests 501578c719 add more checks in os.query to check is-core_xx e8929207ff fix os-query for ubuntu comparing with core 226114641f os.query won't check SPREAD_SYSTEM anymore to compare core systems b89ec98b23 use local variables in os.query tool dacfd81de9 fix is_core functions 1db5214d5f Improve the remote docs (#36) 2e4a3153a2 1 more comment 3a0fc57e1e add explanation about why we check for ( Do | Doing ) 4cf8e635bf fix os.query test after merge b89b4f8647 fix artifacts name d30cee6da0 Merge remote-tracking branch 'upstream/main' 5ef5dcbe8f Tests use artifacts in spread tests (#51) 555c43d2ab Support auto-refresh with Do instead of Doing 96c2b0c19c remove tests support for ubuntu 23.04 (EoL) 74082c0c34 Tests improve remote wait (#49) 5121bfb659 remove support for opensuse leap 15.4 (#48) 30df700d08 Add new systems support (#47) 1f08938925 Support check amazon linux version (#46) 43533bdd97 Change the exit value checking for test formats (#45) 3c88244c04 Update check-test-format to support a dir and a list of files (#44) 510d95f429 add extra check for error in auto-refresh detection function 3289d4031b Try open the log with latin-1 encoding when utf-8 is not working 9db785499f improved how the tools are waiting for system reboot 2a5c4414a3 fix shellcheck errors 5e7b63883d Fixes for osquery and tests pkgs (#43) 4c9145e2ac support reboot waiting for auto-refresh 45768f5188 show changes in unknown status after refresh 8013c30c2a Remove support for ubuntu 22.10 b32b80bf54 Fix remote.rait-for test in bionic 5675c625e9 Enable fedora 38 55f4471957 Support for new oss f2e88b357c New tool used to query spread json reports cacd35ede0 utils/spread-shellcheck: explain disabled warnings (#42) c82afb2dee Support --no-install-recommends parameter when installing dependencies with tests.pkgs b84eea92e2 spread-shellcheck: fix quotes in environment variables (#41) ab1e51c29f New comparison in os-query for core systems (#40) e5ae22a5d4 systemd units can be overwritten 63540b845a Fix error messages in remote pull and push 75e8a426a5 make sure the unit is removed in tests.systemd test 9089ff5c02 Update tests to use the new tests.systemd stop-unit 44ecd5e56a Move tests.systemd stop-units to stop-unit 01a2a83b4b Update tests.systemd to have stop units as systemd.sh 162e93bd35 update tests.systemd CLI options to be the same than retry command 14aa43a405 new feature to re-run failed spread tests (#39) 604cb782db Fix shellcheck in systemd tool bfc71082c8 Update the tests.systemd to allow parameters waiting for service status 8a2d0a99df Adding quiet tool and removing set +-x from tests.pkgs d90935d2a4 A comment explaining about the default values for wait-for 3232c5dba7 Add support for ubuntu 23.04 a7164fba07 remove fedora 35 support, add fedora 37 support 89b9eb5301 Update systems supported 92bb6a0664 Include snap-sufix in the snaps.name tool git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: 912131f2a6a7d3c807c890d94fe56367aca67039 --- .github/workflows/tests.yaml | 91 ++- CODE_OF_CONDUCT.md | 2 +- remote/remote.pull | 18 +- remote/remote.push | 12 +- remote/remote.refresh | 4 +- remote/remote.setup | 2 +- remote/remote.wait-for | 76 ++- spread.yaml | 45 +- tests/check-test-format/task.yaml | 45 +- .../tasks/{task1 => task1.yaml} | 2 + .../tasks/{task2 => task2.yaml} | 2 + .../tasks/{task3 => task3.yaml} | 2 + .../tasks/{task4 => task4.yaml} | 2 - .../tasks/{task5 => task5.yaml} | 2 + .../tasks/{task6 => task6.yaml} | 2 + ...borted-and-failed-execute-and-restore.json | 86 +-- tests/log-analyzer/data/all-aborted.json | 36 +- tests/log-analyzer/data/all-failed.json | 104 ++-- .../data/all-success-failed-restore.json | 104 ++-- tests/log-analyzer/data/all-success.json | 104 ++-- .../data/failed-prepare-and-restore.json | 104 ++-- .../data/failed-prepare-project.json | 70 +-- .../data/failed-prepare-suite.json | 74 +-- .../data/failed-prepare-task.json | 144 ++--- .../data/with-aborted-and-failed-restore.json | 56 +- .../with-failed-and-failed-restore-suite.json | 493 +++++++++++++++ .../with-failed-and-failed-restore-suite.log | 79 +++ tests/log-analyzer/task.yaml | 33 +- tests/log-analyzer/tests/test-1/task.yaml | 2 + tests/log-analyzer/tests/test-2/task.yaml | 2 + tests/log-analyzer/tests/test-3/task.yaml | 2 + tests/log-analyzer/tests/test-4/task.yaml | 2 + tests/log-analyzer/tests/test-5/task.yaml | 2 + tests/log-filter/task.yaml | 51 ++ tests/log-parser/task.yaml | 54 +- tests/log-parser/with-all-results.log.spread | 3 +- tests/log-parser/with-debug-output.log.spread | 81 +++ tests/log-parser/with-error-output.log.spread | 81 +++ tests/not/task.yaml | 3 + tests/os.paths/task.yaml | 4 + tests/os.query/task.yaml | 60 +- tests/quiet/task.yaml | 12 + tests/remote.exec/task.yaml | 7 +- tests/remote.pull/task.yaml | 22 +- tests/remote.push/task.yaml | 20 +- tests/remote.refresh/task.yaml | 14 +- tests/remote.retry/task.yaml | 8 +- tests/remote.setup/task.yaml | 5 + tests/remote.wait-for/task.yaml | 14 +- tests/repack-kernel/task.yaml | 5 + tests/retry/task.yaml | 4 + tests/snaps.cleanup/task.yaml | 5 + tests/snaps.name/task.yaml | 17 + tests/spread-filter/HACKING.md | 0 tests/spread-filter/README.md | 0 tests/spread-filter/res | 1 + tests/spread-filter/rules.yaml | 33 + tests/spread-filter/source/file1 | 0 tests/spread-filter/source/file2 | 0 tests/spread-filter/source/lib1/file3 | 0 tests/spread-filter/source/lib1/lib1 | 0 tests/spread-filter/source/lib1/lib1_test.py | 0 tests/spread-filter/source/lib1/task.yaml | 6 + tests/spread-filter/source/lib2/lib2 | 0 tests/spread-filter/source/lib2/lib2_test.py | 0 .../source/lib2/lib2_test.py.back | 0 tests/spread-filter/task.yaml | 91 +++ tests/spread-filter/tests/core/other/lib1 | 0 tests/spread-filter/tests/core/other/lib2 | 0 .../spread-filter/tests/core/test1/helper.py | 0 .../spread-filter/tests/core/test1/task.yaml | 6 + .../tests/core/test2/otherfile.py | 0 .../spread-filter/tests/core/test2/task.yaml | 6 + tests/spread-filter/tests/lib/lib1.sh | 0 tests/spread-filter/tests/lib/lib2.sh | 0 tests/spread-filter/tests/lib/nested.sh | 0 .../tests/lib/tools/suite/test1/helper.sh | 0 .../tests/lib/tools/suite/test1/task.yaml | 6 + .../tests/lib/tools/suite/test2/snap/bin/sh | 0 .../lib/tools/suite/test2/snap/meta/snap.yaml | 0 .../lib/tools/suite/test2/snap/otherfile | 0 .../tests/lib/tools/suite/test2/task.yaml | 6 + .../spread-filter/tests/main/test1/task.yaml | 6 + .../spread-filter/tests/main/test11/task.yaml | 6 + .../tests/main/test1b/logs/log1.txt | 0 .../tests/main/test1b/logs/log2.txt | 0 .../spread-filter/tests/main/test1b/task.yaml | 6 + .../tests/main/test2/snap/bin/sh | 0 .../tests/main/test2/snap/meta/snap.yaml | 0 .../tests/main/test2/snap/otherfile | 0 .../spread-filter/tests/main/test2/task.yaml | 6 + .../tests/nested/test1/task.yaml | 6 + .../tests/nested/test2/snap/bin/sh | 0 .../tests/nested/test2/snap/meta/snap.yaml | 0 .../tests/nested/test2/snap/otherfile | 0 .../tests/nested/test2/task.yaml | 6 + .../tests/nested/test2/task.yaml.old | 0 tests/spread-manager/checks/task1/task.yaml | 2 + tests/spread-manager/checks/task2/task.yaml | 2 + tests/spread-manager/checks/task3/task.yaml | 2 + tests/spread-manager/checks/task4/task.yaml | 2 + tests/spread-manager/task.yaml | 4 + tests/spread-shellcheck/task.yaml | 6 + tests/tests.backup/task.yaml | 4 + tests/tests.cleanup/task.yaml | 4 + tests/tests.pkgs/task.yaml | 45 +- tests/tests.systemd/task.yaml | 47 +- tools/os.query | 113 ++-- tools/quiet | 32 + tools/snaps.name | 18 +- tools/tests.pkgs | 29 +- tools/tests.pkgs.apt.sh | 54 +- tools/tests.pkgs.dnf-yum.sh | 43 +- tools/tests.pkgs.pacman.sh | 33 +- tools/tests.pkgs.zypper.sh | 32 +- tools/tests.systemd | 97 ++- utils/check-test-format | 32 +- utils/log-analyzer | 6 +- utils/log-filter | 208 +++++++ utils/log-parser | 567 ++++++++---------- utils/log_helper.py | 193 ++++++ utils/spread-filter | 220 +++++++ utils/spread-shellcheck | 36 +- utils/spreadJ | 119 ++++ 124 files changed, 3341 insertions(+), 1074 deletions(-) rename tests/check-test-format/tasks/{task1 => task1.yaml} (83%) rename tests/check-test-format/tasks/{task2 => task2.yaml} (83%) rename tests/check-test-format/tasks/{task3 => task3.yaml} (81%) rename tests/check-test-format/tasks/{task4 => task4.yaml} (80%) rename tests/check-test-format/tasks/{task5 => task5.yaml} (86%) rename tests/check-test-format/tasks/{task6 => task6.yaml} (76%) create mode 100644 tests/log-analyzer/data/with-failed-and-failed-restore-suite.json create mode 100644 tests/log-analyzer/data/with-failed-and-failed-restore-suite.log create mode 100644 tests/log-filter/task.yaml create mode 100644 tests/log-parser/with-debug-output.log.spread create mode 100644 tests/log-parser/with-error-output.log.spread create mode 100644 tests/quiet/task.yaml create mode 100644 tests/spread-filter/HACKING.md create mode 100644 tests/spread-filter/README.md create mode 100644 tests/spread-filter/res create mode 100644 tests/spread-filter/rules.yaml create mode 100644 tests/spread-filter/source/file1 create mode 100644 tests/spread-filter/source/file2 create mode 100644 tests/spread-filter/source/lib1/file3 create mode 100644 tests/spread-filter/source/lib1/lib1 create mode 100644 tests/spread-filter/source/lib1/lib1_test.py create mode 100644 tests/spread-filter/source/lib1/task.yaml create mode 100644 tests/spread-filter/source/lib2/lib2 create mode 100644 tests/spread-filter/source/lib2/lib2_test.py create mode 100644 tests/spread-filter/source/lib2/lib2_test.py.back create mode 100644 tests/spread-filter/task.yaml create mode 100644 tests/spread-filter/tests/core/other/lib1 create mode 100644 tests/spread-filter/tests/core/other/lib2 create mode 100644 tests/spread-filter/tests/core/test1/helper.py create mode 100644 tests/spread-filter/tests/core/test1/task.yaml create mode 100644 tests/spread-filter/tests/core/test2/otherfile.py create mode 100644 tests/spread-filter/tests/core/test2/task.yaml create mode 100644 tests/spread-filter/tests/lib/lib1.sh create mode 100644 tests/spread-filter/tests/lib/lib2.sh create mode 100644 tests/spread-filter/tests/lib/nested.sh create mode 100644 tests/spread-filter/tests/lib/tools/suite/test1/helper.sh create mode 100644 tests/spread-filter/tests/lib/tools/suite/test1/task.yaml create mode 100644 tests/spread-filter/tests/lib/tools/suite/test2/snap/bin/sh create mode 100644 tests/spread-filter/tests/lib/tools/suite/test2/snap/meta/snap.yaml create mode 100644 tests/spread-filter/tests/lib/tools/suite/test2/snap/otherfile create mode 100644 tests/spread-filter/tests/lib/tools/suite/test2/task.yaml create mode 100644 tests/spread-filter/tests/main/test1/task.yaml create mode 100644 tests/spread-filter/tests/main/test11/task.yaml create mode 100644 tests/spread-filter/tests/main/test1b/logs/log1.txt create mode 100644 tests/spread-filter/tests/main/test1b/logs/log2.txt create mode 100644 tests/spread-filter/tests/main/test1b/task.yaml create mode 100644 tests/spread-filter/tests/main/test2/snap/bin/sh create mode 100644 tests/spread-filter/tests/main/test2/snap/meta/snap.yaml create mode 100644 tests/spread-filter/tests/main/test2/snap/otherfile create mode 100644 tests/spread-filter/tests/main/test2/task.yaml create mode 100644 tests/spread-filter/tests/nested/test1/task.yaml create mode 100644 tests/spread-filter/tests/nested/test2/snap/bin/sh create mode 100644 tests/spread-filter/tests/nested/test2/snap/meta/snap.yaml create mode 100644 tests/spread-filter/tests/nested/test2/snap/otherfile create mode 100644 tests/spread-filter/tests/nested/test2/task.yaml create mode 100644 tests/spread-filter/tests/nested/test2/task.yaml.old create mode 100755 tools/quiet create mode 100755 utils/log-filter create mode 100644 utils/log_helper.py create mode 100755 utils/spread-filter create mode 100755 utils/spreadJ diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3687b00003f..a1b8be7cd10 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -34,11 +34,98 @@ jobs: test: needs: [unit-tests] - runs-on: self-hosted + runs-on: [self-hosted, spread-enabled] steps: - name: Checkout code uses: actions/checkout@v2 + - name: Get previous attempt + id: get-previous-attempt + run: | + echo "previous_attempt=$(( ${{ github.run_attempt }} - 1 ))" >> $GITHUB_OUTPUT + shell: bash + + - name: Get previous cache + uses: actions/cache@v3 + with: + path: "${{ github.workspace }}/.test-results" + key: "${{ github.job }}-results-${{ github.run_id }}-${{ steps.get-previous-attempt.outputs.previous_attempt }}" + + - name: Prepare test results env and vars + id: prepare-test-results-env + run: | + # Create test results directories and save vars + TEST_RESULTS_DIR="${{ github.workspace }}/.test-results" + echo "TEST_RESULTS_DIR=$TEST_RESULTS_DIR" >> $GITHUB_ENV + + # Save the var with the failed tests file + echo "FAILED_TESTS_FILE=$TEST_RESULTS_DIR/failed-tests" >> $GITHUB_ENV + + # Make sure the test results dirs are created + # This step has to be after the cache is restored + mkdir -p "$TEST_RESULTS_DIR" + + - name: Check failed tests to run + if: "!contains(github.event.pull_request.labels.*.name, 'Run all')" + run: | + # Save previous failed test results in FAILED_TESTS env var + FAILED_TESTS="" + if [ -f "$FAILED_TESTS_FILE" ]; then + echo "Failed tests file found" + FAILED_TESTS="$(cat $FAILED_TESTS_FILE)" + if [ -n "$FAILED_TESTS" ]; then + echo "Failed tests to run: $FAILED_TESTS" + echo "FAILED_TESTS=$FAILED_TESTS" >> $GITHUB_ENV + fi + fi + - name: Run test run: | - spread google:tests/ google-nested:tests/ + RUN_TESTS="google:tests/ google-nested:tests/ openstack:tests/" + if [ -n "$FAILED_TESTS" ]; then + RUN_TESTS="$FAILED_TESTS" + fi + CHANGE_ID="${{ github.event.number }}" + if [ -z "$PR_ID" ]; then + CHANGE_ID="main" + fi + CHANGE_ID="${CHANGE_ID}_n${{ github.run_attempt }}" + # The log-filter tool is used to filter the spread logs to be stored + FILTER_PARAMS="-o spread_$CHANGE_ID.filtered.log -e Debug -e WARNING: -f Failed=NO_LINES -f Error=NO_LINES" + + (set -o pipefail; spread $RUN_TESTS | ./utils/log-filter $FILTER_PARAMS | tee spread.log) + + - name: Discard spread workers + if: always() + run: | + shopt -s nullglob; + for r in .spread-reuse.*.yaml; do + spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"; + done + + - name: analyze spread test results + if: always() + run: | + if [ -f spread.log ]; then + echo "Running spread log parser" + ./utils/log-parser spread.log --output spread-results.json + + echo "Determining which tests were executed" + RUN_TESTS="google:tests/ google-nested:tests/" + if [ -n "$FAILED_TESTS" ]; then + RUN_TESTS="$FAILED_TESTS" + fi + + echo "Running spread log analyzer" + ./utils/log-analyzer list-reexecute-tasks "$RUN_TESTS" spread-results.json > "$FAILED_TESTS_FILE" + else + echo "No spread log found, saving empty list of failed tests" + touch "$FAILED_TESTS_FILE" + fi + + - name: save spread test results to cache + if: always() + uses: actions/cache/save@v3 + with: + path: "${{ github.workspace }}/.test-results" + key: "${{ github.job }}-results-${{ github.run_id }}-${{ github.run_attempt }}" diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index eae850e8749..e8d83b7b9d1 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal +level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards diff --git a/remote/remote.pull b/remote/remote.pull index 75e006913c1..544b373c262 100755 --- a/remote/remote.pull +++ b/remote/remote.pull @@ -1,7 +1,7 @@ #!/bin/bash -e show_help() { - echo "usage: remote.pull " + echo "usage: remote.pull [LOCAL_PATH]" echo "" echo "Available options:" echo " -h --help show this help message." @@ -34,18 +34,24 @@ _get_cert() { } remote_pull() { - local REMOTE_PATH=$1 - local LOCAL_PATH=$2 - if [ -z "$LOCAL_PATH" ] || [ -z "$REMOTE_PATH" ]; then - echo "remote.pull: local and remote paths are required" + local REMOTE_PATH="$1" + local LOCAL_PATH="${2:-.}" + if [ -z "$REMOTE_PATH" ]; then + echo "remote.pull: remote path is required" fi local SSH_PASS SSH_CERT SSH_PASS="$(_get_pass)" SSH_CERT="$(_get_cert)" + LEGACY_PARAM="-O" + # We check if -O option is supported by scp + if scp -O 2>&1 | grep -q "unknown option"; then + LEGACY_PARAM="" + fi + # shellcheck disable=SC2153,SC2086 - $SSH_PASS scp $SSH_CERT -P "$TESTS_REMOTE_PORT" -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$TESTS_REMOTE_USER"@"$TESTS_REMOTE_HOST":"$1" "$2" + $SSH_PASS scp $SSH_CERT $LEGACY_PARAM -P "$TESTS_REMOTE_PORT" -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$TESTS_REMOTE_USER"@"$TESTS_REMOTE_HOST":"$REMOTE_PATH" "$LOCAL_PATH" } main() { diff --git a/remote/remote.push b/remote/remote.push index 3bd1c32146b..095be0c5590 100755 --- a/remote/remote.push +++ b/remote/remote.push @@ -1,7 +1,7 @@ #!/bin/bash -e show_help() { - echo "usage: remote.push " + echo "usage: remote.push [REMOTE_PATH]" echo "" echo "Available options:" echo " -h --help show this help message." @@ -34,10 +34,10 @@ _get_cert() { } remote_push() { - local LOCAL_PATH=$1 - local REMOTE_PATH=$2 - if [ -z "$LOCAL_PATH" ] || [ -z "$REMOTE_PATH" ]; then - echo "remote.push: local and remote paths are required" + local LOCAL_PATH="$1" + local REMOTE_PATH="${2:-}" + if [ -z "$LOCAL_PATH" ]; then + echo "remote.push: local path is required" fi local SSH_PASS SSH_CERT @@ -45,7 +45,7 @@ remote_push() { SSH_CERT="$(_get_cert)" # shellcheck disable=SC2153,SC2086 - $SSH_PASS scp $SSH_CERT -P "$TESTS_REMOTE_PORT" -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$1" "$TESTS_REMOTE_USER"@"$TESTS_REMOTE_HOST":"$2" + $SSH_PASS scp $SSH_CERT -P "$TESTS_REMOTE_PORT" -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$LOCAL_PATH" "$TESTS_REMOTE_USER"@"$TESTS_REMOTE_HOST":"$REMOTE_PATH" } main() { diff --git a/remote/remote.refresh b/remote/remote.refresh index 67278d42794..95aa0739cc6 100755 --- a/remote/remote.refresh +++ b/remote/remote.refresh @@ -2,8 +2,8 @@ show_help() { echo "usage: remote.refresh snap [--channel CHANNEL] " - echo "usage: remote.refresh full [--channel CHANNEL]" - echo "usage: remote.refresh disable-refreshes" + echo " remote.refresh full [--channel CHANNEL]" + echo " remote.refresh disable-refreshes" echo "" echo "SNAPNAME: allowed options are: kernel, core, base, gadget, snapd or the snap name" echo "" diff --git a/remote/remote.setup b/remote/remote.setup index 35e0ea694cd..89d47d04024 100755 --- a/remote/remote.setup +++ b/remote/remote.setup @@ -4,7 +4,7 @@ CFG_FILE="${REMOTE_CFG_FILE:-$(pwd)/remote.setup.cfg}" show_help() { echo "usage: remote.setup config --host --port --user [--pass ] [--cert ]" - echo "usage: remote.setup get-config-path" + echo " remote.setup get-config-path" echo "" echo "Available options:" echo " -h --help show this help message." diff --git a/remote/remote.wait-for b/remote/remote.wait-for index 3013568e7e2..a16179d8b1b 100755 --- a/remote/remote.wait-for +++ b/remote/remote.wait-for @@ -1,5 +1,7 @@ #!/bin/bash -e +# The default values have been selected trying to match with most of +# the wait times in the tests and also trying to follow common sense. DEFAULT_WAIT_FOR_SSH_ATTEMPTS=800 DEFAULT_WAIT_FOR_SSH_WAIT=1 DEFAULT_WAIT_FOR_NO_SSH_ATTEMPTS=200 @@ -150,34 +152,82 @@ wait_for_device_initialized() { echo "remote.wait-for: device initialized" } +wait_for_refresh_reboot() { + echo "remote.wait-for: waiting for refresh reboot" + + local change_id=${1:-} + local boot_id=${2:-} + if [ -z "$change_id" ] || [ -z "$boot_id" ]; then + echo "remote.wait-for: either change_id or boot_id not provided" + return 1 + fi + + wait_for_ssh "$DEFAULT_WAIT_FOR_SSH_ATTEMPTS" "$DEFAULT_WAIT_FOR_SSH_WAIT" + for _ in $(seq 5); do + # The refresh is being executed + # It checks a that refresh is in state either Do or Doing (and not Done) + if remote.exec "snap changes" | grep -Eq "$change_id.*( Do | Doing ).*(Auto-refresh|Refresh)"; then + # The systems is waiting for reboot + if remote.exec "sudo journalctl -u snapd -n 30" | grep -q "Waiting for system reboot"; then + echo "remote.wait-for: waiting for system reboot" + remote.exec "sudo reboot" || true + wait_for_no_ssh "$DEFAULT_WAIT_FOR_NO_SSH_ATTEMPTS" "$DEFAULT_WAIT_FOR_NO_SSH_WAIT" + break + fi + echo "remote.wait-for: either auto-refresh or refresh in progress" + fi + + # when the refresh has finished and no reboot needed, the function returns + if remote.exec "snap changes" | grep -Eq "$change_id.*Done.*(Auto-refresh|Refresh)"; then + echo "remote.wait-for: refresh completed, reboot not required" + return + fi + + if remote.exec "snap changes" | grep -Eq "$change_id.*Error.*(Auto-refresh|Refresh)"; then + echo "remote.wait-for: refresh finished with error" + return 1 + fi + + echo "remote.wait-for: system reboot not detected" + sleep 1 + done + wait_for_ssh "$DEFAULT_WAIT_FOR_SSH_ATTEMPTS" "$DEFAULT_WAIT_FOR_SSH_WAIT" + if [ "$(remote.exec "cat /proc/sys/kernel/random/boot_id")" == "$boot_id" ]; then + echo "remote.wait-for: boot id did not change" + return 1 + else + echo "remote.wait-for: boot id changed, refresh completed with reboot" + fi +} + wait_for_refresh(){ echo "remote.wait-for: waiting for either auto-refresh or refresh" - change_line="$(remote.exec 'snap changes' | grep -E 'Doing.*(Auto-refresh|Refresh)' || true)" + # It checks a that refresh is in state either Do or Doing (and not Done) + change_line="$(remote.exec 'snap changes' | grep -E '( Do | Doing ).*(Auto-refresh|Refresh)' || true)" if [ -n "$change_line" ]; then - echo "remote.wait-for: Refresh in progress" + echo "remote.wait-for: refresh in progress" change_id="$(echo "$change_line" | awk '{ print $1 }')" + boot_id="$(remote.exec "cat /proc/sys/kernel/random/boot_id")" - while remote.exec "snap changes" | grep -Eq "$change_id.*Doing.*(Auto-refresh|Refresh)"; do - echo -n '.' - if remote.exec "true" &>/dev/null; then - sleep 1 + for _ in $(seq 20); do + if wait_for_refresh_reboot "$change_id" "$boot_id"; then + break fi done echo "" - if ! remote.exec "true" &>/dev/null; then - wait_for_ssh "$DEFAULT_WAIT_FOR_SSH_ATTEMPTS" "$DEFAULT_WAIT_FOR_SSH_WAIT" - fi - - if remote.exec "snap changes" | grep -Eq "$change_id.*Doing.*(Auto-refresh|Refresh)"; then + changes="$(remote.exec 'snap changes')" + # It checks a that refresh is in state either Do or Doing (and not Done) + if echo "$changes" | grep -Eq "$change_id.*( Do | Doing ).*(Auto-refresh|Refresh)"; then echo "remote.wait-for: still doing refresh, exiting" - elif remote.exec "snap changes" | grep -Eq "$change_id.*Error.*(Auto-refresh|Refresh)"; then + elif echo "$changes" | grep -Eq "$change_id.*Error.*(Auto-refresh|Refresh)"; then echo "remote.wait-for: refresh failed" - elif remote.exec "snap changes" | grep -Eq "$change_id.*Done.*(Auto-refresh|Refresh)"; then + elif echo "$changes" | grep -Eq "$change_id.*Done.*(Auto-refresh|Refresh)"; then echo "remote.wait-for: refresh completed" else echo "remote.wait-for: refresh results unknown" + echo "$changes" return 1 fi else diff --git a/spread.yaml b/spread.yaml index fd85be01b13..9282cc06ed4 100644 --- a/spread.yaml +++ b/spread.yaml @@ -2,7 +2,7 @@ project: snapd-testing-tools environment: PROJECT_PATH: /root/snapd-testing-tools - PATH: $PATH:$PROJECT_PATH/tools:$PROJECT_PATH/utils:$PROJECT_PATH/remote + PATH: $PROJECT_PATH/tools:$PROJECT_PATH/utils:$PROJECT_PATH/remote:$PATH backends: google: @@ -16,23 +16,20 @@ backends: - ubuntu-18.04-64: - ubuntu-20.04-64: - ubuntu-22.04-64: - - ubuntu-22.10-64: - - debian-10-64: + - ubuntu-24.04-64: - debian-11-64: - - debian-sid-64: - - fedora-35-64: - - fedora-36-64: + - debian-12-64: + - debian-sid-64: + - fedora-39-64: - arch-linux-64: - amazon-linux-2-64: storage: preserve-size - - centos-7-64: - storage: preserve-size - - centos-8-64: + - amazon-linux-2023-64: storage: preserve-size - centos-9-64: storage: preserve-size - - opensuse-15.3-64: - - opensuse-15.4-64: + - opensuse-15.5-64: + - opensuse-15.6-64: - opensuse-tumbleweed-64: google-nested: @@ -46,7 +43,29 @@ backends: - ubuntu-20.04-64: image: ubuntu-2004-64-virt-enabled storage: 20G - workers: 1 + + openstack: + key: '$(HOST: echo "$SPREAD_OPENSTACK_ENV")' + plan: staging-cpu2-ram4-disk50 + halt-timeout: 2h + groups: [default] + environment: + HTTP_PROXY: 'http://squid.internal:3128' + HTTPS_PROXY: 'http://squid.internal:3128' + NO_PROXY: 'canonical.com' + systems: + - ubuntu-22.04-64: + image: snapd-spread/ubuntu-22.04-64 + - ubuntu-24.04-64: + image: snapd-spread/ubuntu-24.04-64 + - fedora-40-64: + image: snapd-spread/fedora-40-64 + - opensuse-15.5-64: + image: snapd-spread/opensuse-15.5-64 + - centos-9-64: + image: snapd-spread/centos-9-64 + - debian-12-64: + image: snapd-spread/debian-12-64 path: /root/snapd-testing-tools @@ -62,7 +81,7 @@ restore: | suites: tests/: - summary: Main test suite for snapd-testing-tools + summary: Main test suite for snapd-testing-tools project prepare: | echo "Preparing snapd-testing-tools main suite" # Create users for the tests diff --git a/tests/check-test-format/task.yaml b/tests/check-test-format/task.yaml index 0fc9b63a737..c421e818359 100644 --- a/tests/check-test-format/task.yaml +++ b/tests/check-test-format/task.yaml @@ -1,5 +1,9 @@ summary: smoke test for the spread checker tool +details: | + Verify that the check-test-format tool checks properly the desired + order and mandatory keys in spread tasks. + backends: [google] systems: [ ubuntu-20.04-64 ] @@ -13,33 +17,30 @@ restore: | execute: | check-test-format -h | MATCH "usage: check-test-format" - # Check the format of the spread tests in this project - check-test-format "$PROJECT_PATH/tests" + # Check failing tasks with order not desired + check-test-format --tests "$PWD/tasks/task1.yaml" 2>&1 | MATCH "Keys 'execute' and 'prepare' do not follow the desired order" - # Check failing tasks - cp "$PWD/tasks/task1" "$PWD/tasks/task.yaml" - check-test-format "$PWD/tasks" 2>&1 | MATCH "Keys 'execute' and 'prepare' do not follow the desired order" - rm "$PWD/tasks/task.yaml" + check-test-format --tests "$PWD/tasks/task2.yaml" 2>&1 | MATCH "Keys 'execute' and 'restore' do not follow the desired order" - cp "$PWD/tasks/task2" "$PWD/tasks/task.yaml" - check-test-format "$PWD/tasks" 2>&1 | MATCH "Keys 'execute' and 'restore' do not follow the desired order" - rm "$PWD/tasks/task.yaml" + check-test-format --tests "$PWD/tasks/task3.yaml" 2>&1 | MATCH "Keys 'systems' and 'backends' do not follow the desired order" + check-test-format --tests "$PWD/tasks/task3.yaml" 2>&1 | MATCH "Key 'execute' is mandatory" - cp "$PWD/tasks/task3" "$PWD/tasks/task.yaml" - check-test-format "$PWD/tasks" 2>&1 | MATCH "Keys 'systems' and 'backends' do not follow the desired order" - check-test-format "$PWD/tasks" 2>&1 | MATCH "Key 'execute' is mandatory" - rm "$PWD/tasks/task.yaml" + # Check passing a file with more than 1 error + check-test-format --tests "$PWD/tasks/task4.yaml" 2>&1 | MATCH "Keys 'environment' and 'systems' do not follow the desired order" + check-test-format --tests "$PWD/tasks/task4.yaml" 2>&1 | MATCH "Key 'details' is mandatory" - cp "$PWD/tasks/task4" "$PWD/tasks/task.yaml" - check-test-format "$PWD/tasks" 2>&1 | MATCH "Keys 'environment' and 'systems' do not follow the desired order" - check-test-format "$PWD/tasks" 2>&1 | MATCH "Key 'execute' is mandatory" - rm "$PWD/tasks/task.yaml" + # Check passing a file with a non supported section + check-test-format --tests "$PWD/tasks/task5.yaml" 2>&1 | MATCH "key 'unsupported' is not among the supported keys" - cp "$PWD/tasks/task5" "$PWD/tasks/task.yaml" - check-test-format "$PWD/tasks" 2>&1 | MATCH "key 'unsupported' is not among the supported keys" - rm "$PWD/tasks/task.yaml" + # Check passing more than 1 file to the tool + check-test-format --tests "$PWD/tasks/task4.yaml" "$PWD/tasks/task5.yaml" 2>&1 | MATCH "Key 'details' is mandatory" + check-test-format --tests "$PWD/tasks/task4.yaml" "$PWD/tasks/task5.yaml" 2>&1 | MATCH "key 'unsupported' is not among the supported keys" - cp "$PWD/tasks/task6" "$PWD/tasks/task.yaml" + # Check passing a file with a non supported format + # Check passing a dir + cp "$PWD/tasks/task6.yaml" "$PWD/tasks/task.yaml" echo "newtext" >> "$PWD/tasks/task.yaml" - check-test-format "$PWD/tasks" 2>&1 | MATCH "Invalid task format, checks failed for task" + check-test-format --tests "$PWD/tasks/task.yaml" 2>&1 | MATCH "Invalid task format, checks failed for task" + check-test-format --dir "$PWD/tasks/" 2>&1 | MATCH "Invalid task format, checks failed for task" + check-test-format --dir "$PWD/tasks/" 2>&1 | NOMATCH "Key 'execute' is mandatory" rm "$PWD/tasks/task.yaml" diff --git a/tests/check-test-format/tasks/task1 b/tests/check-test-format/tasks/task1.yaml similarity index 83% rename from tests/check-test-format/tasks/task1 rename to tests/check-test-format/tasks/task1.yaml index fd2d85fc00a..90ecfe6cbab 100644 --- a/tests/check-test-format/tasks/task1 +++ b/tests/check-test-format/tasks/task1.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: details + execute: | echo "execute" diff --git a/tests/check-test-format/tasks/task2 b/tests/check-test-format/tasks/task2.yaml similarity index 83% rename from tests/check-test-format/tasks/task2 rename to tests/check-test-format/tasks/task2.yaml index 18b21724c88..9e02ee75128 100644 --- a/tests/check-test-format/tasks/task2 +++ b/tests/check-test-format/tasks/task2.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: details + execute: | echo "execute" diff --git a/tests/check-test-format/tasks/task3 b/tests/check-test-format/tasks/task3.yaml similarity index 81% rename from tests/check-test-format/tasks/task3 rename to tests/check-test-format/tasks/task3.yaml index 4ce4fbd7d8b..55989a175d4 100644 --- a/tests/check-test-format/tasks/task3 +++ b/tests/check-test-format/tasks/task3.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: details + systems: [ ubuntu-20.04-64 ] backends: [ google ] diff --git a/tests/check-test-format/tasks/task4 b/tests/check-test-format/tasks/task4.yaml similarity index 80% rename from tests/check-test-format/tasks/task4 rename to tests/check-test-format/tasks/task4.yaml index 2a3e036ecba..c712c79f503 100644 --- a/tests/check-test-format/tasks/task4 +++ b/tests/check-test-format/tasks/task4.yaml @@ -1,7 +1,5 @@ summary: this is the summary -details: no details - environment: TEST: 1 diff --git a/tests/check-test-format/tasks/task5 b/tests/check-test-format/tasks/task5.yaml similarity index 86% rename from tests/check-test-format/tasks/task5 rename to tests/check-test-format/tasks/task5.yaml index e619daaf85a..ff45b068c14 100644 --- a/tests/check-test-format/tasks/task5 +++ b/tests/check-test-format/tasks/task5.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: details + unsupported: not supported systems: [ ubuntu-20.04-64 ] diff --git a/tests/check-test-format/tasks/task6 b/tests/check-test-format/tasks/task6.yaml similarity index 76% rename from tests/check-test-format/tasks/task6 rename to tests/check-test-format/tasks/task6.yaml index 0a189d15de0..e42a4092a1a 100644 --- a/tests/check-test-format/tasks/task6 +++ b/tests/check-test-format/tasks/task6.yaml @@ -1,4 +1,6 @@ summary: this is the summary +details: details + execute: | echo "execute" diff --git a/tests/log-analyzer/data/aborted-and-failed-execute-and-restore.json b/tests/log-analyzer/data/aborted-and-failed-execute-and-restore.json index 258d7bd218c..bba7f98d2cc 100644 --- a/tests/log-analyzer/data/aborted-and-failed-execute-and-restore.json +++ b/tests/log-analyzer/data/aborted-and-failed-execute-and-restore.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:06", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:06", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:15", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-20.04-64 (may242137-942824) to boot at 34.75.199.115..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:20", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-22.04-64 (may242137-942720) to boot at 34.75.71.82..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:57", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242137-942720)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:57", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242137-942720)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:58", "verb": "Connected", @@ -56,7 +56,7 @@ "extra": "to google:ubuntu-22.04-64 (may242137-942720) at 34.75.71.82." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:37:58", "verb": "Sending", @@ -64,14 +64,14 @@ "extra": "project content to google:ubuntu-22.04-64 (may242137-942720)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:02", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:38:02", "verb": "Allocated", @@ -79,7 +79,7 @@ "extra": "google:ubuntu-20.04-64 (may242137-942824)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:38:02", "verb": "Connecting", @@ -87,21 +87,21 @@ "extra": "to google:ubuntu-20.04-64 (may242137-942824)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:02", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:03", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:38:04", "verb": "Connected", @@ -109,7 +109,7 @@ "extra": "to google:ubuntu-20.04-64 (may242137-942824) at 34.75.199.115." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:38:04", "verb": "Sending", @@ -117,28 +117,28 @@ "extra": "project content to google:ubuntu-20.04-64 (may242137-942824)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:04", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:04", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:05", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:05", "verb": "Executing", @@ -164,14 +164,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:06", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:06", "verb": "Preparing", @@ -197,35 +197,35 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:06", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:07", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:07", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:07", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:38:07", "verb": "Discarding", @@ -233,91 +233,91 @@ "extra": "google:ubuntu-22.04-64 (may242137-942720)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:08", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:08", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:09", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:09", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:10", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:10", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:11", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:11", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:12", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:12", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:13", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:13", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:14", "verb": "Executing", @@ -343,7 +343,7 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:14", "verb": "Restoring", @@ -369,21 +369,21 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:15", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:38:15", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:38:16", "verb": "Discarding", diff --git a/tests/log-analyzer/data/all-aborted.json b/tests/log-analyzer/data/all-aborted.json index 6e2424bf22d..75d79549df9 100644 --- a/tests/log-analyzer/data/all-aborted.json +++ b/tests/log-analyzer/data/all-aborted.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:06:40", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:06:40", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:06:49", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-22.04-64 (may242106-435572) to boot at 34.148.101.55..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:06:50", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-20.04-64 (may242106-435744) to boot at 34.148.4.171..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:30", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242106-435572)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:30", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242106-435572)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:32", "verb": "Connected", @@ -56,7 +56,7 @@ "extra": "to google:ubuntu-22.04-64 (may242106-435572) at 34.148.101.55." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:32", "verb": "Sending", @@ -64,7 +64,7 @@ "extra": "project content to google:ubuntu-22.04-64 (may242106-435572)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:07:36", "verb": "Preparing", @@ -90,14 +90,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:07:37", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:37", "verb": "Discarding", @@ -105,7 +105,7 @@ "extra": "google:ubuntu-22.04-64 (may242106-435572)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:41", "verb": "Allocated", @@ -113,7 +113,7 @@ "extra": "google:ubuntu-20.04-64 (may242106-435744)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:41", "verb": "Connecting", @@ -121,7 +121,7 @@ "extra": "to google:ubuntu-20.04-64 (may242106-435744)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:42", "verb": "Connected", @@ -129,7 +129,7 @@ "extra": "to google:ubuntu-20.04-64 (may242106-435744) at 34.148.4.171." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:42", "verb": "Sending", @@ -137,7 +137,7 @@ "extra": "project content to google:ubuntu-20.04-64 (may242106-435744)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:07:46", "verb": "Preparing", @@ -163,14 +163,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:07:47", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:07:47", "verb": "Discarding", diff --git a/tests/log-analyzer/data/all-failed.json b/tests/log-analyzer/data/all-failed.json index dea8ba7a855..705011ad771 100644 --- a/tests/log-analyzer/data/all-failed.json +++ b/tests/log-analyzer/data/all-failed.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:52:29", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:52:29", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:52:39", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-20.04-64 (may242052-202754) to boot at 34.139.205.254..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:52:43", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-22.04-64 (may242052-202652) to boot at 104.196.209.131..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:24", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242052-202652)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:24", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242052-202652)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:25", "verb": "Allocated", @@ -56,7 +56,7 @@ "extra": "google:ubuntu-20.04-64 (may242052-202754)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:25", "verb": "Connecting", @@ -64,7 +64,7 @@ "extra": "to google:ubuntu-20.04-64 (may242052-202754)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:26", "verb": "Connected", @@ -72,7 +72,7 @@ "extra": "to google:ubuntu-22.04-64 (may242052-202652) at 104.196.209.131." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:26", "verb": "Sending", @@ -80,7 +80,7 @@ "extra": "project content to google:ubuntu-22.04-64 (may242052-202652)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:26", "verb": "Connected", @@ -88,7 +88,7 @@ "extra": "to google:ubuntu-20.04-64 (may242052-202754) at 34.139.205.254." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:26", "verb": "Sending", @@ -96,49 +96,49 @@ "extra": "project content to google:ubuntu-20.04-64 (may242052-202754)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:28", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:29", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:29", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:29", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:30", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:30", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:30", "verb": "Preparing", @@ -164,14 +164,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:31", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:31", "verb": "Executing", @@ -197,35 +197,35 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:31", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:31", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:32", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:32", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:32", "verb": "Executing", @@ -251,7 +251,7 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:33", "verb": "Restoring", @@ -277,35 +277,35 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:33", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:33", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:33", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:34", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:34", "verb": "Executing", @@ -331,7 +331,7 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:34", "verb": "Restoring", @@ -357,28 +357,28 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:35", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:35", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:35", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:35", "verb": "Preparing", @@ -404,21 +404,21 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:36", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:36", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:36", "verb": "Preparing", @@ -444,21 +444,21 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:36", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:37", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:37", "verb": "Preparing", @@ -484,28 +484,28 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:37", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:38", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:38", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:38", "verb": "Restoring", @@ -531,14 +531,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:38", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:39", "verb": "Discarding", @@ -546,21 +546,21 @@ "extra": "google:ubuntu-20.04-64 (may242052-202754)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:39", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:53:40", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:53:41", "verb": "Discarding", diff --git a/tests/log-analyzer/data/all-success-failed-restore.json b/tests/log-analyzer/data/all-success-failed-restore.json index 48bd65cb9e0..f3b10547ef7 100644 --- a/tests/log-analyzer/data/all-success-failed-restore.json +++ b/tests/log-analyzer/data/all-success-failed-restore.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:42:58", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:42:58", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:43:07", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-22.04-64 (may242043-312411) to boot at 34.148.59.204..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:43:07", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-20.04-64 (may242043-312500) to boot at 34.138.215.109..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:43:43", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242043-312411)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:43:43", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242043-312411)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:43:45", "verb": "Connected", @@ -56,7 +56,7 @@ "extra": "to google:ubuntu-22.04-64 (may242043-312411) at 34.148.59.204." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:43:45", "verb": "Sending", @@ -64,133 +64,133 @@ "extra": "project content to google:ubuntu-22.04-64 (may242043-312411)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:50", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:50", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:51", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:52", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:52", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:53", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:54", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:55", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:55", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:56", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:56", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:57", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:58", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:58", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:43:59", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:00", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:00", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:01", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:02", "verb": "Restoring", @@ -216,7 +216,7 @@ } }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:44:02", "verb": "Discarding", @@ -224,7 +224,7 @@ "extra": "google:ubuntu-22.04-64 (may242043-312411)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:44:04", "verb": "Allocated", @@ -232,7 +232,7 @@ "extra": "google:ubuntu-20.04-64 (may242043-312500)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:44:04", "verb": "Connecting", @@ -240,7 +240,7 @@ "extra": "to google:ubuntu-20.04-64 (may242043-312500)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:44:05", "verb": "Connected", @@ -248,7 +248,7 @@ "extra": "to google:ubuntu-20.04-64 (may242043-312500) at 34.138.215.109." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:44:05", "verb": "Sending", @@ -256,133 +256,133 @@ "extra": "project content to google:ubuntu-20.04-64 (may242043-312500)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:08", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:08", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:09", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:09", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:10", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:10", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:11", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:11", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:12", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:13", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:13", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:14", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:14", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:15", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:15", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:16", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:16", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:17", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:44:17", "verb": "Restoring", @@ -408,7 +408,7 @@ } }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:44:18", "verb": "Discarding", diff --git a/tests/log-analyzer/data/all-success.json b/tests/log-analyzer/data/all-success.json index 962875f414d..b3560db03df 100644 --- a/tests/log-analyzer/data/all-success.json +++ b/tests/log-analyzer/data/all-success.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:45:05", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:45:05", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:45:14", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-22.04-64 (may242045-878680) to boot at 35.237.221.225..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:45:15", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-20.04-64 (may242045-878764) to boot at 34.148.94.157..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:00", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242045-878680)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:00", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242045-878680)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:02", "verb": "Connected", @@ -56,7 +56,7 @@ "extra": "to google:ubuntu-22.04-64 (may242045-878680) at 35.237.221.225." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:02", "verb": "Sending", @@ -64,77 +64,77 @@ "extra": "project content to google:ubuntu-22.04-64 (may242045-878680)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:06", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:06", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:07", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:08", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:08", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:09", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:09", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:10", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:10", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:11", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:11", "verb": "Allocated", @@ -142,7 +142,7 @@ "extra": "google:ubuntu-20.04-64 (may242045-878764)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:11", "verb": "Connecting", @@ -150,21 +150,21 @@ "extra": "to google:ubuntu-20.04-64 (may242045-878764)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:11", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:12", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:12", "verb": "Connected", @@ -172,7 +172,7 @@ "extra": "to google:ubuntu-20.04-64 (may242045-878764) at 34.148.94.157." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:12", "verb": "Sending", @@ -180,63 +180,63 @@ "extra": "project content to google:ubuntu-20.04-64 (may242045-878764)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:12", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:13", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:13", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:14", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:14", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:15", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:15", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:15", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:16", "verb": "Discarding", @@ -244,133 +244,133 @@ "extra": "google:ubuntu-22.04-64 (may242045-878680)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:16", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:17", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:17", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:18", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:19", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:19", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:20", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:20", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:21", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:22", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:22", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:23", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:24", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:24", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:25", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:25", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:26", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:46:27", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:46:27", "verb": "Discarding", diff --git a/tests/log-analyzer/data/failed-prepare-and-restore.json b/tests/log-analyzer/data/failed-prepare-and-restore.json index 57fba41b389..ff09ea561aa 100644 --- a/tests/log-analyzer/data/failed-prepare-and-restore.json +++ b/tests/log-analyzer/data/failed-prepare-and-restore.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:56:26", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:56:26", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:56:26", "verb": "Allocating", @@ -24,7 +24,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:56:36", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-20.04-64 (may242056-644336) to boot at 35.185.37.159..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:56:41", "verb": "Waiting", @@ -40,7 +40,7 @@ "extra": "for google:ubuntu-22.04-64 (may242056-644230) to boot at 34.75.94.174..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:56:42", "verb": "Waiting", @@ -48,7 +48,7 @@ "extra": "for google:ubuntu-20.04-64 (may242056-644428) to boot at 34.138.43.204..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:17", "verb": "Allocated", @@ -56,7 +56,7 @@ "extra": "google:ubuntu-22.04-64 (may242056-644230)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:17", "verb": "Connecting", @@ -64,7 +64,7 @@ "extra": "to google:ubuntu-22.04-64 (may242056-644230)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:19", "verb": "Connected", @@ -72,7 +72,7 @@ "extra": "to google:ubuntu-22.04-64 (may242056-644230) at 34.75.94.174." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:19", "verb": "Sending", @@ -80,7 +80,7 @@ "extra": "project content to google:ubuntu-22.04-64 (may242056-644230)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:22", "verb": "Allocated", @@ -88,7 +88,7 @@ "extra": "google:ubuntu-20.04-64 (may242056-644336)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:22", "verb": "Connecting", @@ -96,14 +96,14 @@ "extra": "to google:ubuntu-20.04-64 (may242056-644336)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:23", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:24", "verb": "Allocated", @@ -111,7 +111,7 @@ "extra": "google:ubuntu-20.04-64 (may242056-644428)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:24", "verb": "Connecting", @@ -119,7 +119,7 @@ "extra": "to google:ubuntu-20.04-64 (may242056-644428)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:24", "verb": "Connected", @@ -127,7 +127,7 @@ "extra": "to google:ubuntu-20.04-64 (may242056-644336) at 35.185.37.159." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:24", "verb": "Sending", @@ -135,21 +135,21 @@ "extra": "project content to google:ubuntu-20.04-64 (may242056-644336)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:24", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:25", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:25", "verb": "Connected", @@ -157,7 +157,7 @@ "extra": "to google:ubuntu-20.04-64 (may242056-644428) at 34.138.43.204." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:25", "verb": "Sending", @@ -165,42 +165,42 @@ "extra": "project content to google:ubuntu-20.04-64 (may242056-644428)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:26", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:26", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:27", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:27", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:27", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:28", "verb": "Preparing", @@ -226,21 +226,21 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:28", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:28", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:28", "verb": "Preparing", @@ -266,49 +266,49 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:28", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:29", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:29", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:29", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:29", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:29", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:29", "verb": "Discarding", @@ -316,42 +316,42 @@ "extra": "google:ubuntu-22.04-64 (may242056-644230)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:30", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:30", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:30", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:30", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:31", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:31", "verb": "Preparing", @@ -377,14 +377,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:31", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:32", "verb": "Executing", @@ -410,42 +410,42 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:32", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:32", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:33", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:33", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:57:33", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:34", "verb": "Discarding", @@ -453,7 +453,7 @@ "extra": "google:ubuntu-20.04-64 (may242056-644336)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:57:34", "verb": "Discarding", diff --git a/tests/log-analyzer/data/failed-prepare-project.json b/tests/log-analyzer/data/failed-prepare-project.json index 3a443963725..ed7da17ea32 100644 --- a/tests/log-analyzer/data/failed-prepare-project.json +++ b/tests/log-analyzer/data/failed-prepare-project.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:04:51", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:04:51", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:00", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-22.04-64 (may242104-523536) to boot at 34.148.146.189..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:05", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-20.04-64 (may242104-523644) to boot at 35.185.103.64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:42", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242104-523536)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:42", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242104-523536)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:43", "verb": "Connected", @@ -56,7 +56,7 @@ "extra": "to google:ubuntu-22.04-64 (may242104-523536) at 34.148.146.189." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:43", "verb": "Sending", @@ -64,140 +64,140 @@ "extra": "project content to google:ubuntu-22.04-64 (may242104-523536)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:47", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:48", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:48", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:49", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:49", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:50", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:50", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:50", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:51", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:52", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:52", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:53", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:53", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:54", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:54", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:55", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:55", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:56", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:05:56", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:57", "verb": "Allocated", @@ -205,7 +205,7 @@ "extra": "google:ubuntu-20.04-64 (may242104-523644)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:57", "verb": "Connecting", @@ -213,7 +213,7 @@ "extra": "to google:ubuntu-20.04-64 (may242104-523644)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:57", "verb": "Discarding", @@ -221,7 +221,7 @@ "extra": "google:ubuntu-22.04-64 (may242104-523536)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:58", "verb": "Connected", @@ -229,7 +229,7 @@ "extra": "to google:ubuntu-20.04-64 (may242104-523644) at 35.185.103.64." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:05:58", "verb": "Sending", @@ -237,7 +237,7 @@ "extra": "project content to google:ubuntu-20.04-64 (may242104-523644)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:06:01", "verb": "Preparing", @@ -264,14 +264,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:06:01", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:06:02", "verb": "Discarding", diff --git a/tests/log-analyzer/data/failed-prepare-suite.json b/tests/log-analyzer/data/failed-prepare-suite.json index 27bab6cd49d..cd370c3b704 100644 --- a/tests/log-analyzer/data/failed-prepare-suite.json +++ b/tests/log-analyzer/data/failed-prepare-suite.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:02:09", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:02:09", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:02:17", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-22.04-64 (may242102-500954) to boot at 34.138.163.49..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:02:18", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-20.04-64 (may242102-501054) to boot at 35.227.118.17..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:04", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242102-500954)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:04", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242102-500954)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:05", "verb": "Connected", @@ -56,7 +56,7 @@ "extra": "to google:ubuntu-22.04-64 (may242102-500954) at 34.138.163.49." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:05", "verb": "Sending", @@ -64,7 +64,7 @@ "extra": "project content to google:ubuntu-22.04-64 (may242102-500954)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:09", "verb": "Allocated", @@ -72,7 +72,7 @@ "extra": "google:ubuntu-20.04-64 (may242102-501054)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:09", "verb": "Connecting", @@ -80,14 +80,14 @@ "extra": "to google:ubuntu-20.04-64 (may242102-501054)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:09", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:11", "verb": "Connected", @@ -95,7 +95,7 @@ "extra": "to google:ubuntu-20.04-64 (may242102-501054) at 35.227.118.17." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:11", "verb": "Sending", @@ -103,63 +103,63 @@ "extra": "project content to google:ubuntu-20.04-64 (may242102-501054)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:11", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:11", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:12", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:12", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:13", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:13", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:14", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:14", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:14", "verb": "Restoring", @@ -184,28 +184,28 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:14", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:15", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:15", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:15", "verb": "Discarding", @@ -213,77 +213,77 @@ "extra": "google:ubuntu-20.04-64 (may242102-501054)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:15", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:16", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:17", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:17", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:18", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:19", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:20", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:20", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:21", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "18:03:22", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "18:03:22", "verb": "Discarding", diff --git a/tests/log-analyzer/data/failed-prepare-task.json b/tests/log-analyzer/data/failed-prepare-task.json index ce9c10afffb..9af0c03c951 100644 --- a/tests/log-analyzer/data/failed-prepare-task.json +++ b/tests/log-analyzer/data/failed-prepare-task.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:58:47", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:58:47", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:58:47", "verb": "Allocating", @@ -24,7 +24,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:58:47", "verb": "Allocating", @@ -32,7 +32,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:58:56", "verb": "Waiting", @@ -40,7 +40,7 @@ "extra": "for google:ubuntu-22.04-64 (may242058-071834) to boot at 34.75.85.33..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:58:56", "verb": "Waiting", @@ -48,7 +48,7 @@ "extra": "for google:ubuntu-20.04-64 (may242058-071935) to boot at 104.196.44.113..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:58:57", "verb": "Waiting", @@ -56,7 +56,7 @@ "extra": "for google:ubuntu-20.04-64 (may242058-072004) to boot at 35.196.115.140..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:02", "verb": "Waiting", @@ -64,7 +64,7 @@ "extra": "for google:ubuntu-22.04-64 (may242058-072021) to boot at 34.139.4.50..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:32", "verb": "Allocated", @@ -72,7 +72,7 @@ "extra": "google:ubuntu-22.04-64 (may242058-071834)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:32", "verb": "Connecting", @@ -80,7 +80,7 @@ "extra": "to google:ubuntu-22.04-64 (may242058-071834)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:33", "verb": "Connected", @@ -88,7 +88,7 @@ "extra": "to google:ubuntu-22.04-64 (may242058-071834) at 34.75.85.33." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:33", "verb": "Sending", @@ -96,28 +96,28 @@ "extra": "project content to google:ubuntu-22.04-64 (may242058-071834)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:37", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:38", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:38", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:38", "verb": "Allocated", @@ -125,7 +125,7 @@ "extra": "google:ubuntu-22.04-64 (may242058-072021)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:38", "verb": "Connecting", @@ -152,21 +152,21 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:39", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:39", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:40", "verb": "Connected", @@ -174,7 +174,7 @@ "extra": "to google:ubuntu-22.04-64 (may242058-072021) at 34.139.4.50." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:40", "verb": "Sending", @@ -182,49 +182,49 @@ "extra": "project content to google:ubuntu-22.04-64 (may242058-072021)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:40", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:40", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:41", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:41", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:42", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:42", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:43", "verb": "Allocated", @@ -232,7 +232,7 @@ "extra": "google:ubuntu-20.04-64 (may242058-072004)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:43", "verb": "Connecting", @@ -240,42 +240,42 @@ "extra": "to google:ubuntu-20.04-64 (may242058-072004)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:43", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:43", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:43", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:44", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:44", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:44", "verb": "Connected", @@ -283,7 +283,7 @@ "extra": "to google:ubuntu-20.04-64 (may242058-072004) at 35.196.115.140." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:44", "verb": "Sending", @@ -291,28 +291,28 @@ "extra": "project content to google:ubuntu-20.04-64 (may242058-072004)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:44", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:44", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:45", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:45", "verb": "Discarding", @@ -320,28 +320,28 @@ "extra": "google:ubuntu-22.04-64 (may242058-071834)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:45", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:46", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:46", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:47", "verb": "Discarding", @@ -349,7 +349,7 @@ "extra": "google:ubuntu-22.04-64 (may242058-072021)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:47", "verb": "Allocated", @@ -357,7 +357,7 @@ "extra": "google:ubuntu-20.04-64 (may242058-071935)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:47", "verb": "Connecting", @@ -365,7 +365,7 @@ "extra": "to google:ubuntu-20.04-64 (may242058-071935)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:49", "verb": "Connected", @@ -373,7 +373,7 @@ "extra": "to google:ubuntu-20.04-64 (may242058-071935) at 104.196.44.113." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:49", "verb": "Sending", @@ -381,126 +381,126 @@ "extra": "project content to google:ubuntu-20.04-64 (may242058-071935)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:50", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:50", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:51", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:51", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:52", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:52", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:52", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:53", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:53", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:53", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:53", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-3" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:54", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:54", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:55", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:55", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-4" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:55", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-2" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:56", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:56", "verb": "Restoring", @@ -526,35 +526,35 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:56", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:56", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:57", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:59:57", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:57", "verb": "Discarding", @@ -562,7 +562,7 @@ "extra": "google:ubuntu-20.04-64 (may242058-072004)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:59:58", "verb": "Discarding", diff --git a/tests/log-analyzer/data/with-aborted-and-failed-restore.json b/tests/log-analyzer/data/with-aborted-and-failed-restore.json index 904d43c850f..8d5dbbd9876 100644 --- a/tests/log-analyzer/data/with-aborted-and-failed-restore.json +++ b/tests/log-analyzer/data/with-aborted-and-failed-restore.json @@ -1,6 +1,6 @@ [ { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:47:36", "verb": "Allocating", @@ -8,7 +8,7 @@ "extra": "google:ubuntu-22.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:47:36", "verb": "Allocating", @@ -16,7 +16,7 @@ "extra": "google:ubuntu-20.04-64..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:47:46", "verb": "Waiting", @@ -24,7 +24,7 @@ "extra": "for google:ubuntu-20.04-64 (may242047-566476) to boot at 104.196.212.243..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:47:46", "verb": "Waiting", @@ -32,7 +32,7 @@ "extra": "for google:ubuntu-22.04-64 (may242047-566626) to boot at 34.75.76.3..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:32", "verb": "Allocated", @@ -40,7 +40,7 @@ "extra": "google:ubuntu-22.04-64 (may242047-566626)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:32", "verb": "Connecting", @@ -48,7 +48,7 @@ "extra": "to google:ubuntu-22.04-64 (may242047-566626)..." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:34", "verb": "Connected", @@ -56,7 +56,7 @@ "extra": "to google:ubuntu-22.04-64 (may242047-566626) at 34.75.76.3." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:34", "verb": "Sending", @@ -64,42 +64,42 @@ "extra": "project content to google:ubuntu-22.04-64 (may242047-566626)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:39", "verb": "Preparing", "task": "google:ubuntu-22.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:40", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:40", "verb": "Preparing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:41", "verb": "Executing", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:42", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/test-5" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:42", "verb": "Allocated", @@ -107,7 +107,7 @@ "extra": "google:ubuntu-20.04-64 (may242047-566476)." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:42", "verb": "Connecting", @@ -134,14 +134,14 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:43", "verb": "Restoring", "task": "google:ubuntu-22.04-64:tests/" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:43", "verb": "Connected", @@ -149,7 +149,7 @@ "extra": "to google:ubuntu-20.04-64 (may242047-566476) at 104.196.212.243." }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:43", "verb": "Sending", @@ -157,14 +157,14 @@ "extra": "project content to google:ubuntu-20.04-64 (may242047-566476)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:44", "verb": "Restoring", "task": "google:ubuntu-22.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:45", "verb": "Discarding", @@ -172,35 +172,35 @@ "extra": "google:ubuntu-22.04-64 (may242047-566626)..." }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:46", "verb": "Preparing", "task": "google:ubuntu-20.04-64" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:47", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:47", "verb": "Preparing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:48", "verb": "Executing", "task": "google:ubuntu-20.04-64:tests/test-1" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:48", "verb": "Restoring", @@ -226,21 +226,21 @@ } }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:49", "verb": "Restoring", "task": "google:ubuntu-20.04-64:tests/" }, { - "type": "action", + "type": "phase", "date": "2022-05-24", "time": "17:48:49", "verb": "Restoring", "task": "google:ubuntu-20.04-64" }, { - "type": "operation", + "type": "action", "date": "2022-05-24", "time": "17:48:50", "verb": "Discarding", diff --git a/tests/log-analyzer/data/with-failed-and-failed-restore-suite.json b/tests/log-analyzer/data/with-failed-and-failed-restore-suite.json new file mode 100644 index 00000000000..ed0930ef5b5 --- /dev/null +++ b/tests/log-analyzer/data/with-failed-and-failed-restore-suite.json @@ -0,0 +1,493 @@ +[ + { + "type": "action", + "date": "2022-05-24", + "time": "17:42:58", + "verb": "Allocating", + "task": null, + "extra": "google:ubuntu-22.04-64..." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:42:58", + "verb": "Allocating", + "task": null, + "extra": "google:ubuntu-20.04-64..." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:43:07", + "verb": "Waiting", + "task": null, + "extra": "for google:ubuntu-22.04-64 (may242043-312411) to boot at 34.148.59.204..." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:43:07", + "verb": "Waiting", + "task": null, + "extra": "for google:ubuntu-20.04-64 (may242043-312500) to boot at 34.138.215.109..." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:43:43", + "verb": "Allocated", + "task": null, + "extra": "google:ubuntu-22.04-64 (may242043-312411)." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:43:43", + "verb": "Connecting", + "task": null, + "extra": "to google:ubuntu-22.04-64 (may242043-312411)..." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:43:45", + "verb": "Connected", + "task": null, + "extra": "to google:ubuntu-22.04-64 (may242043-312411) at 34.148.59.204." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:43:45", + "verb": "Sending", + "task": null, + "extra": "project content to google:ubuntu-22.04-64 (may242043-312411)..." + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:50", + "verb": "Preparing", + "task": "google:ubuntu-22.04-64" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:50", + "verb": "Preparing", + "task": "google:ubuntu-22.04-64:tests/" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:51", + "verb": "Preparing", + "task": "google:ubuntu-22.04-64:tests/test-3" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:52", + "verb": "Executing", + "task": "google:ubuntu-22.04-64:tests/test-3" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:52", + "verb": "Restoring", + "task": "google:ubuntu-22.04-64:tests/test-3" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:53", + "verb": "Preparing", + "task": "google:ubuntu-22.04-64:tests/test-2" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:54", + "verb": "Executing", + "task": "google:ubuntu-22.04-64:tests/test-2" + }, + { + "type": "info", + "date": "2022-05-24", + "time": "17:43:54", + "info_type": "Error", + "verb": "executing", + "task": "google:ubuntu-22.04-64:tests/test-2", + "extra": null, + "detail": { + "lines": [ + "-----\n", + "+ echo execute\n", + "execute\n", + "+ exit 1\n", + "-----\n", + ".\n" + ] + } + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:55", + "verb": "Restoring", + "task": "google:ubuntu-22.04-64:tests/test-2" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:55", + "verb": "Preparing", + "task": "google:ubuntu-22.04-64:tests/test-4" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:56", + "verb": "Executing", + "task": "google:ubuntu-22.04-64:tests/test-4" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:56", + "verb": "Restoring", + "task": "google:ubuntu-22.04-64:tests/test-4" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:57", + "verb": "Preparing", + "task": "google:ubuntu-22.04-64:tests/test-1" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:58", + "verb": "Executing", + "task": "google:ubuntu-22.04-64:tests/test-1" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:58", + "verb": "Restoring", + "task": "google:ubuntu-22.04-64:tests/test-1" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:43:59", + "verb": "Preparing", + "task": "google:ubuntu-22.04-64:tests/test-5" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:00", + "verb": "Executing", + "task": "google:ubuntu-22.04-64:tests/test-5" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:00", + "verb": "Restoring", + "task": "google:ubuntu-22.04-64:tests/test-5" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:01", + "verb": "Restoring", + "task": "google:ubuntu-22.04-64:tests/" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:02", + "verb": "Restoring", + "task": "google:ubuntu-22.04-64" + }, + { + "type": "info", + "date": "2022-05-24", + "time": "17:44:02", + "info_type": "Error", + "verb": "restoring", + "task": "google:ubuntu-22.04-64", + "extra": null, + "detail": { + "lines": [ + "-----\n", + "+ echo 'Restore snapd-testing-tools project'\n", + "Restore snapd-testing-tools project\n", + "/bin/bash: line 26: PROJECT_PATH: unbound variable\n", + "-----\n", + ".\n" + ] + } + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:44:02", + "verb": "Discarding", + "task": null, + "extra": "google:ubuntu-22.04-64 (may242043-312411)..." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:44:04", + "verb": "Allocated", + "task": null, + "extra": "google:ubuntu-20.04-64 (may242043-312500)." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:44:04", + "verb": "Connecting", + "task": null, + "extra": "to google:ubuntu-20.04-64 (may242043-312500)..." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:44:05", + "verb": "Connected", + "task": null, + "extra": "to google:ubuntu-20.04-64 (may242043-312500) at 34.138.215.109." + }, + { + "type": "action", + "date": "2022-05-24", + "time": "17:44:05", + "verb": "Sending", + "task": null, + "extra": "project content to google:ubuntu-20.04-64 (may242043-312500)..." + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:08", + "verb": "Preparing", + "task": "google:ubuntu-20.04-64" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:08", + "verb": "Preparing", + "task": "google:ubuntu-20.04-64:tests/" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:09", + "verb": "Preparing", + "task": "google:ubuntu-20.04-64:tests/test-3" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:09", + "verb": "Executing", + "task": "google:ubuntu-20.04-64:tests/test-3" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:10", + "verb": "Restoring", + "task": "google:ubuntu-20.04-64:tests/test-3" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:10", + "verb": "Preparing", + "task": "google:ubuntu-20.04-64:tests/test-1" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:11", + "verb": "Executing", + "task": "google:ubuntu-20.04-64:tests/test-1" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:11", + "verb": "Restoring", + "task": "google:ubuntu-20.04-64:tests/test-1" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:12", + "verb": "Preparing", + "task": "google:ubuntu-20.04-64:tests/test-4" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:13", + "verb": "Executing", + "task": "google:ubuntu-20.04-64:tests/test-4" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:13", + "verb": "Restoring", + "task": "google:ubuntu-20.04-64:tests/test-4" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:14", + "verb": "Preparing", + "task": "google:ubuntu-20.04-64:tests/test-2" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:14", + "verb": "Executing", + "task": "google:ubuntu-20.04-64:tests/test-2" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:15", + "verb": "Restoring", + "task": "google:ubuntu-20.04-64:tests/test-2" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:15", + "verb": "Preparing", + "task": "google:ubuntu-20.04-64:tests/test-5" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:16", + "verb": "Executing", + "task": "google:ubuntu-20.04-64:tests/test-5" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:16", + "verb": "Restoring", + "task": "google:ubuntu-20.04-64:tests/test-5" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:17", + "verb": "Restoring", + "task": "google:ubuntu-20.04-64:tests/" + }, + { + "type": "phase", + "date": "2022-05-24", + "time": "17:44:17", + "verb": "Restoring", + "task": "google:ubuntu-20.04-64" + }, + { + "type": "info", + "date": "2022-05-24", + "time": "17:44:18", + "info_type": "Error", + "verb": "restoring", + "task": "google:ubuntu-20.04-64:tests/", + "extra": null, + "detail": null + }, + { + "type": "info", + "date": "2022-05-24", + "time": "17:44:18", + "info_type": "Error", + "verb": "restoring", + "task": "google:ubuntu-20.04-64", + "extra": null, + "detail": null + }, + { + "type": "result", + "date": "2022-05-24", + "time": "17:44:19", + "result_type": "Successful", + "level": "tasks", + "stage": null, + "number": "9", + "detail": null + }, + { + "type": "result", + "date": "2022-05-24", + "time": "17:44:19", + "result_type": "Aborted", + "level": "tasks", + "stage": null, + "number": "0", + "detail": null + }, + { + "type": "result", + "date": "2022-05-24", + "time": "17:44:19", + "result_type": "Failed", + "level": "tasks", + "stage": null, + "number": "1", + "detail": { + "lines": [ + " - google:ubuntu-22.04-64:tests/test-2\n" + ] + } + }, + { + "type": "result", + "date": "2022-05-24", + "time": "17:44:19", + "result_type": "Failed", + "level": "suite", + "stage": "restore", + "number": "1", + "detail": { + "lines": [ + " - google:ubuntu-20.04-64:tests/\n" + ] + } + }, + { + "type": "result", + "date": "2022-05-24", + "time": "17:44:19", + "result_type": "Failed", + "level": "project", + "stage": "restore", + "number": "2", + "detail": { + "lines": [ + " - google:ubuntu-20.04-64:project\n", + " - google:ubuntu-22.04-64:project\n" + ] + } + } +] \ No newline at end of file diff --git a/tests/log-analyzer/data/with-failed-and-failed-restore-suite.log b/tests/log-analyzer/data/with-failed-and-failed-restore-suite.log new file mode 100644 index 00000000000..919a43b07de --- /dev/null +++ b/tests/log-analyzer/data/with-failed-and-failed-restore-suite.log @@ -0,0 +1,79 @@ +2022-05-24 17:42:58 Project content is packed for delivery (1.30KB). +2022-05-24 17:42:58 Sequence of jobs produced with -seed=1653424978 +2022-05-24 17:42:58 If killed, discard servers with: spread -reuse-pid=96667 -discard +2022-05-24 17:42:58 Allocating google:ubuntu-22.04-64... +2022-05-24 17:42:58 Allocating google:ubuntu-20.04-64... +2022-05-24 17:43:07 Waiting for google:ubuntu-22.04-64 (may242043-312411) to boot at 34.148.59.204... +2022-05-24 17:43:07 Waiting for google:ubuntu-20.04-64 (may242043-312500) to boot at 34.138.215.109... +2022-05-24 17:43:43 Allocated google:ubuntu-22.04-64 (may242043-312411). +2022-05-24 17:43:43 Connecting to google:ubuntu-22.04-64 (may242043-312411)... +2022-05-24 17:43:45 Connected to google:ubuntu-22.04-64 (may242043-312411) at 34.148.59.204. +2022-05-24 17:43:45 Sending project content to google:ubuntu-22.04-64 (may242043-312411)... +2022-05-24 17:43:50 Preparing google:ubuntu-22.04-64 (may242043-312411)... +2022-05-24 17:43:50 Preparing google:ubuntu-22.04-64:tests/ (may242043-312411)... +2022-05-24 17:43:51 Preparing google:ubuntu-22.04-64:tests/test-3 (may242043-312411)... +2022-05-24 17:43:52 Executing google:ubuntu-22.04-64:tests/test-3 (may242043-312411) (1/10)... +2022-05-24 17:43:52 Restoring google:ubuntu-22.04-64:tests/test-3 (may242043-312411)... +2022-05-24 17:43:53 Preparing google:ubuntu-22.04-64:tests/test-2 (may242043-312411)... +2022-05-24 17:43:54 Executing google:ubuntu-22.04-64:tests/test-2 (may242043-312411) (2/10)... +2022-05-24 17:43:54 Error executing google:ubuntu-22.04-64:tests/test-2 (may242043-312411) : +----- ++ echo execute +execute ++ exit 1 +----- +. +2022-05-24 17:43:55 Restoring google:ubuntu-22.04-64:tests/test-2 (may242043-312411)... +2022-05-24 17:43:55 Preparing google:ubuntu-22.04-64:tests/test-4 (may242043-312411)... +2022-05-24 17:43:56 Executing google:ubuntu-22.04-64:tests/test-4 (may242043-312411) (3/10)... +2022-05-24 17:43:56 Restoring google:ubuntu-22.04-64:tests/test-4 (may242043-312411)... +2022-05-24 17:43:57 Preparing google:ubuntu-22.04-64:tests/test-1 (may242043-312411)... +2022-05-24 17:43:58 Executing google:ubuntu-22.04-64:tests/test-1 (may242043-312411) (4/10)... +2022-05-24 17:43:58 Restoring google:ubuntu-22.04-64:tests/test-1 (may242043-312411)... +2022-05-24 17:43:59 Preparing google:ubuntu-22.04-64:tests/test-5 (may242043-312411)... +2022-05-24 17:44:00 Executing google:ubuntu-22.04-64:tests/test-5 (may242043-312411) (5/10)... +2022-05-24 17:44:00 Restoring google:ubuntu-22.04-64:tests/test-5 (may242043-312411)... +2022-05-24 17:44:01 Restoring google:ubuntu-22.04-64:tests/ (may242043-312411)... +2022-05-24 17:44:02 Restoring google:ubuntu-22.04-64 (may242043-312411)... +2022-05-24 17:44:02 Error restoring google:ubuntu-22.04-64 (may242043-312411) : +----- ++ echo 'Restore snapd-testing-tools project' +Restore snapd-testing-tools project +/bin/bash: line 26: PROJECT_PATH: unbound variable +----- +. +2022-05-24 17:44:02 Discarding google:ubuntu-22.04-64 (may242043-312411)... +2022-05-24 17:44:04 Allocated google:ubuntu-20.04-64 (may242043-312500). +2022-05-24 17:44:04 Connecting to google:ubuntu-20.04-64 (may242043-312500)... +2022-05-24 17:44:05 Connected to google:ubuntu-20.04-64 (may242043-312500) at 34.138.215.109. +2022-05-24 17:44:05 Sending project content to google:ubuntu-20.04-64 (may242043-312500)... +2022-05-24 17:44:08 Preparing google:ubuntu-20.04-64 (may242043-312500)... +2022-05-24 17:44:08 Preparing google:ubuntu-20.04-64:tests/ (may242043-312500)... +2022-05-24 17:44:09 Preparing google:ubuntu-20.04-64:tests/test-3 (may242043-312500)... +2022-05-24 17:44:09 Executing google:ubuntu-20.04-64:tests/test-3 (may242043-312500) (6/10)... +2022-05-24 17:44:10 Restoring google:ubuntu-20.04-64:tests/test-3 (may242043-312500)... +2022-05-24 17:44:10 Preparing google:ubuntu-20.04-64:tests/test-1 (may242043-312500)... +2022-05-24 17:44:11 Executing google:ubuntu-20.04-64:tests/test-1 (may242043-312500) (7/10)... +2022-05-24 17:44:11 Restoring google:ubuntu-20.04-64:tests/test-1 (may242043-312500)... +2022-05-24 17:44:12 Preparing google:ubuntu-20.04-64:tests/test-4 (may242043-312500)... +2022-05-24 17:44:13 Executing google:ubuntu-20.04-64:tests/test-4 (may242043-312500) (8/10)... +2022-05-24 17:44:13 Restoring google:ubuntu-20.04-64:tests/test-4 (may242043-312500)... +2022-05-24 17:44:14 Preparing google:ubuntu-20.04-64:tests/test-2 (may242043-312500)... +2022-05-24 17:44:14 Executing google:ubuntu-20.04-64:tests/test-2 (may242043-312500) (9/10)... +2022-05-24 17:44:15 Restoring google:ubuntu-20.04-64:tests/test-2 (may242043-312500)... +2022-05-24 17:44:15 Preparing google:ubuntu-20.04-64:tests/test-5 (may242043-312500)... +2022-05-24 17:44:16 Executing google:ubuntu-20.04-64:tests/test-5 (may242043-312500) (10/10)... +2022-05-24 17:44:16 Restoring google:ubuntu-20.04-64:tests/test-5 (may242043-312500)... +2022-05-24 17:44:17 Restoring google:ubuntu-20.04-64:tests/ (may242043-312500)... +2022-05-24 17:44:17 Restoring google:ubuntu-20.04-64 (may242043-312500)... +2022-05-24 17:44:18 Error restoring google:ubuntu-20.04-64:tests/ (may242043-312500) : EOF +2022-05-24 17:44:18 Error restoring google:ubuntu-20.04-64 (may242043-312500) : EOF +2022-05-24 17:44:19 Successful tasks: 9 +2022-05-24 17:44:19 Aborted tasks: 0 +2022-05-24 17:44:19 Failed tasks: 1 + - google:ubuntu-22.04-64:tests/test-2 +2022-05-24 17:44:19 Failed suite restore: 1 + - google:ubuntu-20.04-64:tests/ +2022-05-24 17:44:19 Failed project restore: 2 + - google:ubuntu-20.04-64:project + - google:ubuntu-22.04-64:project diff --git a/tests/log-analyzer/task.yaml b/tests/log-analyzer/task.yaml index 0b71e7435c2..7add04199b8 100644 --- a/tests/log-analyzer/task.yaml +++ b/tests/log-analyzer/task.yaml @@ -1,9 +1,14 @@ summary: integration tests for log-analyzer tool +details: | + This test checks the log-analyzer properly retrieves the tests-to-reexecute + based on the spread log analysis. Also checks it properly retrieves the + tests by result status and all the executed tasks. + backends: [google] -# Github actions agents are just running in bionic and focal -systems: [ubuntu-18.04-64, ubuntu-20.04-64] +# Github actions agents are just running ubuntu jammy +systems: [ubuntu-22.04-64] prepare: | wget https://storage.googleapis.com/snapd-spread-tests/spread/spread-amd64.tar.gz @@ -31,7 +36,7 @@ execute: | # ubuntu-20.04 (F:0 P:0 A:5) # ubuntu-22.04 (F:0 P:0 A:5) # all-success.json - # When all the tests execute correctly, no aborted and no failed tests are listed + # When all the tests execute correctly, no tests are listed for re-execution # ubuntu-20.04 (F:0 P:5 A:0) # ubuntu-22.04 (F:0 P:5 A:0) # all-success-failed-restore.json @@ -62,6 +67,10 @@ execute: | # Tasks which execute correctly and fail to restore are not counted as failed # ubuntu-20.04 (F:0 P:1 A:4) # ubuntu-22.04 (F:0 P:1 A:4) + # with-failed-and-failed-restore-suite.json + # Just failed tasks are counted for re-execution + # ubuntu-20.04 (F:0 P:0 A:0) + # ubuntu-22.04 (F:1 P:1 A:0) ### CHECK HELP ### log-analyzer | MATCH "usage: log-analyzer list-failed-tasks " @@ -74,13 +83,15 @@ execute: | log-analyzer list-reexecute-tasks google: data/all-aborted.json | MATCH "^google:$" log-analyzer list-reexecute-tasks google:ubuntu-20.04-64: data/all-aborted.json | MATCH "^google:ubuntu-20.04-64:$" - # When all the tests pass and then fail to restore, the execution expression is returned - log-analyzer list-reexecute-tasks google: data/all-success-failed-restore.json | MATCH "^google:$" - log-analyzer list-reexecute-tasks google:ubuntu-20.04-64: data/all-success-failed-restore.json | MATCH "^google:ubuntu-20.04-64:$" + # When all the tests pass and then fail to restore, no tests are listed for re-execution + log-analyzer list-reexecute-tasks google: data/all-success-failed-restore.json | NOMATCH "google:" + compare_tasks_count "$(log-analyzer list-reexecute-tasks google: data/all-success-failed-restore.json)" 0 + log-analyzer list-reexecute-tasks google:ubuntu-20.04-64: data/all-success-failed-restore.json | NOMATCH "google:ubuntu-20.04-64:" - # When all the tests are successful, the execution expression is returned - log-analyzer list-reexecute-tasks google: data/all-success.json | MATCH "^google:$" - log-analyzer list-reexecute-tasks google:ubuntu-20.04-64: data/all-success.json | MATCH "^google:ubuntu-20.04-64:$" + # When all the tests are successful, no tests are listed for re-execution + log-analyzer list-reexecute-tasks google: data/all-success.json | NOMATCH "google:" + compare_tasks_count "$(log-analyzer list-reexecute-tasks google: data/all-success.json)" 0 + log-analyzer list-reexecute-tasks google:ubuntu-20.04-64: data/all-success.json | NOMATCH "google:ubuntu-20.04-64:" # When all the tests are failed, the execution expression is returned log-analyzer list-reexecute-tasks google: data/all-failed.json | MATCH "^google:$" @@ -117,6 +128,10 @@ execute: | log-analyzer list-reexecute-tasks google: data/aborted-and-failed-execute-and-restore.json | NOMATCH "google:ubuntu-22.04-64:tests/test-4" compare_tasks_count "$(log-analyzer list-reexecute-tasks google: data/aborted-and-failed-execute-and-restore.json)" 5 + # When some tests failed to execute and the suite and project fails to restore, just the failed test is re-executed + log-analyzer list-reexecute-tasks google: data/with-failed-and-failed-restore-suite.json | MATCH "google:ubuntu-22.04-64:tests/test-2" + compare_tasks_count "$(log-analyzer list-reexecute-tasks google: data/with-failed-and-failed-restore-suite.json)" 1 + ### CHECK ABORTED ### compare_tasks_count "$(log-analyzer list-aborted-tasks google: data/all-aborted.json)" 10 diff --git a/tests/log-analyzer/tests/test-1/task.yaml b/tests/log-analyzer/tests/test-1/task.yaml index 21cc04f382a..0bf4b7fedb6 100644 --- a/tests/log-analyzer/tests/test-1/task.yaml +++ b/tests/log-analyzer/tests/test-1/task.yaml @@ -1,5 +1,7 @@ summary: summary +details: test + prepare: | echo "prepare" diff --git a/tests/log-analyzer/tests/test-2/task.yaml b/tests/log-analyzer/tests/test-2/task.yaml index 21cc04f382a..0bf4b7fedb6 100644 --- a/tests/log-analyzer/tests/test-2/task.yaml +++ b/tests/log-analyzer/tests/test-2/task.yaml @@ -1,5 +1,7 @@ summary: summary +details: test + prepare: | echo "prepare" diff --git a/tests/log-analyzer/tests/test-3/task.yaml b/tests/log-analyzer/tests/test-3/task.yaml index 21cc04f382a..0bf4b7fedb6 100644 --- a/tests/log-analyzer/tests/test-3/task.yaml +++ b/tests/log-analyzer/tests/test-3/task.yaml @@ -1,5 +1,7 @@ summary: summary +details: test + prepare: | echo "prepare" diff --git a/tests/log-analyzer/tests/test-4/task.yaml b/tests/log-analyzer/tests/test-4/task.yaml index 21cc04f382a..0bf4b7fedb6 100644 --- a/tests/log-analyzer/tests/test-4/task.yaml +++ b/tests/log-analyzer/tests/test-4/task.yaml @@ -1,5 +1,7 @@ summary: summary +details: test + prepare: | echo "prepare" diff --git a/tests/log-analyzer/tests/test-5/task.yaml b/tests/log-analyzer/tests/test-5/task.yaml index 0577d308bde..bb02fd77a7c 100644 --- a/tests/log-analyzer/tests/test-5/task.yaml +++ b/tests/log-analyzer/tests/test-5/task.yaml @@ -1,5 +1,7 @@ summary: summary +details: test + prepare: | echo "prepare" diff --git a/tests/log-filter/task.yaml b/tests/log-filter/task.yaml new file mode 100644 index 00000000000..9d93d37c668 --- /dev/null +++ b/tests/log-filter/task.yaml @@ -0,0 +1,51 @@ +summary: test for the log filter tool + +details: | + This test checks the log-filter tool is able to read the spread output + and filter the log following a set of rules. It is also checked that the + output of the log-filter tool is the same than spread. + +backends: [google] + +# Github actions agents are just running ubuntu jammy +systems: [ubuntu-22.04-64] + +prepare: | + wget https://storage.googleapis.com/snapd-spread-tests/dependencies/spread-log-filter.tar.xz + tar -xf spread-log-filter.tar.xz + +restore: | + rm -rf spread-log-filter.tar.xz ./*.log + +execute: | + log-filter --help | MATCH 'usage: log-filter \[-h\] \[-o PATH\]' + log-filter -h | MATCH 'usage: log-filter \[-h\] \[-o PATH\]' + + # Run the tool for a real log + # The output should: + # 1. the output should go to test.filtered.log file + # 2. exclude: Preparing, Restoring, Error, Warning + # 3. show: debug lines with ###DEBUG + # 4. show: failed tests for google-nested + log-filter -o test.filtered.log -e Error -e Restoring -e Preparing -f "Debug=###DEBUG" -f "Failed=google-nested:" < spread-log-filter.log > output.log + + # Check the stdout is the same than the stdin + diff -Z spread-log-filter.log output.log + + # Check exclude + test "$(grep -c Restoring test.filtered.log)" -eq 0 + test "$(grep -c Preparing test.filtered.log)" -eq 0 + test "$(grep -c Error test.filtered.log)" -eq 0 + + # Check the non excluded + test "$(grep -c 'Debug output' test.filtered.log)" -eq "$(grep -c 'Debug output' spread-log-filter.log)" + + # Check the filters + test "$(grep -c '###DEBUG' test.filtered.log)" -eq "$(grep -c '###DEBUG' spread-log-filter.log)" + grep -A 1 'Failed suite prepare: 4' test.filtered.log | MATCH 'Failed suite restore: 1' + + # Check no repeated + test "$(grep -c 'Failed suite prepare: 4' test.filtered.log)" -eq 1 + test "$(grep -c 'Executing' test.filtered.log)" -eq "$(grep -c 'Executing' spread-log-filter.log)" + test "$(grep -c 'Aborted tasks' test.filtered.log)" -eq 1 + diff --git a/tests/log-parser/task.yaml b/tests/log-parser/task.yaml index 6c46af44b46..39b9b4ca6a1 100644 --- a/tests/log-parser/task.yaml +++ b/tests/log-parser/task.yaml @@ -1,9 +1,14 @@ summary: test for the log parser tool +details: | + This test checks the log-parser tool is able to read different spread + logs and produce a json file with the logs info. This json file contains + all the information from the log but structured in json format. + backends: [google] -# Github actions agents are just running in bionic and focal -systems: [ubuntu-18.04-64, ubuntu-20.04-64] +# Github actions agents are just running ubuntu jammy +systems: [ubuntu-22.04-64] execute: | log-parser --help | MATCH 'usage: log-parser \[-h\] \[-c CUT\]' @@ -82,25 +87,34 @@ execute: | jq -r '.[] | select( .type == "result") | select( .result_type == "Failed") | select(.level == "tasks") | .detail' spread-results.json | MATCH "degraded" # Check the filter - test "$(log-parser with-failed-and-aborted.log.spread -pd error | grep -c "Error preparing")" -eq 5 - test "$(log-parser with-failed-and-aborted.log.spread -pd error | grep -c "command -v restorecon")" -eq 4 + test "$(log-parser with-failed-and-aborted.log.spread | grep -c "Error preparing")" -eq 5 + test "$(log-parser with-failed-and-aborted.log.spread | grep -c "command -v restorecon")" -eq 4 - # Check the filter cuting the logs - test "$(log-parser with-failed-and-aborted.log.spread -pd error | wc -l)" -eq 184 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 0 | wc -l)" -eq 14 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 0 | grep -c "Error preparing")" -eq 5 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 0 | grep -c "")" -eq 0 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 2 | wc -l)" -eq 26 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 2 | grep -c "Error preparing")" -eq 5 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 2 | grep -c "")" -eq 5 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 3 | wc -l)" -eq 32 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 3 | grep -c "Error preparing")" -eq 5 - test "$(log-parser with-failed-and-aborted.log.spread -pd error -c 3 | grep -c "")" -eq 5 + # Check the filter cutting the logs + test "$(log-parser with-failed-and-aborted.log.spread | wc -l)" -eq 261 + test "$(log-parser with-failed-and-aborted.log.spread -c 0 | wc -l)" -eq 77 + test "$(log-parser with-failed-and-aborted.log.spread -c 0 | grep -c "Error preparing")" -eq 5 + test "$(log-parser with-failed-and-aborted.log.spread -c 0 | grep -c "")" -eq 0 + test "$(log-parser with-failed-and-aborted.log.spread -c 2 | wc -l)" -eq 91 + test "$(log-parser with-failed-and-aborted.log.spread -c 2 | grep -c "Error preparing")" -eq 5 + test "$(log-parser with-failed-and-aborted.log.spread -c 2 | grep -c "")" -eq 5 + test "$(log-parser with-failed-and-aborted.log.spread -c 3 | wc -l)" -eq 98 + test "$(log-parser with-failed-and-aborted.log.spread -c 3 | grep -c "Error preparing")" -eq 5 + test "$(log-parser with-failed-and-aborted.log.spread -c 3 | grep -c "")" -eq 5 # Check the results can be filtered - log-parser with-failed-and-aborted.log.spread -pr failed | grep -q "Failed tasks: 1" - log-parser with-failed-and-aborted.log.spread -pr failed | grep -c "Failed project prepare: 4" - log-parser with-failed-and-aborted.log.spread -pr aborted | grep -c "Aborted tasks: 24" - log-parser all-successful.log.spread -pr successful | grep -q "Successful tasks: 434" - log-parser all-successful.log.spread -pr failed | grep -v "Aborted tasks" + log-parser with-failed-and-aborted.log.spread | grep -q "Failed tasks: 1" + log-parser with-failed-and-aborted.log.spread | grep -c "Failed project prepare: 4" + log-parser with-failed-and-aborted.log.spread | grep -c "Aborted tasks: 24" + log-parser all-successful.log.spread | grep -q "Successful tasks: 434" + log-parser all-successful.log.spread | grep -v "Aborted tasks" + + # Check filtering the debug output + log-parser with-debug-output.log.spread -c 1 -dr "executed_tests=EXECUTED_TESTS=(.*)" -dr "apparmor_version=AppArmor parser version .*" + test "$(jq -r '.[0].detail.executed_tests[0]' spread-results.json | wc -w)" -eq 44 + test "$(jq -r '.[0].detail.apparmor_version[0]' spread-results.json)" = "AppArmor parser version 2.13.3" + # Check filtering the error output + log-parser with-error-output.log.spread -c 1 -er "executed_tests=EXECUTED_TESTS=(.*)" -er "apparmor_version=AppArmor parser version .*" + test "$(jq -r '.[0].detail.executed_tests[0]' spread-results.json | wc -w)" -eq 44 + test "$(jq -r '.[0].detail.apparmor_version[0]' spread-results.json)" = "AppArmor parser version 2.13.3" diff --git a/tests/log-parser/with-all-results.log.spread b/tests/log-parser/with-all-results.log.spread index c64ac9ac71d..933cccb398e 100644 --- a/tests/log-parser/with-all-results.log.spread +++ b/tests/log-parser/with-all-results.log.spread @@ -93,7 +93,7 @@ created 0 fifos 2022-05-18 18:07:57 Restoring google-nested:ubuntu-16.04-64:tests/nested/manual/cloud-init-never-used-not-vuln:firstboot (may181749-433163)... 2022-05-18 18:08:00 Preparing google-nested:ubuntu-16.04-64:tests/nested/manual/cloud-init-nocloud-not-vuln:firstboot (may181749-433163)... 2022-05-18 18:08:40 Executing google-nested:ubuntu-16.04-64:tests/nested/core/image-build (may181749-432987) (2/13)... -Error: 2022-05-18 18:09:34 Error preparing google-nested:ubuntu-16.04-64:tests/nested/manual/cloud-init-nocloud-not-vuln:firstboot (may181749-433163) : +2022-05-18 18:09:34 Error preparing google-nested:ubuntu-16.04-64:tests/nested/manual/cloud-init-nocloud-not-vuln:firstboot (may181749-433163) : ----- + /home/gopath/src/github.com/snapcore/snapd/tests/lib/prepare-restore.sh --prepare-project-each + set -e @@ -160,4 +160,3 @@ google-nested:ubuntu-16.04-64:tests/nested/classic/hotplug google-nested:ubuntu- 2022-05-18 16:45:15 Failed project restore: 2 - google:ubuntu-core-22-64:project - google:ubuntu-core-22-64:project -error: unsuccessful run \ No newline at end of file diff --git a/tests/log-parser/with-debug-output.log.spread b/tests/log-parser/with-debug-output.log.spread new file mode 100644 index 00000000000..f90830b57e9 --- /dev/null +++ b/tests/log-parser/with-debug-output.log.spread @@ -0,0 +1,81 @@ +2024-04-25 16:56:53 Debug output for external:ubuntu-core-20-64:tests/core/snapd-maintenance-msg (external:ubuntu-core-20-64) : +----- ++ '[' 1 '!=' 1 ']' ++ . /home/gopath/src/github.com/snapcore/snapd/tests/lib/state.sh +++ SNAPD_STATE_PATH=/var/tmp/snapd-tools/snapd-state +++ SNAPD_STATE_FILE=/var/tmp/snapd-tools/snapd-state/snapd-state.tar +++ SNAPD_ACTIVE_UNITS=/var/tmp/snapd-tools/runtime-state/snapd-active-units ++ . /home/gopath/src/github.com/snapcore/snapd/tests/lib/systems.sh ++ echo '# System information' +# System information ++ cat /etc/os-release +NAME="Ubuntu Core" +VERSION="20" +ID=ubuntu-core +PRETTY_NAME="Ubuntu Core 20" +VERSION_ID="20" +HOME_URL="https://snapcraft.io/" +BUG_REPORT_URL="https://bugs.launchpad.net/snappy/" ++ echo '# Kernel information' +# Kernel information ++ uname -a +Linux ubuntu 5.4.0-177-generic #197-Ubuntu SMP Thu Mar 28 22:45:47 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux ++ echo '# Apparmor information' +# Apparmor information ++ apparmor_parser --version +AppArmor parser version 2.13.3 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=55 compat=0 ip=0x7ff1c6d2e73a code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=52 compat=0 ip=0x7ff1c6d2e6d7 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=51 compat=0 ip=0x7ff1c6d2e707 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=44 compat=0 ip=0x7ff1c700ea5a code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=45 compat=0 ip=0x7ff1c700e8da code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=3 compat=0 ip=0x7ff1c700e511 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=202 compat=0 ip=0x7ff1c700c92e code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=231 compat=0 ip=0x7ff1c6cf0ab6 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu snapd[16017]: logger.go:93: DEBUG: pid=17276;uid=0;socket=/run/snapd.socket; GET /v2/changes?select=all 955.32µs 200 +Apr 25 16:56:53 ubuntu systemd[1]: snap.test-snapd-curl.curl-9e260fd8-e6ab-4b2a-82af-1c5db658cd84.scope: Succeeded. +Apr 25 16:56:53 ubuntu sudo[14547]: pam_unix(sudo:session): session closed for user root +Apr 25 16:56:53 ubuntu systemd[1]: snap.jq.jq-6dd86506-7d6f-4009-9ea0-77b6c34c607b.scope: Succeeded. +Apr 25 16:56:53 ubuntu sudo[17324]: external : TTY=unknown ; *** ; USER=root ; COMMAND=/bin/bash -c /bin/bash - +Apr 25 16:56:53 ubuntu sudo[17324]: pam_unix(sudo:session): session opened for user root by (uid=0) +Apr 25 16:56:53 ubuntu systemd-journald[13548]: Runtime Journal (/run/log/journal/b40777928f53498d900b3982055b5893) is 45.7M, max 79.2M, 33.5M free. +Apr 25 16:56:53 ubuntu snapd[16017]: logger.go:93: DEBUG: pid=17362;uid=0;socket=/run/snapd.socket; GET /v2/connections?select=all 521.714µs 200 ++ echo '# tasks executed on system' +# tasks executed on system ++ echo '' ++ cat /var/tmp/snapd-tools/runtime-state/runs - +EXECUTED_TESTS=google:ubuntu-16.04-64:tests/main/interfaces-many-snap-provided google:ubuntu-16.04-64:tests/main/snap-seccomp google:ubuntu-16.04-64:tests/main/install-hook-misbehaving google:ubuntu-16.04-64:tests/main/security-device-cgroups-helper google:ubuntu-16.04-64:tests/main/interfaces-device-buttons google:ubuntu-16.04-64:tests/main/upgrade-from-2.15 google:ubuntu-16.04-64:tests/main/buildmode google:ubuntu-16.04-64:tests/main/snapshot-basic google:ubuntu-16.04-64:tests/main/system-usernames:_daemon_ google:ubuntu-16.04-64:tests/main/try-snap-goes-away:test_snapd_tools google:ubuntu-16.04-64:tests/main/interfaces-accounts-service google:ubuntu-16.04-64:tests/main/snap-run-userdata-current google:ubuntu-16.04-64:tests/main/snapd-update-services google:ubuntu-16.04-64:tests/main/remove-errors google:ubuntu-16.04-64:tests/main/mounts-persist-refresh-content-snap google:ubuntu-16.04-64:tests/main/parallel-install-auto-aliases google:ubuntu-16.04-64:tests/main/install-errors:withreexec google:ubuntu-16.04-64:tests/main/searching google:ubuntu-16.04-64:tests/main/interfaces-mount-control google:ubuntu-16.04-64:tests/main/services-after-before-install google:ubuntu-16.04-64:tests/main/system-usernames-illegal google:ubuntu-16.04-64:tests/main/interfaces-system-files google:ubuntu-16.04-64:tests/main/interfaces-desktop-launch google:ubuntu-16.04-64:tests/main/snap-env:regular google:ubuntu-16.04-64:tests/main/refresh-devmode:remote google:ubuntu-16.04-64:tests/main/snapd-sigterm google:ubuntu-16.04-64:tests/main/interfaces-browser-support:disallow google:ubuntu-16.04-64:tests/main/install-store:reexec1 google:ubuntu-16.04-64:tests/main/parallel-install-aliases google:ubuntu-16.04-64:tests/main/user-data-handling google:ubuntu-16.04-64:tests/main/interfaces-shutdown-introspection google:ubuntu-16.04-64:tests/main/refresh:classic_remote google:ubuntu-16.04-64:tests/main/system-users-are-created:snap_daemon google:ubuntu-16.04-64:tests/main/snap-update-ns google:ubuntu-16.04-64:tests/main/find-private google:ubuntu-16.04-64:tests/main/interfaces-adb-support google:ubuntu-16.04-64:tests/main/interfaces-system-observe google:ubuntu-16.04-64:tests/main/refresh-devmode:fake google:ubuntu-16.04-64:tests/main/interfaces-content google:ubuntu-16.04-64:tests/main/server-snap:pythonServer google:ubuntu-16.04-64:tests/main/retry-network google:ubuntu-16.04-64:tests/main/snap-run-devmode-classic:core_first google:ubuntu-16.04-64:tests/main/system-core-alias google:ubuntu-16.04-64:tests/main/snap-run-devmode-classic:snapd_first +echo '' +------ diff --git a/tests/log-parser/with-error-output.log.spread b/tests/log-parser/with-error-output.log.spread new file mode 100644 index 00000000000..1f7d5d3b987 --- /dev/null +++ b/tests/log-parser/with-error-output.log.spread @@ -0,0 +1,81 @@ +2024-04-26 16:38:41 Error executing google:ubuntu-core-20-64:tests/main/snap-quota-thread (apr261545-458974) : +----- ++ '[' 1 '!=' 1 ']' ++ . /home/gopath/src/github.com/snapcore/snapd/tests/lib/state.sh +++ SNAPD_STATE_PATH=/var/tmp/snapd-tools/snapd-state +++ SNAPD_STATE_FILE=/var/tmp/snapd-tools/snapd-state/snapd-state.tar +++ SNAPD_ACTIVE_UNITS=/var/tmp/snapd-tools/runtime-state/snapd-active-units ++ . /home/gopath/src/github.com/snapcore/snapd/tests/lib/systems.sh ++ echo '# System information' +# System information ++ cat /etc/os-release +NAME="Ubuntu Core" +VERSION="20" +ID=ubuntu-core +PRETTY_NAME="Ubuntu Core 20" +VERSION_ID="20" +HOME_URL="https://snapcraft.io/" +BUG_REPORT_URL="https://bugs.launchpad.net/snappy/" ++ echo '# Kernel information' +# Kernel information ++ uname -a +Linux ubuntu 5.4.0-177-generic #197-Ubuntu SMP Thu Mar 28 22:45:47 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux ++ echo '# Apparmor information' +# Apparmor information ++ apparmor_parser --version +AppArmor parser version 2.13.3 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=55 compat=0 ip=0x7ff1c6d2e73a code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=52 compat=0 ip=0x7ff1c6d2e6d7 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=51 compat=0 ip=0x7ff1c6d2e707 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=44 compat=0 ip=0x7ff1c700ea5a code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=7 compat=0 ip=0x7ff1c6d20b84 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=45 compat=0 ip=0x7ff1c700e8da code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=1 compat=0 ip=0x7ff1c6d1c104 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=3 compat=0 ip=0x7ff1c700e511 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=13 compat=0 ip=0x7ff1c700fa4d code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=202 compat=0 ip=0x7ff1c700c92e code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=5 compat=0 ip=0x7ff1c6d1b773 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu audit[17276]: SECCOMP auid=1001 uid=0 gid=0 ses=79 pid=17276 comm="curl" exe="/snap/test-snapd-curl/27/usr/bin/curl" sig=0 arch=c000003e syscall=231 compat=0 ip=0x7ff1c6cf0ab6 code=0x7ffc0000 +Apr 25 16:56:53 ubuntu snapd[16017]: logger.go:93: DEBUG: pid=17276;uid=0;socket=/run/snapd.socket; GET /v2/changes?select=all 955.32µs 200 +Apr 25 16:56:53 ubuntu systemd[1]: snap.test-snapd-curl.curl-9e260fd8-e6ab-4b2a-82af-1c5db658cd84.scope: Succeeded. +Apr 25 16:56:53 ubuntu sudo[14547]: pam_unix(sudo:session): session closed for user root +Apr 25 16:56:53 ubuntu systemd[1]: snap.jq.jq-6dd86506-7d6f-4009-9ea0-77b6c34c607b.scope: Succeeded. +Apr 25 16:56:53 ubuntu sudo[17324]: external : TTY=unknown ; *** ; USER=root ; COMMAND=/bin/bash -c /bin/bash - +Apr 25 16:56:53 ubuntu sudo[17324]: pam_unix(sudo:session): session opened for user root by (uid=0) +Apr 25 16:56:53 ubuntu systemd-journald[13548]: Runtime Journal (/run/log/journal/b40777928f53498d900b3982055b5893) is 45.7M, max 79.2M, 33.5M free. +Apr 25 16:56:53 ubuntu snapd[16017]: logger.go:93: DEBUG: pid=17362;uid=0;socket=/run/snapd.socket; GET /v2/connections?select=all 521.714µs 200 ++ echo '# tasks executed on system' +# tasks executed on system ++ echo '' ++ cat /var/tmp/snapd-tools/runtime-state/runs - +EXECUTED_TESTS=google:ubuntu-16.04-64:tests/main/interfaces-many-snap-provided google:ubuntu-16.04-64:tests/main/snap-seccomp google:ubuntu-16.04-64:tests/main/install-hook-misbehaving google:ubuntu-16.04-64:tests/main/security-device-cgroups-helper google:ubuntu-16.04-64:tests/main/interfaces-device-buttons google:ubuntu-16.04-64:tests/main/upgrade-from-2.15 google:ubuntu-16.04-64:tests/main/buildmode google:ubuntu-16.04-64:tests/main/snapshot-basic google:ubuntu-16.04-64:tests/main/system-usernames:_daemon_ google:ubuntu-16.04-64:tests/main/try-snap-goes-away:test_snapd_tools google:ubuntu-16.04-64:tests/main/interfaces-accounts-service google:ubuntu-16.04-64:tests/main/snap-run-userdata-current google:ubuntu-16.04-64:tests/main/snapd-update-services google:ubuntu-16.04-64:tests/main/remove-errors google:ubuntu-16.04-64:tests/main/mounts-persist-refresh-content-snap google:ubuntu-16.04-64:tests/main/parallel-install-auto-aliases google:ubuntu-16.04-64:tests/main/install-errors:withreexec google:ubuntu-16.04-64:tests/main/searching google:ubuntu-16.04-64:tests/main/interfaces-mount-control google:ubuntu-16.04-64:tests/main/services-after-before-install google:ubuntu-16.04-64:tests/main/system-usernames-illegal google:ubuntu-16.04-64:tests/main/interfaces-system-files google:ubuntu-16.04-64:tests/main/interfaces-desktop-launch google:ubuntu-16.04-64:tests/main/snap-env:regular google:ubuntu-16.04-64:tests/main/refresh-devmode:remote google:ubuntu-16.04-64:tests/main/snapd-sigterm google:ubuntu-16.04-64:tests/main/interfaces-browser-support:disallow google:ubuntu-16.04-64:tests/main/install-store:reexec1 google:ubuntu-16.04-64:tests/main/parallel-install-aliases google:ubuntu-16.04-64:tests/main/user-data-handling google:ubuntu-16.04-64:tests/main/interfaces-shutdown-introspection google:ubuntu-16.04-64:tests/main/refresh:classic_remote google:ubuntu-16.04-64:tests/main/system-users-are-created:snap_daemon google:ubuntu-16.04-64:tests/main/snap-update-ns google:ubuntu-16.04-64:tests/main/find-private google:ubuntu-16.04-64:tests/main/interfaces-adb-support google:ubuntu-16.04-64:tests/main/interfaces-system-observe google:ubuntu-16.04-64:tests/main/refresh-devmode:fake google:ubuntu-16.04-64:tests/main/interfaces-content google:ubuntu-16.04-64:tests/main/server-snap:pythonServer google:ubuntu-16.04-64:tests/main/retry-network google:ubuntu-16.04-64:tests/main/snap-run-devmode-classic:core_first google:ubuntu-16.04-64:tests/main/system-core-alias google:ubuntu-16.04-64:tests/main/snap-run-devmode-classic:snapd_first +echo '' +------ diff --git a/tests/not/task.yaml b/tests/not/task.yaml index 64a5685c936..3377d3c23c3 100644 --- a/tests/not/task.yaml +++ b/tests/not/task.yaml @@ -1,5 +1,8 @@ summary: test for the not tool +details: | + Check the not tool works the same as the logical not (!). + backends: [google] execute: | diff --git a/tests/os.paths/task.yaml b/tests/os.paths/task.yaml index 7630a5227be..e9f34449324 100644 --- a/tests/os.paths/task.yaml +++ b/tests/os.paths/task.yaml @@ -1,5 +1,9 @@ summary: smoke test for the os.paths tool +details: | + Check the os.paths tool properly retrieves the snap-mount-dir, + media-dir and libexec-dir in the current system. + backends: [google] execute: | diff --git a/tests/os.query/task.yaml b/tests/os.query/task.yaml index 4c33a895736..65ef12d2e2c 100644 --- a/tests/os.query/task.yaml +++ b/tests/os.query/task.yaml @@ -1,6 +1,10 @@ summary: smoke test for the os.query tool -backends: [google] +details: | + Check the os.query tool properly detects the current system. Also + verify the version comparison works. + +backends: [google, openstack] execute: | os.query --help | MATCH 'usage: os.query is-core, is-classic' @@ -60,6 +64,8 @@ execute: | ! os.query is-debian os.query is-classic ! os.query is-core + ! os.query is-core-ge 20 + ! os.query is-core-le 20 os.query is-pc-amd64 ! os.query is-arm ;; @@ -69,27 +75,26 @@ execute: | os.query is-ubuntu 22.04 ! os.query is-ubuntu 20.04 ! os.query is-core + ! os.query is-core-ge 20 + ! os.query is-core-le 20 + ! os.query is-core-le 24 + ! os.query is-core-ge 24 ;; - ubuntu-22.10-64) + ubuntu-24.04-64) os.query is-classic - os.query is-ubuntu 22.10 + os.query is-ubuntu 24.04 ! os.query is-ubuntu 21.04 ! os.query is-core ;; - debian-10-64) + debian-11-64) os.query is-debian - os.query is-debian 10 + os.query is-debian 11 os.query is-classic ! os.query is-core - - # check ubuntu comparisons - ! os.query is-ubuntu-lt 20.04 - os.query is-ubuntu-ge 20.04 | MATCH "os.query: comparing non ubuntu system" - os.query is-ubuntu-lt 2>&1 | MATCH "os.query: version id is expected" ;; - debian-11-64) + debian-12-64) os.query is-debian - os.query is-debian 11 + os.query is-debian 12 os.query is-classic ! os.query is-core ;; @@ -99,16 +104,16 @@ execute: | os.query is-classic ! os.query is-core ;; - fedora-35-64) + fedora-39-64) os.query is-fedora - os.query is-fedora 35 + os.query is-fedora 39 ! os.query is-fedora rawhide os.query is-classic ! os.query is-core ;; - fedora-36-64) + fedora-40-64) os.query is-fedora - os.query is-fedora 36 + os.query is-fedora 40 ! os.query is-fedora rawhide os.query is-classic ! os.query is-core @@ -120,35 +125,32 @@ execute: | ;; amazon-linux-2-64) os.query is-amazon-linux + os.query is-amazon-linux 2 + ! os.query is-amazon-linux 2023 os.query is-classic ! os.query is-core ;; - centos-7-64) - os.query is-centos - os.query is-centos 7 + amazon-linux-2023-64) + os.query is-amazon-linux + os.query is-amazon-linux 2023 + ! os.query is-amazon-linux 2 os.query is-classic ! os.query is-core ;; - centos-8-64) - os.query is-centos - os.query is-centos 8 - ! os.query is-core - ;; centos-9-64) os.query is-centos 9 os.query is-centos ! os.query is-core ;; - opensuse-15.3-64) + opensuse-15.5-64) os.query is-opensuse - os.query is-opensuse 15.3 + os.query is-opensuse 15.5 os.query is-classic ! os.query is-core ;; - opensuse-15.4-64) + opensuse-15.6-64) os.query is-opensuse - os.query is-opensuse 15.4 - ! os.query is-opensuse tumbleweed + os.query is-opensuse 15.6 os.query is-classic ! os.query is-core ;; diff --git a/tests/quiet/task.yaml b/tests/quiet/task.yaml new file mode 100644 index 00000000000..23c7f51ca45 --- /dev/null +++ b/tests/quiet/task.yaml @@ -0,0 +1,12 @@ +summary: test for the quiet tool + +details: | + Check the quiet tool hides the command stdout and but shows the stderr + +backends: [google] + +execute: | + quiet echo test | NOMATCH test + quiet "cat nofile" 2>&1 | MATCH nofile + quiet "cat nofile" 2>&1 | MATCH "quiet: exit status 127" + quiet "cat nofile" 2>&1 | MATCH "quiet: end of output" diff --git a/tests/remote.exec/task.yaml b/tests/remote.exec/task.yaml index 7ceb6f6f920..249e8718c55 100644 --- a/tests/remote.exec/task.yaml +++ b/tests/remote.exec/task.yaml @@ -1,10 +1,13 @@ summary: smoke test for the remote.exec tool +details: | + Check the remote.exec tool is able to run commands in the + remote instance through ssh. + backends: [google] # Amazon linux is skipped because no sshpass available -# ubuntu-22.10-64 is skipped because no sshpass available -systems: [-amazon-linux-*, -ubuntu-22.10-64] +systems: [-amazon-linux-*] prepare: | tests.pkgs install sshpass diff --git a/tests/remote.pull/task.yaml b/tests/remote.pull/task.yaml index f60354a5b5e..658add64e1c 100644 --- a/tests/remote.pull/task.yaml +++ b/tests/remote.pull/task.yaml @@ -1,10 +1,13 @@ summary: smoke test for the remote.pull tool +details: | + Check the remote.pull tool is able to retrieve files from the + remote instance through scp + backends: [google] # Amazon linux is skipped because no sshpass available -# ubuntu-22.10-64 is skipped because no sshpass available -systems: [-amazon-linux-*, -ubuntu-22.10-64] +systems: [-amazon-linux-*] prepare: | tests.pkgs install sshpass @@ -12,18 +15,23 @@ prepare: | restore: | tests.pkgs remove sshpass - rm -rf testfile remote.setup.cfg /home/tools-user-1/* + rm -rf testfile testfile2 /tmp/testfile2 remote.setup.cfg /home/tools-user-1/* execute: | - remote.pull --help | MATCH 'usage: remote.pull ' - remote.pull -h | MATCH 'usage: remote.pull ' + remote.pull --help | MATCH 'usage: remote.pull \[LOCAL_PATH\]' + remote.pull -h | MATCH 'usage: remote.pull \[LOCAL_PATH\]' # check basic pull touch /home/tools-user-1/testfile remote.pull testfile . test -f testfile - # Check errors - remote.pull testfile 2>&1 | MATCH "remote.pull: local and remote paths are required" + # check pull without local dir + touch /tmp/testfile2 + remote.pull /tmp/testfile2 + test -f ./testfile2 + + # Check no parameters + remote.pull | MATCH 'usage: remote.pull \[LOCAL_PATH\]' rm -f remote.setup.cfg remote.pull /home/tools-user-1/testfile . 2>&1 | MATCH "remote.pull: config file \"$(pwd)/remote.setup.cfg\" not found, please run remote.setup command first" diff --git a/tests/remote.push/task.yaml b/tests/remote.push/task.yaml index c9e2cdbcda9..047e5cca070 100644 --- a/tests/remote.push/task.yaml +++ b/tests/remote.push/task.yaml @@ -1,10 +1,13 @@ summary: smoke test for the remote.push tool +details: | + Check the remote.push tool is able to send files from + localhost to the remote instance through scp + backends: [google] # Amazon linux is skipped because no sshpass available -# ubuntu-22.10-64 is skipped because no sshpass available -systems: [-amazon-linux-*, -ubuntu-22.10-64] +systems: [-amazon-linux-*] prepare: | tests.pkgs install sshpass @@ -15,15 +18,20 @@ restore: | rm -rf testfile remote.setup.cfg /home/tools-user-1/* execute: | - remote.push --help | MATCH 'usage: remote.push ' - remote.push -h | MATCH 'usage: remote.push ' + remote.push --help | MATCH 'usage: remote.push \[REMOTE_PATH\]' + remote.push -h | MATCH 'usage: remote.push \[REMOTE_PATH\]' # check basic push touch testfile remote.push testfile "/home/tools-user-1" test -f /home/tools-user-1/testfile - # Check errors - remote.push testfile 2>&1 | MATCH "remote.push: local and remote paths are required" + # check push without target dir + touch testfile2 + remote.push testfile2 + test -f /home/tools-user-1/testfile2 + + # Check no parameters + remote.push | MATCH 'usage: remote.push \[REMOTE_PATH\]' rm -f remote.setup.cfg remote.push testfile "/home/tools-user-1" 2>&1 | MATCH "remote.push: config file \"$(pwd)/remote.setup.cfg\" not found, please run remote.setup command first" diff --git a/tests/remote.refresh/task.yaml b/tests/remote.refresh/task.yaml index c24a75867ec..1b6a7cb47a5 100644 --- a/tests/remote.refresh/task.yaml +++ b/tests/remote.refresh/task.yaml @@ -1,4 +1,9 @@ -summary: smoke test for the remote.wait-for tool +summary: smoke test for the remote.refresh tool + +details: | + Check the remote.refresh tool properly handles refreshes in + the remote instance including the refresh for several snaps + which trigger reboots backends: [google-nested] @@ -10,14 +15,11 @@ environment: host: localhost port: 8022 unit: nested-vm - TARGET/xenial: xenial - TARGET/bionic: bionic + TARGET: xenial prepare: | if [ "$TARGET" = xenial ]; then wget -O pc.img.xz https://storage.googleapis.com/snapd-spread-tests/images/booted/pc-amd64-16-stable-core_beta_2.56.2.img.xz - elif [ "$TARGET" = bionic ]; then - wget -O pc.img.xz https://storage.googleapis.com/snapd-spread-tests/images/booted/pc-amd64-18-stable-snapd_beta_2.56.2.img.xz fi unxz pc.img.xz @@ -27,7 +29,7 @@ prepare: | remote.setup config --host "$host" --port "$port" --user "$user" --pass "$pass" restore: | - tests.systemd stop-and-remove-unit "$unit" + tests.systemd stop-unit --remove "$unit" rm -f pc.img "$(remote.setup get-config-path)" execute: | diff --git a/tests/remote.retry/task.yaml b/tests/remote.retry/task.yaml index 4a6f1315de4..424714e7217 100644 --- a/tests/remote.retry/task.yaml +++ b/tests/remote.retry/task.yaml @@ -1,10 +1,14 @@ summary: smoke test for the remote.retry tool +details: | + This test checks the remote.retry tool properly handles retrying + a command in the remote instance. Also verifies that on failure + the exit code from the final attempt is returned. + backends: [google] # Amazon linux is skipped because no sshpass available -# ubuntu-22.10-64 is skipped because no sshpass available -systems: [-amazon-linux-*, -ubuntu-22.10-64] +systems: [-amazon-linux-*] prepare: | tests.pkgs install sshpass diff --git a/tests/remote.setup/task.yaml b/tests/remote.setup/task.yaml index a600f8c58ee..9ee820b8b02 100644 --- a/tests/remote.setup/task.yaml +++ b/tests/remote.setup/task.yaml @@ -1,5 +1,10 @@ summary: smoke test for the remote.setup tool +details: | + Check the remote.setup tool properly sets up up the + information required to allow connecting to the remote + instance through ssh. + backends: [google] restore: | diff --git a/tests/remote.wait-for/task.yaml b/tests/remote.wait-for/task.yaml index b0cd9a05805..db3a050313f 100644 --- a/tests/remote.wait-for/task.yaml +++ b/tests/remote.wait-for/task.yaml @@ -1,5 +1,10 @@ summary: smoke test for the remote.wait-for tool +details: | + Check the remote.wait-for tool waits properly for several + events in the remote instance. Supported events are: + device-initialized, reboot, refresh, ssh, no-ssh, etc + backends: [google-nested] systems: [ubuntu-20.04-64] @@ -10,14 +15,11 @@ environment: host: localhost port: 8022 unit: nested-vm - TARGET/xenial: xenial - TARGET/bionic: bionic + TARGET: xenial prepare: | if [ "$TARGET" = xenial ]; then wget -O pc.img.xz https://storage.googleapis.com/snapd-spread-tests/images/booted/pc-amd64-16-stable-core_beta_2.56.2.img.xz - elif [ "$TARGET" = bionic ]; then - wget -O pc.img.xz https://storage.googleapis.com/snapd-spread-tests/images/booted/pc-amd64-18-stable-snapd_beta_2.56.2.img.xz fi unxz pc.img.xz @@ -27,7 +29,7 @@ prepare: | remote.setup config --host "$host" --port "$port" --user "$user" --pass "$pass" restore: | - tests.systemd stop-and-remove-unit "$unit" + tests.systemd stop-unit --remove "$unit" rm -f pc.img "$(remote.setup get-config-path)" execute: | @@ -51,7 +53,7 @@ execute: | # Check waiting when reboot remote.exec "sudo reboot" || true remote.wait-for no-ssh --wait 1 -n 20 - remote.wait-for ssh --wait 1 -n 60 + remote.wait-for ssh --wait 1 -n 120 # Check waiting for reboot initial_boot_id="$(remote.exec "cat /proc/sys/kernel/random/boot_id")" diff --git a/tests/repack-kernel/task.yaml b/tests/repack-kernel/task.yaml index 90a946efacc..86e210222a2 100644 --- a/tests/repack-kernel/task.yaml +++ b/tests/repack-kernel/task.yaml @@ -1,5 +1,10 @@ summary: tests for the repack-kernel tool +details: | + Check the repack-kernel tools properly handles extraction of the + kernel snap to a workspace directory, and then repacks it back + to a snap + backends: [google] # ubuntu-core-initramfs seems to be only available on ubuntu-20.04 diff --git a/tests/retry/task.yaml b/tests/retry/task.yaml index d17122dd908..d0b329c2083 100644 --- a/tests/retry/task.yaml +++ b/tests/retry/task.yaml @@ -1,5 +1,9 @@ summary: smoke test for the retry tool +details: | + Check the retry tool allows retrying a command. Verify that on + failure the exit code from the final attempt is returned + backends: [google] execute: | diff --git a/tests/snaps.cleanup/task.yaml b/tests/snaps.cleanup/task.yaml index 97b34fae7fc..380c455bdb0 100644 --- a/tests/snaps.cleanup/task.yaml +++ b/tests/snaps.cleanup/task.yaml @@ -1,5 +1,10 @@ summary: smoke test for the snaps.cleanup tool +details: | + Check the snaps.cleanup tool handles properly the + removal of the installed snaps in the current system. + The test also verifies the fundamental snaps are not removed + backends: [google] systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64, ubuntu-22.04-64] diff --git a/tests/snaps.name/task.yaml b/tests/snaps.name/task.yaml index 5078eddc2a0..45e9deae1a9 100644 --- a/tests/snaps.name/task.yaml +++ b/tests/snaps.name/task.yaml @@ -1,5 +1,10 @@ summary: smoke test for the snaps.name tool +details: | + Check the snaps.name tool properly retrieves the names of the + gadget and kernel snaps installed in the system. Also verifies + the snap-suffix command works properly. + backends: [google] execute: | @@ -10,4 +15,16 @@ execute: | test -z "$(snaps.name kernel)" test "$(snaps.name core)" = "core" + if os.query is-core18; then + test "$(snaps.name snap-suffix)" = "-core18" + elif os.query is-core20; then + test "$(snaps.name snap-suffix)" = "-core20" + elif os.query is-core22; then + test "$(snaps.name snap-suffix)" = "-core22" + elif os.query is-core24; then + test "$(snaps.name snap-suffix)" = "-core24" + else + test -z "$(snaps.name snap-suffix)" + fi + snaps.name my-snap 2>&1 | MATCH "snaps.name: unknown snap my-snap" diff --git a/tests/spread-filter/HACKING.md b/tests/spread-filter/HACKING.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/README.md b/tests/spread-filter/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/res b/tests/spread-filter/res new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/spread-filter/res @@ -0,0 +1 @@ + diff --git a/tests/spread-filter/rules.yaml b/tests/spread-filter/rules.yaml new file mode 100644 index 00000000000..e8532b2e7d5 --- /dev/null +++ b/tests/spread-filter/rules.yaml @@ -0,0 +1,33 @@ +rules: + tests: + from: + - tests/main/.* + - tests/core/.* + - tests/nested/.* + - tests/completion/.* + - tests/cross/.* + - tests/perf/.* + - tests/regression/.* + - tests/smoke/. + - tests/unit/.* + - tests/upgrade/.* + to: [$SELF] + + nested: + from: [tests/lib/nested.sh] + to: [tests/nested/] + + unit: + from: [.*_test.go] + to: + - tests/unit/go + - tests/unit/c-unit-tests-clang + - tests/unit/c-unit-tests-gcc + + docs: + from: [.*.md] + to: [$NONE] + + rest: + from: [.*] + to: [tests/] diff --git a/tests/spread-filter/source/file1 b/tests/spread-filter/source/file1 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/source/file2 b/tests/spread-filter/source/file2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/source/lib1/file3 b/tests/spread-filter/source/lib1/file3 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/source/lib1/lib1 b/tests/spread-filter/source/lib1/lib1 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/source/lib1/lib1_test.py b/tests/spread-filter/source/lib1/lib1_test.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/source/lib1/task.yaml b/tests/spread-filter/source/lib1/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/source/lib1/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/source/lib2/lib2 b/tests/spread-filter/source/lib2/lib2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/source/lib2/lib2_test.py b/tests/spread-filter/source/lib2/lib2_test.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/source/lib2/lib2_test.py.back b/tests/spread-filter/source/lib2/lib2_test.py.back new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/task.yaml b/tests/spread-filter/task.yaml new file mode 100644 index 00000000000..38b3f81ee51 --- /dev/null +++ b/tests/spread-filter/task.yaml @@ -0,0 +1,91 @@ +summary: test for the spread-filter utility + +details: | + Check that the spread-filter utility properly retrieves the list of tests + to execute, following the rules defined for the project and based on a + set of changes. + +backends: [google] + +systems: [ubuntu-22.04-64] + +execute: | + spread-filter --help | MATCH 'usage: spread-filter' + spread-filter -h | MATCH 'usage: spread-filter' + + # Scenario: 1 test changed + spread-filter -r rules.yaml -p google:ubuntu-22.04-64 -c tests/main/test1/task.yaml > res + MATCH "^google:ubuntu-22.04-64:tests/main/test1$" < res + + # Scenario: 2 tests changed + spread-filter -r rules.yaml -p google:ubuntu -c tests/main/test1/task.yaml -c tests/core/test1/task.yaml > res + MATCH "^google:ubuntu:tests/main/test1 google:ubuntu:tests/core/test1$" < res + + # Scenario: 2 files on the same test dir + spread-filter -r rules.yaml -p google:ubuntu -c tests/core/test2/task.yaml -c tests/core/test2/otherfile.py > res + MATCH "^google:ubuntu:tests/core/test2$" < res + + # Scenario: 2 files on the same test dir but 1 file does not exist (deleted) + spread-filter -r rules.yaml -p google:ubuntu -c tests/core/test2/task.yaml -c tests/core/test2/noexist > res + MATCH "^google:ubuntu:tests/core/test2$" < res + + # Scenario: 3 files on the same test dir but 2 files are in subdir and 1 file does not exist (deleted) + spread-filter -r rules.yaml -p google:ubuntu -c tests/main/test2/otherfile -c tests/main/test2/snap/bin/sh -c tests/main/test2/snap/meta/noexist > res + MATCH "^google:ubuntu:tests/main/test2$" < res + + # Scenario: 1 file and 1 subdirectory changed + spread-filter -r rules.yaml -p google:ubuntu -c tests/main/test2/otherfile -c tests/main/test2/snap > res + MATCH "^google:ubuntu:tests/main/test2$" < res + + # Scenario: 1 test and other file changed (check just the big run survives) + spread-filter -r rules.yaml -p google:ubuntu -c tests/main/test2/task.yaml -c source/lib1/lib1 > res + MATCH "^google:ubuntu:tests/$" < res + + # Scenario: 2 unit tests changed + spread-filter -r rules.yaml -p google:ubuntu -c source/lib1/lib1_test.go -c source/lib2/lib2_test.go > res + MATCH "^google:ubuntu:tests/unit/c-unit-tests-clang google:ubuntu:tests/unit/c-unit-tests-gcc google:ubuntu:tests/unit/go$" < res + + # Scenario: 1 unit tests and 1 test changed + spread-filter -r rules.yaml -p google:ubuntu -c source/lib1/lib1_test.go -c tests/main/test1/noexist.go > res + MATCH "^google:ubuntu:tests/unit/c-unit-tests-clang google:ubuntu:tests/unit/c-unit-tests-gcc google:ubuntu:tests/main/test1 google:ubuntu:tests/unit/go$" < res + + # Scenario: a doc file changed + spread-filter -r rules.yaml -p google:ubuntu -c README.md > res + test "$(wc -w < res)" -eq 0 + + # Scenario: a doc file which does not exist changed (deleted) + spread-filter -r rules.yaml -p google:ubuntu -c DELETED.md > res + test "$(wc -w < res)" -eq 0 + + # Scenario: a doc file and a the nested library changed + spread-filter -r rules.yaml -p google:ubuntu -c README.md -c tests/lib/nested.sh > res + MATCH "^google:ubuntu:tests/nested/$" < res + + # Scenario: 1 test and also another which is substring of previous one changed + spread-filter -r rules.yaml -p google:ubuntu -c README.md -c tests/main/test1/task.yaml -c tests/main/test1b/task.yaml > res + MATCH "^google:ubuntu:tests/main/test1b google:ubuntu:tests/main/test1$" < res + + # Scenario: a file in the test suite but not in a test dir changed + spread-filter -r rules.yaml -p google:ubuntu -c tests/core/other/lib1 > res + test "$(wc -w < res)" -eq 0 + + # Scenario: the nested lib and a nested test are changed (check the test is cleaned) + spread-filter -r rules.yaml -p google:ubuntu -c tests/lib/nested.sh -c tests/nested/test1/task.yaml > res + MATCH "^google:ubuntu:tests/nested/$" < res + + # Scenario: the nested lib, a source file and a nested test are changed (check just tests/ survives) + spread-filter -r rules.yaml -p google:ubuntu -c tests/lib/nested.sh -c source/lib1/lib1 -c tests/nested/test1/task.yaml > res + MATCH "^google:ubuntu:tests/$" < res + + # Scenario: check -v parameter works + spread-filter -r rules.yaml -p google:ubuntu -c tests/lib/nested.sh -v > res + MATCH "cleaning executions" < res + + # Scenario: check mandatory parameters + ARG_TEXT="spread-filter: error: the following arguments are required" + spread-filter -r rules.yaml -c tests/lib/nested.sh 2>&1 | MATCH "$ARG_TEXT" + spread-filter -p google:ubuntu -c tests/lib/nested.sh 2>&1 | MATCH "$ARG_TEXT" + + # Scenario: check the rules file + FILE_TEXT="spread-filter: rules file 'noexist.yaml' does not exist" + spread-filter -r noexist.yaml -p google:ubuntu -c tests/lib/nested.sh 2>&1 | MATCH "$FILE_TEXT" diff --git a/tests/spread-filter/tests/core/other/lib1 b/tests/spread-filter/tests/core/other/lib1 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/core/other/lib2 b/tests/spread-filter/tests/core/other/lib2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/core/test1/helper.py b/tests/spread-filter/tests/core/test1/helper.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/core/test1/task.yaml b/tests/spread-filter/tests/core/test1/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/core/test1/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/core/test2/otherfile.py b/tests/spread-filter/tests/core/test2/otherfile.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/core/test2/task.yaml b/tests/spread-filter/tests/core/test2/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/core/test2/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/lib/lib1.sh b/tests/spread-filter/tests/lib/lib1.sh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/lib/lib2.sh b/tests/spread-filter/tests/lib/lib2.sh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/lib/nested.sh b/tests/spread-filter/tests/lib/nested.sh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/lib/tools/suite/test1/helper.sh b/tests/spread-filter/tests/lib/tools/suite/test1/helper.sh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/lib/tools/suite/test1/task.yaml b/tests/spread-filter/tests/lib/tools/suite/test1/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/lib/tools/suite/test1/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/lib/tools/suite/test2/snap/bin/sh b/tests/spread-filter/tests/lib/tools/suite/test2/snap/bin/sh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/lib/tools/suite/test2/snap/meta/snap.yaml b/tests/spread-filter/tests/lib/tools/suite/test2/snap/meta/snap.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/lib/tools/suite/test2/snap/otherfile b/tests/spread-filter/tests/lib/tools/suite/test2/snap/otherfile new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/lib/tools/suite/test2/task.yaml b/tests/spread-filter/tests/lib/tools/suite/test2/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/lib/tools/suite/test2/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/main/test1/task.yaml b/tests/spread-filter/tests/main/test1/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/main/test1/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/main/test11/task.yaml b/tests/spread-filter/tests/main/test11/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/main/test11/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/main/test1b/logs/log1.txt b/tests/spread-filter/tests/main/test1b/logs/log1.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/main/test1b/logs/log2.txt b/tests/spread-filter/tests/main/test1b/logs/log2.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/main/test1b/task.yaml b/tests/spread-filter/tests/main/test1b/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/main/test1b/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/main/test2/snap/bin/sh b/tests/spread-filter/tests/main/test2/snap/bin/sh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/main/test2/snap/meta/snap.yaml b/tests/spread-filter/tests/main/test2/snap/meta/snap.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/main/test2/snap/otherfile b/tests/spread-filter/tests/main/test2/snap/otherfile new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/main/test2/task.yaml b/tests/spread-filter/tests/main/test2/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/main/test2/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/nested/test1/task.yaml b/tests/spread-filter/tests/nested/test1/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/nested/test1/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/nested/test2/snap/bin/sh b/tests/spread-filter/tests/nested/test2/snap/bin/sh new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/nested/test2/snap/meta/snap.yaml b/tests/spread-filter/tests/nested/test2/snap/meta/snap.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/nested/test2/snap/otherfile b/tests/spread-filter/tests/nested/test2/snap/otherfile new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-filter/tests/nested/test2/task.yaml b/tests/spread-filter/tests/nested/test2/task.yaml new file mode 100644 index 00000000000..ef424a8b447 --- /dev/null +++ b/tests/spread-filter/tests/nested/test2/task.yaml @@ -0,0 +1,6 @@ +summary: test file + +details: test file + +execute: | + echo "works" diff --git a/tests/spread-filter/tests/nested/test2/task.yaml.old b/tests/spread-filter/tests/nested/test2/task.yaml.old new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/spread-manager/checks/task1/task.yaml b/tests/spread-manager/checks/task1/task.yaml index df2d11f370e..a2a5929892a 100644 --- a/tests/spread-manager/checks/task1/task.yaml +++ b/tests/spread-manager/checks/task1/task.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: test + prepare: | echo "preparing" diff --git a/tests/spread-manager/checks/task2/task.yaml b/tests/spread-manager/checks/task2/task.yaml index 047716317b1..7ae94af14f7 100644 --- a/tests/spread-manager/checks/task2/task.yaml +++ b/tests/spread-manager/checks/task2/task.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: test + manual: false prepare: | diff --git a/tests/spread-manager/checks/task3/task.yaml b/tests/spread-manager/checks/task3/task.yaml index 896d23d798f..02a2c23fb0b 100644 --- a/tests/spread-manager/checks/task3/task.yaml +++ b/tests/spread-manager/checks/task3/task.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: test + manual: true prepare: | diff --git a/tests/spread-manager/checks/task4/task.yaml b/tests/spread-manager/checks/task4/task.yaml index e64e4c94626..8941e006ce7 100644 --- a/tests/spread-manager/checks/task4/task.yaml +++ b/tests/spread-manager/checks/task4/task.yaml @@ -1,5 +1,7 @@ summary: this is the summary +details: test + #manual: true prepare: | diff --git a/tests/spread-manager/task.yaml b/tests/spread-manager/task.yaml index b3f115ab4ab..817a08fe005 100644 --- a/tests/spread-manager/task.yaml +++ b/tests/spread-manager/task.yaml @@ -1,5 +1,9 @@ summary: smoke test for the spread-manager tool +details: | + Check the spread-manager tool allows setting a list of tests as manual. + Also checks manual tag can be removed for a list of tests. + backends: [google] systems: [ ubuntu-20.04-64 ] diff --git a/tests/spread-shellcheck/task.yaml b/tests/spread-shellcheck/task.yaml index 51037cac4af..bcbdb1ddfd7 100644 --- a/tests/spread-shellcheck/task.yaml +++ b/tests/spread-shellcheck/task.yaml @@ -1,5 +1,11 @@ summary: smoke test for the spread-shellcheck tool +details: | + Check the spread-shellcheck properly runs the shellcheck + tool in all the sections of the spread tasks. Also check the + tool can run in a directory tree and skips checks when + it finds "shellcheck disable". + backends: [google] systems: [ ubuntu-20.04-64 ] diff --git a/tests/tests.backup/task.yaml b/tests/tests.backup/task.yaml index 43f65d04d04..140abeb0add 100644 --- a/tests/tests.backup/task.yaml +++ b/tests/tests.backup/task.yaml @@ -1,5 +1,9 @@ summary: tests for the tests.backup tool +details: | + Check the tests.backup tool properly backs up and + restores a specific directory. + backends: [google] execute: | diff --git a/tests/tests.cleanup/task.yaml b/tests/tests.cleanup/task.yaml index d753eb0f3f9..d230365e713 100644 --- a/tests/tests.cleanup/task.yaml +++ b/tests/tests.cleanup/task.yaml @@ -1,5 +1,9 @@ summary: tests for the tests.cleanup tool +details: | + Check the tests.cleanup tool allows to defer, pop and + restore commands in tests. + backends: [google] systems: [ubuntu-18.04-64] diff --git a/tests/tests.pkgs/task.yaml b/tests/tests.pkgs/task.yaml index b4573913c27..05e6b9f98ee 100644 --- a/tests/tests.pkgs/task.yaml +++ b/tests/tests.pkgs/task.yaml @@ -1,5 +1,10 @@ summary: Smoke test for tests.pkgs tool +details: | + Check the tests.pkgs tool allows managing native packages independently + of the system being used. Verify that packages can be installed, queried + and removed among other operations. + backends: [google] execute: | @@ -10,11 +15,9 @@ execute: | # pkgs tool presents the usage screen when invoked without arguments # or with the -h or --help options. - tests.pkgs | MATCH 'usage: tests.pkgs {install,remove} \[PACKAGE...\]' - tests.pkgs -h | MATCH 'usage: tests.pkgs {install,remove} \[PACKAGE...\]' - tests.pkgs --help | MATCH 'usage: tests.pkgs {install,remove} \[PACKAGE...\]' - - # Update the packages db + tests.pkgs | MATCH 'usage: tests.pkgs install \[--no-install-recommends\] \[PACKAGE...\]' + tests.pkgs -h | MATCH 'usage: tests.pkgs install \[--no-install-recommends\] \[PACKAGE...\]' + tests.pkgs --help | MATCH 'usage: tests.pkgs install \[--no-install-recommends\] \[PACKAGE...\]' # Check the test pkg is not installed not tests.pkgs is-installed test-snapd-pkg-1 @@ -29,6 +32,11 @@ execute: | tests.pkgs query test-snapd-pkg-1 not tests.pkgs is-installed test-snapd-pkg-1 + # Install a package with --no-install-recommends option + tests.pkgs install --no-install-recommends test-snapd-pkg-1 + tests.pkgs query test-snapd-pkg-1 + tests.pkgs remove test-snapd-pkg-1 + # Install 2 test pkgs and check they are is installed tests.pkgs install test-snapd-pkg-1 test-snapd-pkg-2 tests.pkgs is-installed test-snapd-pkg-1 @@ -39,7 +47,34 @@ execute: | not tests.pkgs is-installed test-snapd-pkg-1 not tests.pkgs is-installed test-snapd-pkg-2 + # Download 2 packages, trusty does not support apt download + PKG1="grep" + PKG2="curl" + MAXDEPTH=1 + if os.query is-opensuse; then + MAXDEPTH=4 + fi + if os.query is-arch-linux || os.query is-fedora || os.query is-opensuse; then + PKG2="vi" + fi + + if not os.query is-trusty; then + tests.pkgs download "$PKG1" "$PKG2" + if os.query is-opensuse; then + find . -maxdepth "$MAXDEPTH" -name "$PKG1*" + find . -maxdepth "$MAXDEPTH" -name "$PKG2*" + fi + fi + # Check the message when a command is not supported tests.pkgs noexist test-snapd-pkg-1 2>&1 | MATCH 'tests.pkgs: unknown command noexist' tests.pkgs -install test-snapd-pkg-1 2>&1 | MATCH 'tests.pkgs: unknown option -install' + # Install the test package, verify its installation and query it + # Run this only on amd64 and skip Trusty + if ( os.query is-debian || os.query is-ubuntu-ge 1604 ) && os.query is-pc-amd64 ; then + dpkg --add-architecture i386 + tests.pkgs install test-snapd-pkg-3 + tests.pkgs is-installed test-snapd-pkg-3 + tests.pkgs remove test-snapd-pkg-3 + fi diff --git a/tests/tests.systemd/task.yaml b/tests/tests.systemd/task.yaml index b6144b354f4..b8d3d3f2e84 100644 --- a/tests/tests.systemd/task.yaml +++ b/tests/tests.systemd/task.yaml @@ -1,11 +1,16 @@ summary: smoke test for the tests.systemd tool +details: | + Check the tests.systemd properly manages systemd services. + Verify the tool is able to create units, wait for status and + stop units. + backends: [google] systems: [-ubuntu-14.04-64] restore: | - tests.systemd stop-and-remove-unit my-test || true + tests.systemd stop-unit --remove my-test execute: | tests.systemd | MATCH 'usage: tests.systemd create-and-start-unit' @@ -15,30 +20,50 @@ execute: | # check a simple unit tests.systemd create-and-start-unit my-test "/bin/sleep 500" systemctl is-active my-test - tests.systemd stop-and-remove-unit my-test + tests.systemd stop-unit --remove my-test not systemctl is-active my-test # check the wait-for-service works when unit is inactive tests.systemd create-and-start-unit my-test "/bin/sleep 5" - tests.systemd wait-for-service my-test active - tests.systemd wait-for-service my-test inactive - tests.systemd stop-and-remove-unit my-test + tests.systemd wait-for-service --state active my-test + tests.systemd wait-for-service --state inactive my-test + tests.systemd stop-unit --remove my-test systemctl list-unit-files | NOMATCH my-test + # check the wait-for-service works when unit is inactive + tests.systemd create-and-start-unit my-test "/bin/sleep 10" + tests.systemd wait-for-service --state active my-test + not tests.systemd wait-for-service --state inactive --wait 1 -n 3 my-test + tests.systemd wait-for-service --state inactive --wait 2 --attempts 5 my-test + tests.systemd stop-unit --remove my-test + systemctl list-unit-files | NOMATCH my-test + + # Check stop-unit + tests.systemd create-and-start-unit my-test-1 "/bin/sleep 10" + tests.systemd create-and-start-unit my-test-2 "/bin/sleep 10" + tests.systemd stop-unit my-test-1 my-test-2 + not systemctl is-active my-test-1 + not systemctl is-active my-test-2 + systemctl is-enabled my-test-1 + systemctl is-enabled my-test-2 + tests.systemd stop-unit --remove my-test-1 my-test-2 + not systemctl is-enabled my-test-1 + not systemctl is-enabled my-test-2 + # check missing parameters and start twice the same unit tests.systemd create-and-start-unit 2>&1 | MATCH "tests.systemd: unit name cannot be empty" tests.systemd create-and-start-unit my-test 2>&1 | MATCH "tests.systemd: unit command line cannot be empty" tests.systemd create-and-start-unit my-test "/bin/sleep 5" - tests.systemd create-and-start-unit my-test "/bin/sleep 5" 2>&1 | MATCH "tests.systemd: unit service file already exist" - tests.systemd stop-and-remove-unit 2>&1 | MATCH "tests.systemd: unit name cannot be empty" - tests.systemd stop-and-remove-unit 2>&1 | MATCH "tests.systemd: unit name cannot be empty" - tests.systemd stop-and-remove-unit my-test + tests.systemd create-and-start-unit my-test "/bin/sleep 5" | MATCH "tests.systemd: unit service file already exist, it is going to be overwritten" + tests.systemd stop-unit 2>&1 | MATCH "tests.systemd: at least a unit name is required" + tests.systemd stop-unit --remove 2>&1 | MATCH "tests.systemd: at least a unit name is required" + tests.systemd stop-unit --remove my-test # check unit override tests.systemd create-and-start-unit my-test "/bin/sleep 100" "[Unit]\nAfter=foo" systemctl cat my-test | MATCH "^ExecStart=/bin/sleep 100$" systemctl cat my-test | MATCH "^After=foo$" - tests.systemd stop-and-remove-unit my-test + tests.systemd stop-unit --remove my-test # check a unit can be removed when it already was removed - tests.systemd stop-and-remove-unit my-test + tests.systemd stop-unit --remove my-test diff --git a/tools/os.query b/tools/os.query index 5ae9c0398b2..0692560d121 100755 --- a/tools/os.query +++ b/tools/os.query @@ -3,8 +3,9 @@ show_help() { echo "usage: os.query is-core, is-classic" echo " os.query is-core16, is-core18, is-core20, is-core22, is-core24" - echo " os.query is-trusty, is-xenial, is-bionic, is-focal, is-jammy" - echo " os.query is-ubuntu [ID], is-debian [ID], is-fedora [ID], is-amazon-linux, is-arch-linux, is-centos [ID], is-opensuse [ID]" + echo " os.query is-core-gt, is-core-ge, is-core-lt, is-core-le" + echo " os.query is-trusty, is-xenial, is-bionic, is-focal, is-jammy, is-noble" + echo " os.query is-ubuntu [ID], is-debian [ID], is-fedora [ID], is-amazon-linux [ID], is-arch-linux, is-centos [ID], is-opensuse [ID]" echo " os.query is-ubuntu-gt [ID], is-ubuntu-ge [ID], is-ubuntu-lt [ID], is-ubuntu-le [ID]" echo " os.query is-pc-amd64, is-pc-i386, is-arm, is-armhf, is-arm64, is-s390x" echo "" @@ -12,63 +13,67 @@ show_help() { } is_core() { - # We need to check $SPREAD_SYSTEM var because in snapd the os-release file does - # not contain the ubuntu-core info while the system is being prepared - if [ -n "$SPREAD_SYSTEM" ]; then - [[ "$SPREAD_SYSTEM" == ubuntu-core-* ]] - else - grep -qFx 'ID=ubuntu-core' /etc/os-release - fi + grep -qFx 'ID=ubuntu-core' /etc/os-release } is_core16() { - # We need to check $SPREAD_SYSTEM var because in snapd the os-release file does - # not contain the ubuntu-core info while the system is being prepared - if [ -n "$SPREAD_SYSTEM" ]; then - [[ "$SPREAD_SYSTEM" == ubuntu-core-16-* ]] - else - grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="16"' /etc/os-release - fi + grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="16"' /etc/os-release } is_core18() { - # We need to check $SPREAD_SYSTEM var because in snapd the os-release file does - # not contain the ubuntu-core info while the system is being prepared - if [ -n "$SPREAD_SYSTEM" ]; then - [[ "$SPREAD_SYSTEM" == ubuntu-core-18-* ]] - else - grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="18"' /etc/os-release - fi + grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="18"' /etc/os-release } is_core20() { - # We need to check $SPREAD_SYSTEM var because in snapd the os-release file does - # not contain the ubuntu-core info while the system is being prepared - if [ -n "$SPREAD_SYSTEM" ]; then - [[ "$SPREAD_SYSTEM" == ubuntu-core-20-* ]] - else - grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="20"' /etc/os-release - fi + grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="20"' /etc/os-release } is_core22() { - # We need to check $SPREAD_SYSTEM var because in snapd the os-release file does - # not contain the ubuntu-core info while the system is being prepared - if [ -n "$SPREAD_SYSTEM" ]; then - [[ "$SPREAD_SYSTEM" == ubuntu-core-22-* ]] - else - grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="22"' /etc/os-release - fi + grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="22"' /etc/os-release } is_core24() { - # We need to check $SPREAD_SYSTEM var because in snapd the os-release file does - # not contain the ubuntu-core info while the system is being prepared - if [ -n "$SPREAD_SYSTEM" ]; then - [[ "$SPREAD_SYSTEM" == ubuntu-core-24-* ]] - else - grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="24"' /etc/os-release + grep -qFx 'ID=ubuntu-core' /etc/os-release && grep -qFx 'VERSION_ID="24"' /etc/os-release +} + +is_core_gt() { + local VERSION=$1 + if [ -z "$VERSION" ]; then + echo "os.query: version id is expected" + exit 1 fi + + is_core && compare_ubuntu "$VERSION" "-gt" +} + +is_core_ge() { + local VERSION=$1 + if [ -z "$VERSION" ]; then + echo "os.query: version id is expected" + exit 1 + fi + + is_core && compare_ubuntu "$VERSION" "-ge" +} + +is_core_lt() { + local VERSION=$1 + if [ -z "$VERSION" ]; then + echo "os.query: version id is expected" + exit 1 + fi + + is_core && compare_ubuntu "$VERSION" "-lt" +} + +is_core_le() { + local VERSION=$1 + if [ -z "$VERSION" ]; then + echo "os.query: version id is expected" + exit 1 + fi + + is_core && compare_ubuntu "$VERSION" "-le" } is_classic() { @@ -95,6 +100,10 @@ is_jammy() { grep -qFx 'UBUNTU_CODENAME=jammy' /etc/os-release } +is_noble() { + grep -qFx 'UBUNTU_CODENAME=noble' /etc/os-release +} + is_ubuntu() { VERSION=$1 if [ -z "$VERSION" ]; then @@ -105,19 +114,19 @@ is_ubuntu() { } is_ubuntu_gt() { - compare_ubuntu "${1:-}" "-gt" + is_classic && compare_ubuntu "${1:-}" "-gt" } is_ubuntu_ge() { - compare_ubuntu "${1:-}" "-ge" + is_classic && compare_ubuntu "${1:-}" "-ge" } is_ubuntu_lt() { - compare_ubuntu "${1:-}" "-lt" + is_classic && compare_ubuntu "${1:-}" "-lt" } is_ubuntu_le() { - compare_ubuntu "${1:-}" "-le" + is_classic && compare_ubuntu "${1:-}" "-le" } compare_ubuntu() { @@ -129,7 +138,7 @@ compare_ubuntu() { exit 1 fi - if ! grep -qFx 'ID=ubuntu' /etc/os-release; then + if ! grep -q 'ID=ubuntu' /etc/os-release; then echo "os.query: comparing non ubuntu system" return 1 fi @@ -151,7 +160,6 @@ compare_ubuntu() { test "$SYS_VERSION" "$OPERAND" "$NUM_VERSION" } - is_debian() { VERSION=$1 if [ -z "$VERSION" ]; then @@ -183,7 +191,12 @@ is_fedora() { } is_amazon_linux() { - grep -qFx 'ID="amzn"' /etc/os-release + VERSION=$1 + if [ -z "$VERSION" ]; then + grep -qFx 'ID="amzn"' /etc/os-release + else + grep -qFx 'ID="amzn"' /etc/os-release && grep -qFx "VERSION_ID=\"$VERSION\"" /etc/os-release + fi } is_centos() { diff --git a/tools/quiet b/tools/quiet new file mode 100755 index 00000000000..48c1f2aa1e5 --- /dev/null +++ b/tools/quiet @@ -0,0 +1,32 @@ +#!/bin/bash + +# use "quiet foo" when you expect "foo" to produce a lot of output +# that isn't useful unless foo itself fails. +quiet() ( + # note this is a subshell (parens instead of braces around the function) + # so this set only affects this function and not the caller + { set +x; } >&/dev/null + + # not strictly needed because it's a subshell, but good practice + local tf retval + + tf="$(mktemp)" + + set +e + "$@" >& "$tf" + retval=$? + set -e + + if [ "$retval" != "0" ]; then + echo "quiet: $*" >&2 + echo "quiet: exit status $retval. Output follows:" >&2 + cat "$tf" >&2 + echo "quiet: end of output." >&2 + fi + + rm -f -- "$tf" + + return $retval +) + +quiet "$@" diff --git a/tools/snaps.name b/tools/snaps.name index f75e79482d6..e562e9266e9 100755 --- a/tools/snaps.name +++ b/tools/snaps.name @@ -1,7 +1,7 @@ #!/bin/bash show_help() { - echo "usage: snaps.name gadget, kernel, core" + echo "usage: snaps.name gadget, kernel, core, snap-suffix" echo "" echo "get the name of a specific snap for the current system" } @@ -25,6 +25,18 @@ core_name(){ echo "$core_name" } +snap_suffix(){ + if os.query is-core18; then + echo "-core18" + elif os.query is-core20; then + echo "-core20" + elif os.query is-core22; then + echo "-core22" + elif os.query is-core24; then + echo "-core24" + fi +} + main() { if [ $# -eq 0 ]; then show_help @@ -49,6 +61,10 @@ main() { core_name exit ;; + snap-suffix) + snap_suffix + exit + ;; *) echo "snaps.name: unknown snap $1" >&2 exit 1 diff --git a/tools/tests.pkgs b/tools/tests.pkgs index 97677e09fb6..89c51a7a3a3 100755 --- a/tools/tests.pkgs +++ b/tools/tests.pkgs @@ -1,8 +1,12 @@ #!/bin/bash -e show_help() { - echo "usage: tests.pkgs {install,remove} [PACKAGE...]" - echo " tests.pkgs {is-installed,query} [PACKAGE]" + echo "usage: tests.pkgs install [--no-install-recommends] [PACKAGE...]" + echo " tests.pkgs remove [PACKAGE...]" + echo " tests.pkgs download [PACKAGE...]" + echo " tests.pkgs is-installed [PACKAGE]" + echo " tests.pkgs query [PACKAGE]" + echo " tests.pkgs list-installed" echo echo "Package names are standardized based on Debian package names" echo "internally, package names are re-mapped to fit the convention" @@ -19,6 +23,16 @@ cmd_install() { unsupported } +cmd_install_local() { + # This is re-defined by the backend file. + unsupported +} + +cmd_download() { + # This is re-defined by the backend file. + unsupported +} + cmd_is_installed() { # This is re-defined by the backend file. unsupported @@ -112,7 +126,7 @@ main() { shift break ;; - install|remove|query|is-installed|list-installed) + install|remove|query|is-installed|list-installed|download) action="$1" shift break # consume remaining arguments @@ -130,7 +144,8 @@ main() { case "$action" in install) - cmd_install "$(remap_many "$@")" + # shellcheck disable=SC2046 + cmd_install $(remap_many "$@") ;; is-installed) cmd_is_installed "$(remap_one "$@")" @@ -142,7 +157,11 @@ main() { cmd_list_installed ;; remove) - cmd_remove "$(remap_many "$@")" + # shellcheck disable=SC2046 + cmd_remove $(remap_many "$@") + ;; + download) + cmd_download "$(remap_many "$@")" ;; *) echo "tests.pkgs: unknown action $action" >&2 diff --git a/tools/tests.pkgs.apt.sh b/tools/tests.pkgs.apt.sh index 71d2a539417..51e66b1efd8 100644 --- a/tools/tests.pkgs.apt.sh +++ b/tools/tests.pkgs.apt.sh @@ -22,6 +22,15 @@ remap_one() { test-snapd-pkg-2) echo "robotfindskitten" ;; + test-snapd-pkg-3) + if os.query is-debian || os.query is-trusty; then + echo cpp:i386 + elif os.query is-xenial || os.query is-bionic; then + echo cpp-5:i386 + else + echo cpp-9:i386 + fi + ;; *) echo "$1" ;; @@ -29,34 +38,49 @@ remap_one() { } cmd_install() { - set -x apt-get update - # shellcheck disable=SC2068 - apt-get install --yes $@ - set +x + + local APT_FLAGS="--yes" + while [ -n "$1" ]; do + case "$1" in + --no-install-recommends) + APT_FLAGS="$APT_FLAGS --no-install-recommends" + shift + ;; + *) + break + ;; + esac + done + # shellcheck disable=SC2086 + apt-get install $APT_FLAGS "$@" } cmd_is_installed() { - set -x - dpkg -S "$1" >/dev/null 2>&1 - set +x + dpkg -l "$1" | grep -E "ii +$1" >/dev/null 2>&1 } cmd_query() { - set -x apt-cache policy "$1" - set +x } cmd_list_installed() { - set -x - apt list --installed | cut -d/ -f1 | sort - set +x + apt list --installed | cut -d ' ' -f 1,3 | sed -e 's@/.*\s@:@g' | sort } cmd_remove() { - set -x + # Allow removing essential packages, that may get installed when using i386 + # packages on amd64 system. Normally they would be really essential but in + # this case they are not really as essential. + local REMOVE_FLAGS="--allow-remove-essential" + if os.query is-trusty; then + REMOVE_FLAGS="" + fi + # shellcheck disable=SC2086 + apt-get remove --yes $REMOVE_FLAGS "$@" +} + +cmd_download() { # shellcheck disable=SC2068 - apt-get remove --yes $@ - set +x + apt download -q $@ >/dev/null } diff --git a/tools/tests.pkgs.dnf-yum.sh b/tools/tests.pkgs.dnf-yum.sh index 2e83610e7b2..4b82f77c62b 100644 --- a/tools/tests.pkgs.dnf-yum.sh +++ b/tools/tests.pkgs.dnf-yum.sh @@ -27,45 +27,58 @@ remap_one() { } cmd_install() { - set -x - # shellcheck disable=SC2068 - if [ "$(command -v dnf)" != "" ]; then - dnf install -y $@ - else - yum install -y $@ + local CMD="dnf" + if [ -z "$(command -v dnf)" ]; then + CMD="yum" fi - set +x + local DNF_YUM_FLAGS="-y" + + while [ -n "$1" ]; do + case "$1" in + --no-install-recommends) + DNF_YUM_FLAGS="$DNF_YUM_FLAGS --setopt=install_weak_deps=False" + shift + ;; + *) + break + ;; + esac + done + + # shellcheck disable=SC2068,SC2086 + $CMD install $DNF_YUM_FLAGS $@ } cmd_is_installed() { - set -x rpm -qi "$1" >/dev/null 2>&1 - set +x } cmd_query() { - set -x if [ "$(command -v dnf)" != "" ]; then dnf info "$1" else yum info "$1" fi - set +x } cmd_list_installed() { - set -x rpm -qa | sort - set +x } cmd_remove() { - set -x # shellcheck disable=SC2068 if [ "$(command -v dnf)" != "" ]; then dnf remove -y $@ else yum remove -y $@ fi - set +x +} + +cmd_download() { + # shellcheck disable=SC2068 + if [ "$(command -v dnf)" != "" ]; then + dnf download -q $@ + else + yum reinstall --downloadonly -q -y --downloaddir "${PWD:-.}" $@ + fi } diff --git a/tools/tests.pkgs.pacman.sh b/tools/tests.pkgs.pacman.sh index d6c71e620b3..37c49fa2aa0 100644 --- a/tools/tests.pkgs.pacman.sh +++ b/tools/tests.pkgs.pacman.sh @@ -25,7 +25,7 @@ remap_one() { echo "python-gobject" ;; test-snapd-pkg-1) - echo "curseofwar" + echo "cmus" ;; test-snapd-pkg-2) echo "robotfindskitten" @@ -37,33 +37,40 @@ remap_one() { } cmd_install() { - set -x - # shellcheck disable=SC2068 - pacman -S --noconfirm $@ - set +x + local PACMAN_FLAGS="--noconfirm" + while [ -n "$1" ]; do + case "$1" in + --no-install-recommends) + # Pacman only ever installs the required dependencies + shift + ;; + *) + break + ;; + esac + done + # shellcheck disable=SC2068,SC2086 + pacman -S $PACMAN_FLAGS $@ } cmd_is_installed() { - set -x pacman -Qi "$1" >/dev/null 2>&1 - set +x } cmd_query() { - set -x pacman -Si "$1" - set +x } cmd_list_installed() { - set -x pacman -Qe | awk '{ print $1 }' | sort - set +x } cmd_remove() { - set -x # shellcheck disable=SC2068 pacman -Rnsc --noconfirm $@ - set +x +} + +cmd_download() { + # shellcheck disable=SC2068 + pacman -Sw --noconfirm --cachedir "${PWD:-.}" -q $@ >/dev/null } diff --git a/tools/tests.pkgs.zypper.sh b/tools/tests.pkgs.zypper.sh index 1475c9ff4f5..218102b6e60 100644 --- a/tools/tests.pkgs.zypper.sh +++ b/tools/tests.pkgs.zypper.sh @@ -31,33 +31,41 @@ remap_one() { } cmd_install() { - set -x - # shellcheck disable=SC2068 - zypper install -y $@ - set +x + local ZYPPER_FLAGS="-y" + while [ -n "$1" ]; do + case "$1" in + --no-install-recommends) + ZYPPER_FLAGS="$ZYPPER_FLAGS --no-recommends" + shift + ;; + *) + break + ;; + esac + done + + # shellcheck disable=SC2068,SC2086 + zypper install $ZYPPER_FLAGS $@ } cmd_is_installed() { - set -x rpm -qi "$1" >/dev/null 2>&1 - set +x } cmd_query() { - set -x zypper info "$1" - set +x } cmd_list_installed() { - set -x rpm -qa | sort - set +x } cmd_remove() { - set -x # shellcheck disable=SC2068 zypper remove -y $@ - set +x +} + +cmd_download() { + # shellcheck disable=SC2068 + zypper --pkg-cache-dir "${PWD:-.}" -q download $@ } diff --git a/tools/tests.systemd b/tools/tests.systemd index bf6fc6cd037..fc63338b27c 100755 --- a/tools/tests.systemd +++ b/tools/tests.systemd @@ -2,8 +2,8 @@ show_help() { echo "usage: tests.systemd create-and-start-unit " - echo " tests.systemd stop-and-remove-unit " - echo " tests.systemd wait-for-service " + echo " tests.systemd stop-unit [--remove] ..." + echo " tests.systemd wait-for-service [-n|--attempts retries] [--wait seconds] [--state STATE] " } # Create and start a persistent systemd unit that survives reboots. Use as: @@ -25,15 +25,14 @@ create_and_start_unit() { return 1 fi if [ -f "/etc/systemd/system/$name.service" ]; then - echo "tests.systemd: unit service file already exist" - return 1 + echo "tests.systemd: unit service file already exist, it is going to be overwritten" fi printf '[Unit]\nDescription=Support for test %s\n[Service]\nType=simple\nExecStart=%s\n[Install]\nWantedBy=multi-user.target\n' "$name" "$start_line" > "/etc/systemd/system/$name.service" if [ -n "$override" ]; then mkdir -p "/etc/systemd/system/$name.service.d" # shellcheck disable=SC2059 - printf "$override" >> "/etc/systemd/system/$name.service.d/override.conf" + printf "$override" > "/etc/systemd/system/$name.service.d/override.conf" fi systemctl daemon-reload @@ -42,32 +41,96 @@ create_and_start_unit() { wait_for_service "$name" } -stop_and_remove_unit() { - local name=$1 +_stop_unit() { + local unit=$1 + + if systemctl is-active "$unit"; then + retries=20 + while systemctl status "$unit" | grep -q "Active: activating"; do + if [ $retries -eq 0 ]; then + echo "tests.systemd: unit $unit could not be stopped" + systemctl status "$unit" + exit 1 + fi + retries=$(( retries - 1 )) + sleep 1 + done + + systemctl stop "$unit" + fi +} - if [ -z "$name" ]; then - echo "tests.systemd: unit name cannot be empty" +stop_unit() { + local remove=false + while [ $# -gt 0 ]; do + case "$1" in + --remove) + remove=true + shift + ;; + *) + break + ;; + esac + done + + if [ $# -eq 0 ]; then + echo "tests.systemd: at least a unit name is required" return 1 fi - systemctl stop "$name" || true - systemctl disable "$name" || true + for unit in "$@"; do + _stop_unit "$unit" + if [ "$remove" = true ]; then + if systemctl is-enabled "$unit"; then + systemctl disable "$unit" + fi + rm -f "/etc/systemd/system/$unit.service" + rm -rf "/etc/systemd/system/$unit.service.d" + fi + done - rm -f "/etc/systemd/system/$name.service" - rm -rf "/etc/systemd/system/$name.service.d" systemctl daemon-reload } wait_for_service() { - local service_name="$1" - local state="${2:-active}" + if [ $# -eq 0 ]; then + show_help + exit 0 + fi + + local attempts=300 + local wait=1 + local state="active" + local service_name + + while [ $# -gt 0 ]; do + case "$1" in + --wait) + wait="$2" + shift 2 + ;; + -n|--attempts) + attempts="$2" + shift 2 + ;; + --state) + state="$2" + shift 2 + ;; + *) + service_name=$1 + break + ;; + esac + done if [ -z "$service_name" ]; then echo "tests.systemd: unit name cannot be empty" return 1 fi - for i in $(seq 300); do + for i in $(seq "$attempts"); do if systemctl show -p ActiveState "$service_name" | grep -q "ActiveState=$state"; then return fi @@ -75,7 +138,7 @@ wait_for_service() { if [ "$i" -gt 0 ] && [ $(( i % 60 )) = 0 ]; then systemctl status "$service_name" || true fi - sleep 1 + sleep "$wait" done echo "tests.systemd: service $service_name did not become $state" diff --git a/utils/check-test-format b/utils/check-test-format index 74b28ee9a60..25c85212aa3 100755 --- a/utils/check-test-format +++ b/utils/check-test-format @@ -23,12 +23,13 @@ SUPPORTED_KEYS = [ "warn-timeout", "kill-timeout", "environment", + "artifacts", "prepare", "restore", "debug", "execute", ] -MANDATORY_KEYS = ["summary", "execute"] +MANDATORY_KEYS = ["summary", "details", "execute"] def check_mandatory_keys(task_keys): @@ -92,7 +93,6 @@ def check_task_format(filepath): return True - def check_dir(directory): if not os.path.isdir(directory): print("Format checks failed for directory {}".format(directory)) @@ -106,11 +106,27 @@ def check_dir(directory): return status +def check_tests(tests): + status = True + for test in tests: + if not os.path.isfile(test): + print("Format checks failed for test {}".format(test)) + print(" - The path is not a file") + status = False + continue + + if not check_task_format(test): + status = False + + return status def _make_parser(): parser = argparse.ArgumentParser() parser.add_argument( - "directory", help="path to the directory to check recursively" + "--dir", help="path to the directory to check recursively" + ) + parser.add_argument( + "--tests", help="list of tests path to check", nargs='+' ) return parser @@ -119,8 +135,16 @@ def main(): parser = _make_parser() args = parser.parse_args() - sys.exit(not check_dir(args.directory)) + status = 0 + if args.tests: + if not check_tests(args.tests): + status = 1 + + if args.dir: + if not check_dir(args.dir): + status = 1 + sys.exit(status) if __name__ == "__main__": main() diff --git a/utils/log-analyzer b/utils/log-analyzer index 42b6595704c..79ef43af227 100755 --- a/utils/log-analyzer +++ b/utils/log-analyzer @@ -208,9 +208,9 @@ list_reexecute_tasks() { echo "$exec_exp" return fi - # When all the tests were successful, then the execution expression is used to reexecute + + # When all the tests were successful, then no tests need to be reexecuted if [ "$(echo "$reexec_tasks" | wc -w)" = 0 ]; then - echo "$exec_exp" return fi echo "$reexec_tasks" @@ -258,7 +258,7 @@ list_executed_tasks() { local all_tasks executed_tasks all_tasks="$(list_all_tasks "$exec_exp")" - executed_tasks="$(jq -r '.[] | select( .type == "action") | select( .verb == "Executing") | .task' "$log")" + executed_tasks="$(jq -r '.[] | select( .type == "phase") | select( .verb == "Executing") | .task' "$log")" _intersection_tasks_lists "$executed_tasks" "$all_tasks" } diff --git a/utils/log-filter b/utils/log-filter new file mode 100755 index 00000000000..bb530ff6cf5 --- /dev/null +++ b/utils/log-filter @@ -0,0 +1,208 @@ +#!/usr/bin/env python3 + +import argparse +import io +import re +import sys +import typing + +import log_helper as helper + +# Rules are applied to filter content in the following operation details: +# ERROR: The error shoes the bash output when a task fails +# DEBUG: The debug includes the output of the debug script for task/suite errors +# WARNING: The last lines from the task execution output +# FAILED: Include a list of failed tests in the results section +SUPPORTED_RULES = [helper.Result.FAILED.value] + helper.ExecutionInfo.list() + + +def print_line(line: str) -> None: + if not line: + print() + else: + print(line.strip()) + + +def write_line(line: str, to_stream: typing.TextIO) -> None: + if not line: + print("\n", file=to_stream) + else: + print(line.strip(), file=to_stream, end="\n") + + +def compile_rules(rules: list[str], operation: str) -> list[re.Pattern[str]]: + patterns = [] + regex_list = [] + + for rule in rules: + parts = rule.split("=", 1) + if len(parts) != 2: + raise ValueError( + "Error: Rule '{}' does not follow the OPERATION=PATTERN format".format( + rule + ) + ) + + rule_operation = parts[0] + rule_pattern = parts[1] + + if rule_operation not in SUPPORTED_RULES: + raise ValueError( + "Error: Rule operation '{}' not in supported list: {}".format( + rule_operation, SUPPORTED_RULES + ) + ) + + if operation == rule_operation: + patterns.append(rule_pattern) + + for pattern in patterns: + regex_list.append(re.compile(pattern)) + return regex_list + + +def process_detail_line( + line: str, regex_list: list[re.Pattern[str]], to_stream: typing.TextIO +) -> None: + if not regex_list: + write_line(line, to_stream) + else: + for regex in regex_list: + matches = regex.findall(line) + for match in matches: + write_line(match, to_stream) + + +def process_detail( + from_stream: typing.TextIO, + start_line: str, + regex_list: list[re.Pattern[str]], + to_stream: typing.TextIO, +) -> str: + """Process lines from the start of the details section until the last line, + returns the first line right after the details section + """ + write_line(start_line, to_stream) + for line in sys.stdin: + print_line(line) + + if not line: + continue + + # Check if the detail is finished + if helper.is_detail_finished(line): + return line + + # Print all the lines + process_detail_line(line, regex_list, to_stream) + + return "" + + +def skip_detail(from_stream: typing.TextIO) -> str: + """Skip lines from the start of the details section until the last line, + returns the first line right after the details section + """ + for line in sys.stdin: + print_line(line) + if not line: + continue + + # Check if the detail is finished + if helper.is_detail_finished(line): + return line + + return "" + + +def process_spread_output( + output_file: str, exclude_lines: set[str], filter_rules: list[str] +) -> None: + error_regex = compile_rules(filter_rules, helper.ExecutionInfo.ERROR.value) + debug_regex = compile_rules(filter_rules, helper.ExecutionInfo.DEBUG.value) + failed_regex = compile_rules(filter_rules, helper.Result.FAILED.value) + warning_regex = compile_rules(filter_rules, helper.ExecutionInfo.WARNING.value) + + with open(output_file, "a") as myfile: + for line in sys.stdin: + print_line(line) + + while helper.is_detail_start(line): + regex_list = [] + if helper.is_operation(line, helper.ExecutionInfo.DEBUG): + if helper.ExecutionInfo.DEBUG.value in exclude_lines: + line = skip_detail(sys.stdin) + continue + else: + regex_list = debug_regex + + if helper.is_operation(line, helper.ExecutionInfo.ERROR): + if helper.ExecutionInfo.ERROR.value in exclude_lines: + line = skip_detail(sys.stdin) + continue + else: + regex_list = error_regex + + if helper.is_operation(line, helper.ExecutionInfo.WARNING): + if helper.ExecutionInfo.WARNING.value in exclude_lines: + line = skip_detail(sys.stdin) + continue + else: + regex_list = warning_regex + + if helper.is_operation(line, helper.Result.FAILED): + if helper.Result.FAILED.value in exclude_lines: + line = skip_detail(sys.stdin) + continue + else: + regex_list = failed_regex + + line = process_detail(sys.stdin, line, regex_list, myfile) + + if ( + not exclude_lines + or not helper.is_any_operation(line) + or not helper.get_operation(line) in exclude_lines + ): + write_line(line, myfile) + + +def _make_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + description=""" +This tool is used to save a filtered version of the spread output. It parses the spread output and filters +sections and debug/error details to the file passed as parameter (all the lines are printed). +When a output file is not provided the debug output is sent to spread_filtered.log +""" + ) + parser.add_argument( + "-o", + "--output-file", + metavar="PATH", + default="spread.filtered.log", + help="path to the filtered output file", + ) + parser.add_argument( + "-e", + "--exclude", + action="append", + default=[], + choices=helper.OPERATIONS, + help="A line section to exclude from the output", + ) + parser.add_argument( + "-f", + "--filter", + action="append", + metavar="OPERATION=PATTERN", + default=[], + help="It is used to extract specific data from errors. Allowed operations are Error, Debug, Failed and WARNING:", + ) + + return parser + + +if __name__ == "__main__": + parser = _make_parser() + args = parser.parse_args() + process_spread_output(args.output_file, args.exclude, args.filter) diff --git a/utils/log-parser b/utils/log-parser index 4d6cd5a11d2..c4494f5fe47 100755 --- a/utils/log-parser +++ b/utils/log-parser @@ -12,51 +12,17 @@ import os import re import sys -# Info types -ERROR_TYPE = 'Error' -DEBUG_TYPE = 'Debug' -WARN_TYPE = 'WARNING:' - -# Results -FAILED_TYPE = 'Failed' -ABORTED_TYPE = 'Aborted' -SUCCESSFUL_TYPE = 'Successful' - -# Printable names -ALL = 'all' -NONE = 'none' -ACTION = 'action' -OPERATION = 'operation' -INFO = 'info' -ERROR = 'error' -ERROR_DEBUG = 'error-debug' -FAILED = 'failed' -ABORTED = 'aborted' -SUCCESSFUL = 'successful' - -RESULT = 'result' -START = 'Found' -SPREAD_FILE = 'spread.yaml' - -EXEC_VERBS = ['Preparing', 'Executing', 'Restoring'] -INFO_TYPES = [ERROR_TYPE, DEBUG_TYPE, WARN_TYPE] -OPERATIONS = [ - 'Rebooting', 'Discarding', 'Allocating', 'Waiting', - 'Allocated', 'Connecting', 'Connected', 'Sending' - ] -RESULTS = ['Successful', 'Aborted', 'Failed'] -FAILED_LEVELS = ['task', 'suite', 'project'] -FAILED_STAGES = ['prepare', 'restore'] +import log_helper as helper -class Action: +class Phase: """ - Action represents the main spread tasks actions - The actions can be: Preparing, Executing and Restoring + Phase represents the task/suite/project action in terms of: + Preparing, Executing and Restoring """ def __init__(self, verb, task, date, time, source_line): - self.type = ACTION + self.type = "phase" self.verb = verb self.time = time self.date = date @@ -66,14 +32,14 @@ class Action: def __repr__(self): return self.source_line - def __dict__(self): + def to_dict(self): return { - 'type': 'action', - 'date': self.date, - 'time': self.time, - 'verb': self.verb, - 'task': self.task - } + "type": self.type, + "date": self.date, + "time": self.time, + "verb": self.verb, + "task": self.task, + } class Result: @@ -82,9 +48,10 @@ class Result: The results can be: Successful, failed and aborted """ - def __init__(self, result_type, level, stage, number, date, time, - detail, source_line): - self.type = RESULT + def __init__( + self, result_type, level, stage, number, date, time, detail, source_line + ): + self.type = "result" self.result_type = result_type self.level = level self.stage = stage @@ -96,34 +63,33 @@ class Result: def __repr__(self): if self.detail: - return '{}{}'.format(self.source_line, str(self.detail)) + return "{}{}".format(self.source_line, str(self.detail)) return self.source_line - def __dict__(self): + def to_dict(self): prepared_detail = None if self.detail: - prepared_detail = self.detail.__dict__() + prepared_detail = self.detail.to_dict() return { - 'type': self.type, - 'date': self.date, - 'time': self.time, - 'result_type': self.result_type, - 'level': self.level, - 'stage': self.stage, - 'number': self.number, - 'detail': prepared_detail - } + "type": self.type, + "date": self.date, + "time": self.time, + "result_type": self.result_type, + "level": self.level, + "stage": self.stage, + "number": self.number, + "detail": prepared_detail, + } class Info: """ - Info represents the extra tasks information which is included in the - spread log. The info can be: Error, Debug and Warning + Info represents the tasks status information which is included + in the spread log. The info can be: Error, Debug and Warning. """ - def __init__(self, info_type, verb, task, extra, date, time, - detail, source_line): - self.type = INFO + def __init__(self, info_type, verb, task, extra, date, time, detail, source_line): + self.type = "info" self.info_type = info_type self.verb = verb self.time = time @@ -135,23 +101,57 @@ class Info: def __repr__(self): if self.detail: - return '{}{}'.format(self.source_line, self.detail) + return "{}{}".format(self.source_line, self.detail) return self.source_line - def __dict__(self): + def to_dict(self): prepared_detail = None if self.detail: - prepared_detail = self.detail.__dict__() + prepared_detail = self.detail.to_dict() return { - 'type': self.type, - 'date': self.date, - 'time': self.time, - 'info_type': self.info_type, - 'verb': self.verb, - 'task': self.task, - 'extra': self.extra, - 'detail': prepared_detail - } + "type": self.type, + "date": self.date, + "time": self.time, + "info_type": self.info_type, + "verb": self.verb, + "task": self.task, + "extra": self.extra, + "detail": prepared_detail, + } + + +class Rule: + """ + Rule represent the KEY=PATTERN used to extract information from a set of lines + """ + + def __init__(self, rule): + parts = rule.split("=", 1) + if len(parts) != 2: + raise ValueError( + "Error: Rule '{}' does not follow the KEY=PATTERN format".format(rule) + ) + + self.key = parts[0] + self.pattern = parts[1] + + try: + re.compile(self.pattern) + except re.error as err: + raise ValueError( + "Error: pattern '{}' cannot be compiled: {}".format(self.pattern, err) + ) + + def filter(self, lines) -> list[str]: + regex = re.compile(self.pattern) + all_matches = [] + for line in lines: + matches = regex.findall(line) + for match in matches: + if match: + all_matches.append(match) + + return all_matches class Detail: @@ -159,34 +159,48 @@ class Detail: Detail represents the extra lines which are displayed after the info """ - def __init__(self, lines_limit, lines): + def __init__(self, lines_limit: int, lines: list[str], rules: list[str]) -> None: self.lines_limit = lines_limit self.lines = lines + self.data = dict[str, list[str]]() + self._process_rules(rules) - def _get_lines(self): + def _get_lines(self) -> list[str]: if self.lines_limit < 0 or self.lines_limit > len(self.lines): return self.lines # Use self.lines_limit-1 because the last line is a '.' and we don't # want to count it as a line in the log details - return self.lines[-self.lines_limit-1:] + return self.lines[-self.lines_limit - 1 :] + + def _process_rules(self, rules) -> None: + for rule in rules: + key = rule.key + matches = rule.filter(self.lines) + self.data[key] = matches def __repr__(self): - return ''.join(self._get_lines()) + return "".join(self._get_lines()) + + def to_dict(self) -> dict[str, list[str]]: + details_dict = {"lines": self.lines[-self.lines_limit - 1 :]} + for key in self.data.keys(): + details_dict[key] = self.data[key] - def __dict__(self): - return {'lines': self.lines[-self.lines_limit-1:]} + return details_dict -class Operation: +class Action: """ - Operation represents other actions that the spread running can do while + The actions are general operations that the spread can do while executing tests like: Rebooting, Discarding, Allocating, Waiting, Allocated, Connecting, Connected, Sending """ - def __init__(self, verb, task, extra, date, time, source_line): - self.type = OPERATION + def __init__( + self, verb: str, task: str, extra: str, date: str, time: str, source_line: str + ) -> None: + self.type = "action" self.verb = verb self.time = time self.extra = extra @@ -197,113 +211,90 @@ class Operation: def __repr__(self): return self.source_line - def __dict__(self): + def to_dict(self) -> dict[str, str]: return { - 'type': self.type, - 'date': self.date, - 'time': self.time, - 'verb': self.verb, - 'task': self.task, - 'extra': self.extra - } + "type": self.type, + "date": self.date, + "time": self.time, + "verb": self.verb, + "task": self.task, + "extra": self.extra, + } class LogReader: """ LogReader manages the spread log, it allows to read, export and print """ - def __init__(self, filepath, output_type, lines_limit, store_setup): + + def __init__( + self, + filepath: str, + output_type: str, + lines_limit: str, + error_rules: str, + debug_rules: str, + ) -> None: self.filepath = filepath self.output_type = output_type self.lines_limit = lines_limit - self.store_setup = store_setup - self.lines = [] + self.lines = list[str]() self.iter = 0 - self.full_log = [] + self.full_log = list[str]() + self.error_rules = [Rule(rule) for rule in error_rules] + self.debug_rules = [Rule(rule) for rule in debug_rules] def __repr__(self): - return str(self.__dict__()) + return str(self.to_dict()) - def __dict__(self): - return {'full_log': self.full_log} + def to_dict(self) -> dict: + return {"full_log": self.full_log} - def print_log(self, details, results): + def print_log(self) -> None: if not self.full_log: return - # Print the details - if details == ALL: - print(''.join(str(x) for x in self.full_log)) - elif details == NONE: - pass - elif details == ERROR: - print(''.join(str(x) for x in self.full_log if x.type == INFO and - x.info_type == ERROR_TYPE)) - elif details == ERROR_DEBUG: - print(''.join(str(x) for x in self.full_log if x.type == INFO and - (x.info_type == ERROR_TYPE or x.info_type == DEBUG_TYPE))) - else: - print(''.join(str(x) for x in self.full_log if x.type == details)) - - # Print the results - if results == ALL: - print(''.join(str(x) for x in self.full_log if x.type == RESULT)) - elif results == NONE: - pass - elif results == FAILED: - print(''.join(str(x) for x in self.full_log if x.type == RESULT and - x.result_type == FAILED_TYPE)) - elif results == ABORTED: - print(''.join(str(x) for x in self.full_log if x.type == RESULT and - x.result_type == ABORTED_TYPE)) - else: - print(''.join(str(x) for x in self.full_log if x.type == RESULT and - x.result_type == SUCCESSFUL_TYPE)) + print("".join(str(x) for x in self.full_log)) - def export_log(self, filepath): + def export_log(self, filepath: str) -> None: prepared_log = [] for item in self.full_log: if isinstance(item, str): prepared_log.append(item) else: - prepared_log.append(item.__dict__()) - with open(filepath, 'w') as json_file: + prepared_log.append(item.to_dict()) + with open(filepath, "w") as json_file: json.dump(prepared_log, json_file, indent=4) - def _next_line(self): + def _next_line(self) -> str: self.iter = self.iter + 1 - return self.lines[self.iter-1] + return self.lines[self.iter - 1] - def check_log_exists(self): + def check_log_exists(self) -> bool: return os.path.exists(self.filepath) - def read_spread_log(self): - with open(self.filepath) as filepath: - self.lines = filepath.readlines() + def read_spread_log(self) -> None: + try: + with open(self.filepath, "r", encoding="utf-8") as filepath: + self.lines = filepath.readlines() + except UnicodeDecodeError: + with open(self.filepath, "r", encoding="latin-1") as filepath: + self.lines = filepath.readlines() - # Find the start of the log, the log file could include - # initial lines which are not part of the spread log itself self.iter = 0 - if self.store_setup: - while self.iter < len(self.lines): - line = self._next_line() - if self._match_start(line): - break - self.full_log.append(line) - - if self.iter >= len(self.lines): - # Start not found, the log is either empty, corrupted or cut - self.iter = 0 # Then iterate line by line analyzing the log while self.iter < len(self.lines): line = self._next_line() + if not helper.is_any_operation(line): + continue + # The line is a task execution; preparing, executing, restoring - if self._match_task(line): - action = self._get_action(line) - if action: - self.full_log.append(action) + if self._match_phase(line): + phase = self._get_phase(line) + if phase: + self.full_log.append(phase) continue # The line shows info: error, debug, warning @@ -315,10 +306,10 @@ class LogReader: # The line is another operation: Rebooting, Discarding, Allocating # Waiting, Allocated, Connecting, Connected, Sending' - if self._match_operation(line): - operation = self._get_operation(line) - if operation: - self.full_log.append(operation) + if self._match_action(line): + action = self._get_action(line) + if action: + self.full_log.append(action) continue # The line is a result: Successful, Aborted, Failed @@ -328,178 +319,127 @@ class LogReader: self.full_log.append(result) continue - def _match_date(self, date): - return re.findall(r'\d{4}-\d{2}-\d{2}', date) - - def _match_time(self, time): - return re.findall(r'\d{2}:\d{2}:\d{2}', time) - - def _match_info(self, line): - parts = line.strip().split(' ') - return len(parts) > 3 and \ - parts[2] in INFO_TYPES and \ - self._match_date(parts[0]) and \ - self._match_time(parts[1]) - - def _match_task(self, line): - parts = line.strip().split(' ') - return len(parts) > 2 and \ - parts[2] in EXEC_VERBS and \ - self._match_date(parts[0]) and \ - self._match_time(parts[1]) - - def _match_start(self, line): - parts = line.strip().split(' ') - return len(parts) > 2 and \ - parts[2] == START and \ - self._match_date(parts[0]) and \ - self._match_time(parts[1]) and \ - SPREAD_FILE in parts[3] - - def _match_operation(self, line): - parts = line.strip().split(' ') - return len(parts) > 2 and \ - parts[2] in OPERATIONS and \ - self._match_date(parts[0]) and \ - self._match_time(parts[1]) - - def _match_result(self, line): - parts = line.strip().split(' ') - return len(parts) > 2 and \ - parts[2] in RESULTS and \ - self._match_date(parts[0]) and \ - self._match_time(parts[1]) - - def _get_detail(self, results=False, other_limit=None): + def _match_info(self, line: str) -> bool: + return helper.get_operation(line) in helper.ExecutionInfo.list() + + def _match_phase(self, line: str) -> bool: + return helper.get_operation(line) in helper.ExecutionPhase.list() + + def _match_action(self, line: str) -> bool: + return ( + helper.get_operation(line) + in helper.GeneralAction.list() + helper.GeneralActionStatus.list() + ) + + def _match_result(self, line: str) -> bool: + return helper.get_operation(line) in helper.Result.list() + + def _get_detail(self, rules, results=False, other_limit=None): """ This function is used to get the piece of log which is after the info lines (error, debug, warning). The detail could also include a limit of lines to tail the log and show the last lines. It returns a Detail object included all the lines. """ - - # If the first line matches with a regular line, this means the detail - # has no output and has to be discarded - line = self.lines[self.iter] - if self._match_task(line) or self._match_info(line) or \ - self._match_operation(line) or self._match_result(line): - return None - - detail=[] - initial_iter = self.iter + detail = [] while self.iter < len(self.lines): + previous_line = self.lines[self.iter - 1] line = self._next_line() - if self._match_task(line) or self._match_info(line) or \ - self._match_operation(line) or self._match_result(line): - # When the details is for results, then any match is ok to break - if results: - break - # When the details is no for results, then we need to check also - # the the last time was just a '.' - # The details for info (Error, Debug and Warning) always finish with - # ---- - # . - # - # As the iter is already pointing to the next line since 'line = self._next_line()' - # to access the previous line of the current one it is needed to do 'self.iter-2' - elif self.lines[self.iter-2].strip() == '.': + if helper.is_detail_finished(line): + # This is needed because it could happen that in the details there is a spread log + # because sometimes we run nested spread + # The is not valid when the details are for failed tests in results section + if results or previous_line.strip() == ".": break - detail.append(line) + detail.append(line) - # When the details is for results, if the detail line does not start - # with " - ", then it is time to break - if results and not line.startswith(" - "): - break - else: - detail.append(line) - - # We leave the iter in the last time in case the log has finished + # We leave the iter in the last line in case the log has finished if not self.iter == len(self.lines): self.iter = self.iter - 1 if not other_limit: other_limit = self.lines_limit - return Detail(other_limit, detail) + return Detail(other_limit, detail, rules) def _get_info(self, line): """ Get the Info object for the error, debug and warning lines including the details for this """ - parts = line.strip().split(' ') - if len(parts) < 3: - return None - date = parts[0] - time = parts[1] - info_type = parts[2] + date = helper.get_date(line) + time = helper.get_time(line) + info_type = helper.get_operation(line) + info_extra = helper.get_operation_info(line) verb = None task = None - if info_type == WARN_TYPE: - info_type = info_type.split(':')[0] + if info_type == helper.ExecutionInfo.WARNING.value: + # Removing the : from WARNING: + info_type = info_type.split(":")[0] verb = None task = None - extra = ' '.join(parts[3:]) - elif info_type == ERROR_TYPE: - verb = parts[3] - task = parts[4] + extra = info_extra + elif info_type == helper.ExecutionInfo.ERROR.value: + verb = info_extra.split(" ")[0] + task = info_extra.split(" ")[1] extra = None - elif info_type == DEBUG_TYPE: + elif info_type == helper.ExecutionInfo.DEBUG.value: verb = None - task = parts[5] + task = info_extra.split(" ")[2] extra = None else: - print('log-parser: detail type not recognized: {}'.format(info_type)) + print("log-parser: detail type not recognized: {}".format(info_type)) + return + + # Pass the rules according to the info type + rules = self.debug_rules + if info_type == helper.ExecutionInfo.ERROR.value: + rules = self.error_rules + + detail = None + if helper.is_detail(line): + detail = self._get_detail(rules) - detail = self._get_detail(results=False) return Info(info_type, verb, task, extra, date, time, detail, line) def _get_result(self, line): - """ Get the Result object including the details for the result """ - parts = line.strip().split(' ') - if len(parts) < 3: - return None - date = parts[0] - time = parts[1] - result_type = parts[2] - level = parts[3].split(':')[0] - number = parts[-1] + """Get the Result object including the details for the result""" + date = helper.get_date(line) + time = helper.get_time(line) + result_type = helper.get_operation(line) + result_extra = helper.get_operation_info(line) + level = result_extra.split(" ")[0].split(":")[0] + number = result_extra.split(" ")[-1] stage = None detail = None - if result_type == FAILED_TYPE: - if level in FAILED_LEVELS: - stage = parts[4].split(':')[0] - detail = self._get_detail(results=True, other_limit=-1) + if result_type == helper.Result.FAILED.value: + if level in helper.ExecutionLevel.list(): + stage = result_extra.split(" ")[1].split(":")[0] + detail = self._get_detail([], results=True, other_limit=-1) - return Result(result_type, level, stage, number.strip(), date, time, detail, - line) + return Result(result_type, level, stage, number, date, time, detail, line) - def _get_action(self, line): + def _get_phase(self, line): """ - Get the Action object for lines preparing, executing and restoring + Get the phase object for lines preparing, executing and restoring """ - parts = line.strip().split(' ') - if len(parts) < 3: - return None - date = parts[0] - time = parts[1] - verb = parts[2] - task = parts[3] - return Action(verb, task.split('...')[0], date, time, line) - - def _get_operation(self, line): - """ Get the Operation object for lines rebooting, allocating, etc """ - parts = line.strip().split(' ') - if len(parts) < 3: - return None - date = parts[0] - time = parts[1] - verb = parts[2] + date = helper.get_date(line) + time = helper.get_time(line) + verb = helper.get_operation(line) + task = helper.get_operation_info(line).split(" ")[0] + return Phase(verb, task.split("...")[0], date, time, line) + + def _get_action(self, line): + """Get the general actions object for lines rebooting, allocating, etc""" + + date = helper.get_date(line) + time = helper.get_time(line) + verb = helper.get_operation(line) task = None - extra = ' '.join(parts[3:]) - return Operation(verb, task, extra, date, time, line) + extra = helper.get_operation_info(line) + return Action(verb, task, extra, date, time, line) def _make_parser(): @@ -523,25 +463,9 @@ for the error/debug/warning output. "--format", type=str, default="json", - choices=['json'], + choices=["json"], help="format for the output", ) - parser.add_argument( - "-pd", - "--print-details", - type=str, - default=NONE, - choices=[ALL, ERROR, ERROR_DEBUG, OPERATION, ACTION, INFO, NONE], - help="Filter which info to print", - ) - parser.add_argument( - "-pr", - "--print-results", - type=str, - default=NONE, - choices=[ALL, FAILED, ABORTED, SUCCESSFUL, NONE], - help="Filter which results to print", - ) parser.add_argument( "-o", "--output", @@ -550,12 +474,21 @@ for the error/debug/warning output. help="output file to save the result", ) parser.add_argument( - "--store-setup", - action="store_true", - help="will save all the text before the spread run is started", + "-er", + "--error-rule", + action="append", + default=[], + help="A KEY=PATTERN used to extract and store specific data from errors", ) parser.add_argument( - "logpath", metavar="PATH", help="path to the log to be analyzed" + "-dr", + "--debug-rule", + action="append", + default=[], + help="A KEY=PATTERN used to extract and store specific data from debug output", + ) + parser.add_argument( + "log_path", metavar="PATH", help="path to the log to be analyzed" ) return parser @@ -565,11 +498,17 @@ def main(): parser = _make_parser() args = parser.parse_args() - if len(args.logpath) == 0: + if len(args.log_path) == 0: parser.print_usage() parser.exit(0) - reader = LogReader(args.logpath, args.format, args.cut, args.store_setup) + reader = LogReader( + args.log_path, + args.format, + args.cut, + args.error_rule, + args.debug_rule, + ) if not reader.check_log_exists(): print("log-parser: log not found") sys.exit(1) @@ -579,7 +518,7 @@ def main(): if args.output: reader.export_log(args.output) - reader.print_log(args.print_details, args.print_results) + reader.print_log() if __name__ == "__main__": diff --git a/utils/log_helper.py b/utils/log_helper.py new file mode 100644 index 00000000000..18de5030386 --- /dev/null +++ b/utils/log_helper.py @@ -0,0 +1,193 @@ +""" +This library provides a set of functions that can be used to +process the spread output. +""" + +import re + +from enum import Enum + + +class ListedEnum(Enum): + @classmethod + def list(cls) -> list[str]: + return list(map(lambda c: c.value, cls)) + +class ExecutionPhase(ListedEnum): + PREPARING = "Preparing" + EXECUTING = "Executing" + RESTORING = "Restoring" + + +class ExecutionInfo(ListedEnum): + DEBUG = "Debug" + ERROR = "Error" + WARNING = "WARNING:" + + +class ExecutionLevel(ListedEnum): + TASK = "task" + SUITE = "suite" + PROJECT = "project" + + +class GeneralAction(ListedEnum): + REBOOTING = "Rebooting" + DISCARDING = "Discarding" + ALLOCATING = "Allocating" + WAITING = "Waiting" + CONNECTING = "Connecting" + SENDING = "Sending" + + +class GeneralActionStatus(ListedEnum): + ALLOCATED = "Allocated" + CONNECTED = "Connected" + + +class Result(ListedEnum): + FAILED = "Failed" + SUCCESSFUL = "Successful" + ABORTED = "Aborted" + + +OPERATIONS = ( + ExecutionPhase.list() + + GeneralAction.list() + + GeneralActionStatus.list() + + ExecutionInfo.list() + + Result.list() +) + + +# Start line +START_LINE = ".*Project content is packed for delivery.*" + + +def _match_date(date: str) -> bool: + return re.match(r"\d{4}-\d{2}-\d{2}", date) is not None + + +def _match_time(time: str) -> bool: + return re.match(r"\d{2}:\d{2}:\d{2}", time) is not None + + +def is_initial_line(line: str) -> bool: + if not line: + return False + + pattern = re.compile(START_LINE) + parts = line.strip().split(" ") + return ( + len(parts) > 2 + and _match_date(parts[0]) + and _match_time(parts[1]) + and re.match(pattern, line) is not None + ) + + +# Debug line starts with the operation +def is_operation(line: str, operation: Enum) -> bool: + if not line: + return False + + parts = line.strip().split(" ") + return ( + len(parts) > 2 + and _match_date(parts[0]) + and _match_time(parts[1]) + and parts[2] == operation.value + ) + + +# Check if the line contains any operation +def is_any_operation(line: str) -> bool: + if not line: + return False + + parts = line.strip().split(" ") + return ( + len(parts) > 2 + and _match_date(parts[0]) + and _match_time(parts[1]) + and parts[2] in OPERATIONS + ) + + +# Return the date in the line +def get_date(line: str) -> str: + if not line: + raise RuntimeError("Empty line provided") + + parts = line.strip().split(" ") + if len(parts) <= 2 or not _match_date(parts[0]): + raise ValueError("Incorrect format for line provided: {}".format(line)) + + return parts[0] + + +# Return the time in the line +def get_time(line: str) -> str: + if not line: + raise RuntimeError("Empty line provided") + + parts = line.strip().split(" ") + if len(parts) <= 2 or not _match_date(parts[0]) or not _match_time(parts[1]): + raise ValueError("Incorrect format for line provided: {}".format(line)) + + return parts[1] + + +# Return the operation in the line +def get_operation(line: str) -> str: + if not line: + raise RuntimeError("Empty line provided") + + parts = line.strip().split(" ") + if len(parts) <= 2 or not _match_date(parts[0]) or not _match_time(parts[1]): + raise ValueError("Incorrect format for line provided: {}".format(line)) + + return parts[2] + + +# Return the information that comes after the operation +def get_operation_info(line: str) -> str: + if not line: + raise RuntimeError("Empty line provided") + + parts = line.strip().split(" ") + if len(parts) <= 3 or not _match_date(parts[0]) or not _match_time(parts[1]): + raise ValueError("Incorrect format for line provided: {}".format(line)) + + return " ".join(parts[3:]) + + +# Details are displayed after Error/Debug/Failed/Warning operations +def is_detail_start(line: str) -> bool: + return ( + is_operation(line, ExecutionInfo.DEBUG) + or is_operation(line, ExecutionInfo.ERROR) + or is_operation(line, ExecutionInfo.WARNING) + or is_operation(line, Result.FAILED) + ) + + +# Error/Debug/Failed output sometimes finish with either EOF error or a log file +# and no detail displayed +def is_detail(line: str) -> bool: + return ( + is_operation(line, ExecutionInfo.DEBUG) + or is_operation(line, ExecutionInfo.ERROR) + or is_operation(line, ExecutionInfo.WARNING) + ) and line.strip()[-1:] == ":" + + +# Error/Debug/Failed output finishes when a new other line starts +def is_detail_finished(line: str) -> bool: + parts = line.strip().split(" ") + return ( + len(parts) > 3 + and _match_date(parts[0]) + and _match_time(parts[1]) + and parts[2] in OPERATIONS + ) diff --git a/utils/spread-filter b/utils/spread-filter new file mode 100755 index 00000000000..0e49ac40468 --- /dev/null +++ b/utils/spread-filter @@ -0,0 +1,220 @@ +#!/usr/bin/env python3 + +import argparse +import os +import re +import sys +import yaml + + +class ExecutionRule: + def __init__(self, from_list: list[str], to: list[str]): + self.regex_list = [] + self.to = to + for regex in from_list: + self.regex_list.append(re.compile(regex)) + + def match(self, path: str) -> list[str]: + for regex in self.regex_list: + if regex.match(path): + return self.to + + return [] + + +class ExecutionRules: + def __init__(self, rules: list[ExecutionRule]): + self.rules = [] + self.rules = rules + + def calc_executions(self, change: str) -> list[str]: + for rule in self.rules: + match = rule.match(change) + if match != []: + return match + + return [] + + +class ExecutionManager: + + TASK = "task.yaml" + SELF = "$SELF" + NONE = "$NONE" + + def __init__(self, rules_file: str, prefix: str, verbose: bool): + self.verbose = verbose + self.prefix = prefix + with open(rules_file) as f: + rules_map = yaml.safe_load(f) + self.rules = ExecutionRules(self.from_rules_map(rules_map)) + + @classmethod + def from_rules_map( + cls, rules_map: dict[str, dict[str, dict[str, list[str]]]] + ) -> list[ExecutionRule]: + return [ + ExecutionRule(r.get("from", []), r.get("to", [])) + for r in rules_map["rules"].values() + ] + + def _is_test_dir(self, change_dir: str) -> bool: + return os.path.isfile(os.path.join(change_dir, self.TASK)) + + def _is_task_file(self, change_path: str) -> bool: + return os.path.isfile(change_path) and change_path.endswith("task.yaml") + + def _get_test_exec_dir(self, change_dir: str) -> str: + test_dir = change_dir + if change_dir.endswith("/") and self._is_test_dir(change_dir): + test_dir = change_dir[:-1] + return test_dir + + def _get_execution_param(self, exec_paths: list[str]) -> list[str]: + all_params = [] + for exec_path in exec_paths: + all_params.append(self.prefix + ":" + exec_path) + return all_params + + def _calc_self(self, change_path: str) -> str: + if self.verbose: + print("calculating self for {}".format(change_path)) + + # If the change is a directory which has changed + if os.path.isdir(change_path): + if self._is_test_dir(change_path): + return self._get_test_exec_dir(change_path) + else: + test_dir = self._get_parent_with_task(change_path) + return self._get_test_exec_dir(test_dir) + # If the change is a file which has changed + elif os.path.isfile(change_path): + # If the change is a task.yaml + if self._is_task_file(change_path): + return self._get_test_exec_dir(os.path.dirname(change_path)) + + # If the change is a file in the same dir than a task.yaml + change_dir = os.path.dirname(change_path) + if self._is_test_dir(change_dir): + return self._get_test_exec_dir(change_dir) + # If the change is a file which is not in the same dir than a task.yaml + else: + test_dir = self._get_parent_with_task(change_path) + return self._get_test_exec_dir(test_dir) + # If the change is deleted file/dir + else: + # If a task.yaml has been deleted + if self._is_task_file(change_path): + return "" + else: + test_dir = self._get_parent_with_task(change_path) + return test_dir + + def _get_parent_with_task(self, change_path: str) -> str: + if self.verbose: + print("calculating parent with task {}".format(change_path)) + parent_path = os.path.dirname(change_path) + while parent_path != "": + if os.path.isfile(os.path.join(parent_path, self.TASK)): + return parent_path + parent_path = os.path.dirname(parent_path) + return "" + + def _clean_executions(self, executions: list[str]) -> list[str]: + if self.verbose: + print("cleaning executions for {}".format(executions)) + + final_executions = [] + # Get the execution paths ordered starting from the longest one + sorted_executions = sorted(executions, key=len, reverse=True) + for i in range(len(sorted_executions)): + discard_execution = False + long_execution = sorted_executions[i] + if self.verbose: + print(" checking repeated executions for {}".format(long_execution)) + + for j in range(i + 1, len(sorted_executions)): + short_execution = sorted_executions[j] + if self.verbose: + print( + " comparing repeated executions for {}".format( + short_execution + ) + ) + + # If the shorter executions is a test, we continue + if not short_execution.endswith("/"): + if long_execution == short_execution: + discard_execution = True + break + # If the shorter execution is a either suite or group of suites + else: + # If the long executions starts with short execution means + # the long execution is included in the short one and it can + # be discarded + if long_execution.startswith(short_execution): + discard_execution = True + break + + # Take decision after all shorter executions have been compared + if not discard_execution: + final_executions.append(long_execution) + + return final_executions + + # Retrieves the list of tests to execute + def get_executions(self, changes: list[str]) -> list[str]: + all_executions = [] + for change in changes: + executions = self.rules.calc_executions(change) + # When the tests to run as tagged as SELF means the current test + # has to be executed + for execution in executions: + if execution == self.SELF: + self_execution = self._calc_self(change) + if self_execution != "": + all_executions.append(self_execution) + # When the tests to run are tagged as NONE means that no tests + # have to be executed + elif execution == self.NONE: + continue + # Otherwise, what is defined in to (literal) is executed. + else: + all_executions.append(self._get_test_exec_dir(execution)) + + cleaned_executions = self._clean_executions(all_executions) + return self._get_execution_param(cleaned_executions) + + +def _make_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser(description="spread filter helper") + parser.add_argument("-r", "--rules-file", required=True, help="Rules file") + parser.add_argument( + "-p", + "--prefix", + required=True, + help="Backend and system (BACKEND:SYSTEM) used as prefix in the output", + ) + parser.add_argument( + "-c", "--change", action="append", default=[], help="File that changed" + ) + parser.add_argument("-v", "--verbose", action="store_true", help="Be more verbose") + + return parser + + +if __name__ == "__main__": + parser = _make_parser() + args = parser.parse_args() + + if not args.change: + print("spread-filter: no file changes set") + sys.exit(1) + + if not os.path.isfile(args.rules_file): + print("spread-filter: rules file '{}' does not exist".format(args.rules_file)) + sys.exit(1) + + execution_manager = ExecutionManager(args.rules_file, args.prefix, args.verbose) + execution_list = execution_manager.get_executions(args.change) + print(" ".join(map(str, execution_list))) diff --git a/utils/spread-shellcheck b/utils/spread-shellcheck index 8bef747d1c7..4769a7dc5da 100755 --- a/utils/spread-shellcheck +++ b/utils/spread-shellcheck @@ -20,6 +20,7 @@ import hashlib import itertools import logging import os +import re import subprocess import yaml @@ -119,21 +120,34 @@ def checksection(data, env: Dict[str, str]): for key, value in env.items(): value = str(value) - # Unpack the special "$(HOST: ...) syntax and tell shellcheck not to - # worry about the use of echo to print variable value. - if value.startswith("$(HOST:") and value.endswith(")"): - script_data.append("# shellcheck disable=SC2116") - value = "$({})".format(value[len("$(HOST:"):-1]) - # XXX: poor man's shell key=value assignment with values in double - # quotes so that one value can refer to another value. - if '"' in value: - value = value.replace('"', '\"') + disabled_warnings = set() + export_disabled_warnings = set() + def replacement(match): + if match.group(0) == '"': + # SC2089 and SC2090 are about quotes vs arrays + # We cannot have arrays in environment variables of spread + # So we do have to use quotes + disabled_warnings.add('SC2089') + export_disabled_warnings.add('SC2090') + return r'\"' + else: + assert(match.group('command') is not None) + # "Useless" echo. This is what we get. + # We cannot just evaluate to please shellcheck. + disabled_warnings.add('SC2116') + return '$({})'.format(match.group('command')) + value = re.sub(r'[$][(]HOST:(?P.*)[)]|"', replacement, value) # converts # FOO: "$(HOST: echo $foo)" -> FOO="$(echo $foo)" - # FOO: "$(HOST: echo \"$foo\")" -> FOO="$(echo \"$foo\")" + # FOO: "$(HOST: echo \"$foo\")" -> FOO="$(echo "$foo")" # FOO: "foo" -> FOO="foo" + # FOO: "\"foo\"" -> FOO="\"foo\"" + if disabled_warnings: + script_data.append("# shellcheck disable={}".format(','.join(disabled_warnings))) script_data.append("{}=\"{}\"".format(key, value)) - script_data.append("export {}".format(key)) + if export_disabled_warnings: + script_data.append("# shellcheck disable={}".format(','.join(export_disabled_warnings))) + script_data.append("export {}".format(key, value)) script_data.append(data) proc = subprocess.Popen("shellcheck -s {} -x -".format(SHELLCHECK_SHELL), stdout=subprocess.PIPE, diff --git a/utils/spreadJ b/utils/spreadJ new file mode 100755 index 00000000000..26f6b4ae663 --- /dev/null +++ b/utils/spreadJ @@ -0,0 +1,119 @@ +#!/bin/bash + +show_help() { + echo "usage: spreadJ rerun [--suite SUITE] " + echo " spreadJ show [--suite SUITE] " + echo " spreadJ stats [--suite SUITE] " + echo " spreadJ list [--suite SUITE] " + echo "" + echo "Available options:" + echo " -h --help show this help message." + echo "" + echo "TARGET:" + echo " all,failed,passed,aborted" + echo "" + echo "Tool used to help with functions that are not already implemented in spread" +} + +_filter_suite() { + local suite="$1" + if [ -z "$suite" ]; then + echo ".testsuites[]" + else + echo ".testsuites[] | select(.name == \"$suite\")" + fi +} + +rerun() { + local suite="" + if [ "$1" == "--suite" ]; then + suite="$2" + shift 2 + fi + local res_path="$1" + if [ ! -e "$res_path" ]; then + echo "spreadJ: results path not found: $res_path" + exit 1 + fi + + local query + query="$(_filter_suite $suite).tests[] | select((.result == \"failed\") or (.result == \"aborted\")).name" + jq -r "$query" "$res_path" +} + +stats() { + local suite="" + if [ "$1" == "--suite" ]; then + suite="$2" + shift 2 + fi + local res_path="$1" + + if [ ! -e "$res_path" ]; then + echo "spreadJ: results path not found: $res_path" + exit 1 + fi + + local query + if [ -z "$suite" ]; then + query="del(.testsuites)" + else + query="$(_filter_suite $suite) | del(.tests) | del(.name)" + fi + jq -r "$query" "$res_path" +} + +list() { + local suite="" + if [ "$1" == "--suite" ]; then + suite="$2" + shift 2 + fi + local target="$1" + local res_path="$2" + + if [ ! -e "$res_path" ]; then + echo "spreadJ: results path not found: $res_path" + exit 1 + fi + + if [ -z "$target" ]; then + echo "spreadJ: result target cannot be empty" + exit 1 + fi + + local query + if [ "$target" == "all" ]; then + query="$(_filter_suite $suite).tests[]).name" + else + query="$(_filter_suite $suite).tests[] | select((.result == \"$target\")).name" + fi + jq -r "$query" "$res_path" +} + +main() { + if [ $# -eq 0 ]; then + show_help + exit 0 + fi + + local subcommand="$1" + local action= + if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + show_help + exit 0 + else + action=$(echo "$subcommand" | tr '-' '_') + shift + fi + + if [ -z "$(declare -f "$action")" ]; then + echo "spreadJ: no such command: $subcommand" >&2 + show_help + exit 1 + fi + + "$action" "$@" +} + +main "$@" From 6a7bbc364e9d6c61da322641c8ad22d3306cc04a Mon Sep 17 00:00:00 2001 From: Sergio Cazzolato Date: Mon, 23 Sep 2024 11:06:09 -0300 Subject: [PATCH 2/3] Fix mergetool output --- .../external/snapd-testing-tools/tests/os.query/task.yaml | 5 ++++- .../lib/external/snapd-testing-tools/tools/tests.pkgs.apt.sh | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/lib/external/snapd-testing-tools/tests/os.query/task.yaml b/tests/lib/external/snapd-testing-tools/tests/os.query/task.yaml index 66d99cde2bd..65ef12d2e2c 100644 --- a/tests/lib/external/snapd-testing-tools/tests/os.query/task.yaml +++ b/tests/lib/external/snapd-testing-tools/tests/os.query/task.yaml @@ -104,7 +104,6 @@ execute: | os.query is-classic ! os.query is-core ;; - fedora-39-64) fedora-39-64) os.query is-fedora os.query is-fedora 39 @@ -150,7 +149,11 @@ execute: | ! os.query is-core ;; opensuse-15.6-64) + os.query is-opensuse os.query is-opensuse 15.6 + os.query is-classic + ! os.query is-core + ;; opensuse-tumbleweed-64) os.query is-opensuse os.query is-opensuse tumbleweed diff --git a/tests/lib/external/snapd-testing-tools/tools/tests.pkgs.apt.sh b/tests/lib/external/snapd-testing-tools/tools/tests.pkgs.apt.sh index 0b833289045..51e66b1efd8 100644 --- a/tests/lib/external/snapd-testing-tools/tools/tests.pkgs.apt.sh +++ b/tests/lib/external/snapd-testing-tools/tools/tests.pkgs.apt.sh @@ -81,5 +81,6 @@ cmd_remove() { } cmd_download() { + # shellcheck disable=SC2068 apt download -q $@ >/dev/null } From 44d65a13eda14aa7bcc4c446567ec2fac69bc0f7 Mon Sep 17 00:00:00 2001 From: Sergio Cazzolato Date: Mon, 23 Sep 2024 12:22:13 -0300 Subject: [PATCH 3/3] Squashed 'tests/lib/external/snapd-testing-tools/' changes from 912131f2a6..bae7faf8cb bae7faf8cb Update the quoting used to download packages git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: bae7faf8cb3f04296bac9552ac0d1aa89d4e9139 --- tools/tests.pkgs | 3 ++- tools/tests.pkgs.apt.sh | 3 +-- tools/tests.pkgs.dnf-yum.sh | 5 ++--- tools/tests.pkgs.pacman.sh | 5 ++--- tools/tests.pkgs.zypper.sh | 6 ++---- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/tools/tests.pkgs b/tools/tests.pkgs index 89c51a7a3a3..086fcfacc97 100755 --- a/tools/tests.pkgs +++ b/tools/tests.pkgs @@ -161,7 +161,8 @@ main() { cmd_remove $(remap_many "$@") ;; download) - cmd_download "$(remap_many "$@")" + # shellcheck disable=SC2046 + cmd_download $(remap_many "$@") ;; *) echo "tests.pkgs: unknown action $action" >&2 diff --git a/tools/tests.pkgs.apt.sh b/tools/tests.pkgs.apt.sh index 51e66b1efd8..391874b4ba5 100644 --- a/tools/tests.pkgs.apt.sh +++ b/tools/tests.pkgs.apt.sh @@ -81,6 +81,5 @@ cmd_remove() { } cmd_download() { - # shellcheck disable=SC2068 - apt download -q $@ >/dev/null + apt download -q "$@" >/dev/null } diff --git a/tools/tests.pkgs.dnf-yum.sh b/tools/tests.pkgs.dnf-yum.sh index 4b82f77c62b..8f6b1c9cb4d 100644 --- a/tools/tests.pkgs.dnf-yum.sh +++ b/tools/tests.pkgs.dnf-yum.sh @@ -75,10 +75,9 @@ cmd_remove() { } cmd_download() { - # shellcheck disable=SC2068 if [ "$(command -v dnf)" != "" ]; then - dnf download -q $@ + dnf download -q "$@" else - yum reinstall --downloadonly -q -y --downloaddir "${PWD:-.}" $@ + yum reinstall --downloadonly -q -y --downloaddir "${PWD:-.}" "$@" fi } diff --git a/tools/tests.pkgs.pacman.sh b/tools/tests.pkgs.pacman.sh index 37c49fa2aa0..d0341fff24c 100644 --- a/tools/tests.pkgs.pacman.sh +++ b/tools/tests.pkgs.pacman.sh @@ -66,11 +66,10 @@ cmd_list_installed() { } cmd_remove() { - # shellcheck disable=SC2068 - pacman -Rnsc --noconfirm $@ + pacman -Rnsc --noconfirm "$@" } cmd_download() { # shellcheck disable=SC2068 - pacman -Sw --noconfirm --cachedir "${PWD:-.}" -q $@ >/dev/null + pacman -Sw --noconfirm --cachedir "${PWD:-.}" -q "$@" >/dev/null } diff --git a/tools/tests.pkgs.zypper.sh b/tools/tests.pkgs.zypper.sh index 218102b6e60..61296783418 100644 --- a/tools/tests.pkgs.zypper.sh +++ b/tools/tests.pkgs.zypper.sh @@ -61,11 +61,9 @@ cmd_list_installed() { } cmd_remove() { - # shellcheck disable=SC2068 - zypper remove -y $@ + zypper remove -y "$@" } cmd_download() { - # shellcheck disable=SC2068 - zypper --pkg-cache-dir "${PWD:-.}" -q download $@ + zypper --pkg-cache-dir "${PWD:-.}" -q download "$@" }