From 958d817a9bf514f69378dc08c222b0e1e0bbe711 Mon Sep 17 00:00:00 2001 From: Pooja Yadav Date: Tue, 24 Aug 2021 17:16:05 +0530 Subject: [PATCH] Resolves: rhbz#1995957 Add gating tests --- tests/scripts/data.txt | 4 +++ tests/scripts/run_tests.sh | 59 ++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 12 ++++++++ 3 files changed, 75 insertions(+) create mode 100644 tests/scripts/data.txt create mode 100755 tests/scripts/run_tests.sh create mode 100644 tests/tests.yml diff --git a/tests/scripts/data.txt b/tests/scripts/data.txt new file mode 100644 index 0000000..29c358c --- /dev/null +++ b/tests/scripts/data.txt @@ -0,0 +1,4 @@ +Cloud +Linux +Fedora +Fedoraaa diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh new file mode 100755 index 0000000..faf256a --- /dev/null +++ b/tests/scripts/run_tests.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +check_pkg() { + local pkg=$1 + if rpm -q $pkg + then + echo "PASS" + else + echo "FAIL" + fi +} + +check_dict() { + if [ -f "/usr/share/myspell/de_DE.dic" ] + then + echo "PASS" + else + echo "FAIL" + fi +} + +check_misspelled_word() { + VAR1="Fedoraaa" + VAR2=$(hunspell -l data.txt) + if [ "$VAR1" = "$VAR2" ]; then + echo "PASS" + else + echo "FAIL" + fi +} + +check_misspelled_line() { + VAR1="Fedoraaa" + VAR2=$(hunspell -L data.txt) + if [ "$VAR1" = "$VAR2" ]; then + echo "PASS" + else + echo "FAIL" + fi +} + +check_correct_word() { + VAR1="Cloud\nLinux\nFedora" + VAR1=$(echo -e "$VAR1") + VAR2=$(hunspell -G data.txt) + if [ "$VAR1" = "$VAR2" ]; then + echo "PASS" + else + echo "FAIL" + fi +} + +check_pkg "hunspell" +check_pkg "hunspell-de" +check_dict +check_misspelled_word +check_misspelled_line +check_correct_word + diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..63054d2 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,12 @@ +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-basic + required_packages: + - hunspell + - hunspell-de + tests: + - simple: + dir: scripts + run: ./run_tests.sh