From 48271da070adc997c6994f9fcdd10ebc373856c3 Mon Sep 17 00:00:00 2001 From: Pavel Negrobov Date: Thu, 14 Dec 2023 12:44:49 +0300 Subject: [PATCH 1/5] =?UTF-8?q?INF-834:=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B1=D0=B8?= =?UTF-8?q?=D0=BB=D0=B4=D0=B0=20osinfo-db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../p_osinfo-db/001-prepare_environment.sh | 7 ++++++ rpm_tests/p_osinfo-db/01-msvsphere-present.sh | 16 ++++++++++++++ rpm_tests/p_osinfo-db/02-check-image.sh | 22 +++++++++++++++++++ .../p_osinfo-db/files/msvsphereiso_url.txt | 5 +++++ 4 files changed, 50 insertions(+) create mode 100755 rpm_tests/p_osinfo-db/001-prepare_environment.sh create mode 100755 rpm_tests/p_osinfo-db/01-msvsphere-present.sh create mode 100755 rpm_tests/p_osinfo-db/02-check-image.sh create mode 100644 rpm_tests/p_osinfo-db/files/msvsphereiso_url.txt diff --git a/rpm_tests/p_osinfo-db/001-prepare_environment.sh b/rpm_tests/p_osinfo-db/001-prepare_environment.sh new file mode 100755 index 0000000..d033188 --- /dev/null +++ b/rpm_tests/p_osinfo-db/001-prepare_environment.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Подготовка окружения для тестирования пакета ${TEST_PACKAGE_NAME}" + +dnf install -y libosinfo + +exit 0 diff --git a/rpm_tests/p_osinfo-db/01-msvsphere-present.sh b/rpm_tests/p_osinfo-db/01-msvsphere-present.sh new file mode 100755 index 0000000..08978d0 --- /dev/null +++ b/rpm_tests/p_osinfo-db/01-msvsphere-present.sh @@ -0,0 +1,16 @@ +#!/bin/bash -x + +echo "Тест наличия MSVSphere ОС в БД osinfo" + +source ../../library/sh_lib.sh + +check=0 + +/usr/bin/osinfo-query os | /bin/grep -i msvsphere8 +check=$(eq_is_success ${check} 0) + +/usr/bin/osinfo-query os | /bin/grep -i msvsphere9 +check=$(eq_is_success ${check} 0) + +check_test_status ${check} "$0" +exit ${check} diff --git a/rpm_tests/p_osinfo-db/02-check-image.sh b/rpm_tests/p_osinfo-db/02-check-image.sh new file mode 100755 index 0000000..06c3b8a --- /dev/null +++ b/rpm_tests/p_osinfo-db/02-check-image.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo "Тест получения названия MSVSphere ОС из ISO образа" + +source ../../library/sh_lib.sh + +check=0 +ISO_IMAGES_URLS_FILE='files/msvsphereiso_url.txt' +EXPECTED_MESSAGE="Media is bootable. +Media is an installer for OS 'MSVSphere 9 (x86_64)'" + +while read LINE; do + curl -LJs -r 0-1048576 -o img.iso $LINE + OUTPUT="$(/usr/bin/osinfo-detect img.iso 2>&1)" + [[ "$OUTPUT" == "$EXPECTED_MESSAGE" ]] + check=$(eq_is_success ${check} 0) + echo "RESULT: File: $LINE; Result: $check" + rm -f img.iso +done < $ISO_IMAGES_URLS_FILE + +check_test_status ${check} "$0" +exit ${check} diff --git a/rpm_tests/p_osinfo-db/files/msvsphereiso_url.txt b/rpm_tests/p_osinfo-db/files/msvsphereiso_url.txt new file mode 100644 index 0000000..aa48d23 --- /dev/null +++ b/rpm_tests/p_osinfo-db/files/msvsphereiso_url.txt @@ -0,0 +1,5 @@ +https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-dvd.iso +https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-netinstall.iso +https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-minimal.iso +https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-server.iso +https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-arm.iso -- 2.36.5 From ef1cd0dafd6a3b0ccd455c012c61713bf8b6eef2 Mon Sep 17 00:00:00 2001 From: Pavel Negrobov Date: Fri, 15 Dec 2023 16:22:46 +0300 Subject: [PATCH 2/5] =?UTF-8?q?INF-834:=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B1=D0=B8?= =?UTF-8?q?=D0=BB=D0=B4=D0=B0=20osinfo-db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpm_tests/p_osinfo-db/03-check-image-sha256.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 rpm_tests/p_osinfo-db/03-check-image-sha256.sh diff --git a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh new file mode 100755 index 0000000..888e6c7 --- /dev/null +++ b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Тест получения названия MSVSphere ОС из ISO образа" + +source ../../library/sh_lib.sh + +check=0 +ISO_IMAGES_URLS_FILE='files/msvsphereiso_url.txt' + +while read LINE; do + CHECKSUM_URL="$LINE.CHECKSUM" +# curl -LJs -r 0-1048576 -o img.iso $LINE + echo "File: $LINE; Checksum: $CHECKSUM_URL" +done < $ISO_IMAGES_URLS_FILE + +check_test_status ${check} "$0" +exit ${check} -- 2.36.5 From 28244cabf4cc6759aec1701426ff4bae9bdf2c95 Mon Sep 17 00:00:00 2001 From: Pavel Negrobov Date: Mon, 18 Dec 2023 12:31:12 +0300 Subject: [PATCH 3/5] =?UTF-8?q?INF-834:=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B1=D0=B8?= =?UTF-8?q?=D0=BB=D0=B4=D0=B0=20osinfo-db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpm_tests/p_osinfo-db/01-msvsphere-present.sh | 2 ++ ...{02-check-image.sh => 02-image-os_name.sh} | 2 ++ .../p_osinfo-db/03-check-image-sha256.sh | 31 +++++++++++++++++-- .../p_osinfo-db/files/msvsphereiso_local.txt | 5 +++ 4 files changed, 37 insertions(+), 3 deletions(-) rename rpm_tests/p_osinfo-db/{02-check-image.sh => 02-image-os_name.sh} (90%) create mode 100644 rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt diff --git a/rpm_tests/p_osinfo-db/01-msvsphere-present.sh b/rpm_tests/p_osinfo-db/01-msvsphere-present.sh index 08978d0..e815bc0 100755 --- a/rpm_tests/p_osinfo-db/01-msvsphere-present.sh +++ b/rpm_tests/p_osinfo-db/01-msvsphere-present.sh @@ -1,6 +1,8 @@ #!/bin/bash -x echo "Тест наличия MSVSphere ОС в БД osinfo" +echo "=====================================" +echo "" source ../../library/sh_lib.sh diff --git a/rpm_tests/p_osinfo-db/02-check-image.sh b/rpm_tests/p_osinfo-db/02-image-os_name.sh similarity index 90% rename from rpm_tests/p_osinfo-db/02-check-image.sh rename to rpm_tests/p_osinfo-db/02-image-os_name.sh index 06c3b8a..d4e1095 100755 --- a/rpm_tests/p_osinfo-db/02-check-image.sh +++ b/rpm_tests/p_osinfo-db/02-image-os_name.sh @@ -1,6 +1,8 @@ #!/bin/bash echo "Тест получения названия MSVSphere ОС из ISO образа" +echo "==================================================" +echo "" source ../../library/sh_lib.sh diff --git a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh index 888e6c7..2dd361a 100755 --- a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh +++ b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh @@ -1,6 +1,8 @@ #!/bin/bash -echo "Тест получения названия MSVSphere ОС из ISO образа" +echo "Тест проверки целостности ISO образов MSVSphere ОС" +echo "==================================================" +echo "" source ../../library/sh_lib.sh @@ -8,9 +10,32 @@ check=0 ISO_IMAGES_URLS_FILE='files/msvsphereiso_url.txt' while read LINE; do - CHECKSUM_URL="$LINE.CHECKSUM" + ISO_FILENAME=`basename $LINE` + ISO_URL_PATH="${LINE%/*}" + LOCAL_FILE="/home/pavel/MSVSphere-images/$ISO_FILENAME" + CHECKSUM_URL="$ISO_URL_PATH/$ISO_FILENAME.CHECKSUM" + echo "ISO URL: $LINE" + echo "Local file path: $LOCAL_FILE" + echo "Checksum File: $CHECKSUM_URL" + + # Get SHA256 hash value: + # curl -s https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-arm.iso.CHECKSUM | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}' + SHA256_HASH_FROM_FILE="$(curl -s https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-arm.iso.CHECKSUM | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}')" # curl -LJs -r 0-1048576 -o img.iso $LINE - echo "File: $LINE; Checksum: $CHECKSUM_URL" + # sha256sum /home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-arm.iso | /bin/awk -F ' ' '{ print $1 }' + SHA256_OUTPUT="$(sha256sum $LOCAL_FILE)" + SHA256HASH="$(echo "$SHA256_OUTPUT" | /bin/awk -F ' ' '{ print $1 }')" + + # Test and print results + echo "Calculated file SHA256 hash: $SHA256HASH" + echo "SHA256 hash from CHECKSUM file: $SHA256_HASH_FROM_FILE" + if [ "$SHA256HASH" == "$SHA256_HASH_FROM_FILE" ]; then + echo 'SHA256 hash OK' + else + echo 'ERROR: SHA256 hash mismatch!!!' + let check+=1 + fi + echo "--------------------------" done < $ISO_IMAGES_URLS_FILE check_test_status ${check} "$0" diff --git a/rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt b/rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt new file mode 100644 index 0000000..86ca90e --- /dev/null +++ b/rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt @@ -0,0 +1,5 @@ +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-dvd.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-netinstall.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-minimal.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-server.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-arm.iso -- 2.36.5 From a20a7b1ef3b6f26aac7a7bc0782bd5756aeaf191 Mon Sep 17 00:00:00 2001 From: Pavel Negrobov Date: Mon, 18 Dec 2023 12:39:51 +0300 Subject: [PATCH 4/5] =?UTF-8?q?INF-834:=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B1=D0=B8?= =?UTF-8?q?=D0=BB=D0=B4=D0=B0=20osinfo-db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpm_tests/p_osinfo-db/03-check-image-sha256.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh index 2dd361a..0ac386f 100755 --- a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh +++ b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh @@ -13,23 +13,22 @@ while read LINE; do ISO_FILENAME=`basename $LINE` ISO_URL_PATH="${LINE%/*}" LOCAL_FILE="/home/pavel/MSVSphere-images/$ISO_FILENAME" - CHECKSUM_URL="$ISO_URL_PATH/$ISO_FILENAME.CHECKSUM" + CHECKSUM_FILE_URL="$ISO_URL_PATH/$ISO_FILENAME.CHECKSUM" echo "ISO URL: $LINE" echo "Local file path: $LOCAL_FILE" - echo "Checksum File: $CHECKSUM_URL" + echo "Checksum File: $CHECKSUM_FILE_URL" # Get SHA256 hash value: # curl -s https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-arm.iso.CHECKSUM | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}' - SHA256_HASH_FROM_FILE="$(curl -s https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-arm.iso.CHECKSUM | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}')" + SHA256_HASH_FROM_FILE="$(curl -s $CHECKSUM_FILE_URL | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}')" # curl -LJs -r 0-1048576 -o img.iso $LINE # sha256sum /home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-arm.iso | /bin/awk -F ' ' '{ print $1 }' - SHA256_OUTPUT="$(sha256sum $LOCAL_FILE)" - SHA256HASH="$(echo "$SHA256_OUTPUT" | /bin/awk -F ' ' '{ print $1 }')" + SHA256_HASH_CALCULATED="$(sha256sum $LOCAL_FILE | /bin/awk -F ' ' '{ print $1 }')" # Test and print results - echo "Calculated file SHA256 hash: $SHA256HASH" + echo "Calculated file SHA256 hash: $SHA256_HASH_CALCULATED" echo "SHA256 hash from CHECKSUM file: $SHA256_HASH_FROM_FILE" - if [ "$SHA256HASH" == "$SHA256_HASH_FROM_FILE" ]; then + if [ "$SHA256_HASH_CALCULATED" == "$SHA256_HASH_FROM_FILE" ]; then echo 'SHA256 hash OK' else echo 'ERROR: SHA256 hash mismatch!!!' -- 2.36.5 From 774513f2bc0dc979a1ef550de222f17ffc203eb4 Mon Sep 17 00:00:00 2001 From: Pavel Negrobov Date: Mon, 18 Dec 2023 12:42:38 +0300 Subject: [PATCH 5/5] =?UTF-8?q?INF-834:=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B1=D0=B8?= =?UTF-8?q?=D0=BB=D0=B4=D0=B0=20osinfo-db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpm_tests/p_osinfo-db/03-check-image-sha256.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh index 0ac386f..835fcf3 100755 --- a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh +++ b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh @@ -6,6 +6,9 @@ echo "" source ../../library/sh_lib.sh +echo "ATTENSION: Test tomporarely skipped." +exit 0 + check=0 ISO_IMAGES_URLS_FILE='files/msvsphereiso_url.txt' -- 2.36.5