public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "David Roman" <davidroman96@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:master commit in: eclass/tests/
Date: Mon,  5 Feb 2024 11:57:37 +0000 (UTC)	[thread overview]
Message-ID: <1707074601.e677767400dab06bbb2c3d5ef0eb2b9c344089a7.davidroman@gentoo> (raw)

commit:     e677767400dab06bbb2c3d5ef0eb2b9c344089a7
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Sat Feb  3 07:29:38 2024 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Sun Feb  4 19:23:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e6777674

eclass/tests: add daemons.eclass tests

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 eclass/tests/daemons.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/eclass/tests/daemons.sh b/eclass/tests/daemons.sh
new file mode 100755
index 0000000000..ccd0ded810
--- /dev/null
+++ b/eclass/tests/daemons.sh
@@ -0,0 +1,91 @@
+#!/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 DAEMONS_REQ_USE=(
+	[ceph]="ssl"
+	[postgresql]="xml"
+)
+
+inherit daemons
+
+test_depend() {
+	tbegin "if \${DAEMONS_DEPEND} is defined"
+	declare -p DAEMONS_DEPEND &>/dev/null
+	tend $?
+
+	tbegin "if \${DAEMONS_DEPEND} contains Pifpaf"
+	[[ "${DAEMONS_DEPEND[*]}" == *"dev-util/pifpaf"* ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[ceph]}"
+	[[ "${DAEMONS_DEPEND[ceph]}" == *"sys-cluster/ceph[ssl]" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[consul]}"
+	[[ "${DAEMONS_DEPEND[consul]}" == *"app-admin/consul" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[httpbin]}"
+	[[ "${DAEMONS_DEPEND[httpbin]}" == *"dev-python/httpbin" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[kafka]}"
+	[[ "${DAEMONS_DEPEND[kafka]}" == *"net-misc/kafka-bin" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[memcached]}"
+	[[ "${DAEMONS_DEPEND[memcached]}" == *"net-misc/memcached" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[mysql]}"
+	[[ "${DAEMONS_DEPEND[mysql]}" == *"virtual/mysql[server]" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[postgresql]}"
+	[[ "${DAEMONS_DEPEND[postgresql]}" == *"dev-db/postgresql[server,xml]" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[redis]}"
+	[[ "${DAEMONS_DEPEND[redis]}" == *"dev-db/redis" ]]
+	tend $?
+
+	tbegin "\${DAEMONS_DEPEND[vault]}"
+	[[ "${DAEMONS_DEPEND[vault]}" == *"app-admin/vault" ]]
+	tend $?
+}
+
+test_daemons_enable() {
+	local IUSE= RESTRICT= BDEPEND=
+	local svc=${1?}
+
+	IUSE= RESTRICT= BDEPEND=
+	tbegin "'daemons_enable ${svc} test'"
+	daemons_enable ${svc} test && [[ ${BDEPEND} && ${IUSE} && ${RESTRICT} ]]
+	tend $?
+
+	IUSE= RESTRICT= BDEPEND=
+	tbegin "'daemons_enable ${svc} test-db'"
+	daemons_enable ${svc} test-db && [[ ${BDEPEND} && ${IUSE} && ! ${RESTRICT} ]]
+	tend $?
+}
+
+einfo "Testing dependency strings"
+eindent
+test_depend
+eoutdent
+
+einfo "Testing daemons_enable"
+eindent
+for svc in "${!DAEMONS_DEPEND[@]}"; do
+	test_daemons_enable ${svc}
+done
+eoutdent
+
+texit


                 reply	other threads:[~2024-02-05 11:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1707074601.e677767400dab06bbb2c3d5ef0eb2b9c344089a7.davidroman@gentoo \
    --to=davidroman96@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox