aboutsummaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAnna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>2024-01-22 03:24:19 +0500
committerAnna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>2024-01-22 22:33:29 +0500
commit1b7238edb6dafc3b01cf94ebae75361acd9a1cd9 (patch)
tree522f5ba73096c3e9eb47d25713921c9a7963dc81 /eclass
parentdatabases.eclass: replace "--get-depend" with variables (diff)
downloadguru-1b7238edb6dafc3b01cf94ebae75361acd9a1cd9.tar.gz
guru-1b7238edb6dafc3b01cf94ebae75361acd9a1cd9.tar.bz2
guru-1b7238edb6dafc3b01cf94ebae75361acd9a1cd9.zip
eclass/tests: add databases.eclass tests
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
Diffstat (limited to 'eclass')
-rwxr-xr-xeclass/tests/databases.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/eclass/tests/databases.sh b/eclass/tests/databases.sh
new file mode 100755
index 000000000..92cbbd13b
--- /dev/null
+++ b/eclass/tests/databases.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+GENTOO_REPO=$(portageq get_repo_path / gentoo) || exit
+source "${GENTOO_REPO}"/eclass/tests/tests-common.sh || exit
+TESTS_ECLASS_SEARCH_PATHS+=( "${GENTOO_REPO}"/eclass )
+
+declare -A DATABASES_REQ_USE=(
+ [mongod]="ssl"
+ [postgres]="xml"
+)
+
+inherit databases
+
+test_depend() {
+ tbegin "if \${DATABASES_DEPEND} is defined"
+ declare -p DATABASES_DEPEND &>/dev/null
+ tend $?
+
+ tbegin "\${DATABASES_DEPEND[memcached]}"
+ test "${DATABASES_DEPEND[memcached]}" == "net-misc/memcached"
+ tend $?
+
+ tbegin "\${DATABASES_DEPEND[mongod]}"
+ test "${DATABASES_DEPEND[mongod]}" == "dev-db/mongodb[ssl]"
+ tend $?
+
+ tbegin "\${DATABASES_DEPEND[mysql]}"
+ test "${DATABASES_DEPEND[mysql]}" == "virtual/mysql[server]"
+ tend $?
+
+ tbegin "\${DATABASES_DEPEND[postgres]}"
+ test "${DATABASES_DEPEND[postgres]}" == "dev-db/postgresql[server,xml]"
+ tend $?
+
+ tbegin "\${DATABASES_DEPEND[redis]}"
+ test "${DATABASES_DEPEND[redis]}" == "dev-db/redis"
+ tend $?
+}
+
+einfo "Testing dependency strings"
+eindent
+test_depend
+eoutdent
+
+texit