From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 32F4D158041 for ; Fri, 23 Feb 2024 12:17:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 72D0BE2A8E; Fri, 23 Feb 2024 12:17:36 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4DD3AE2A8E for ; Fri, 23 Feb 2024 12:17:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 51204343057 for ; Fri, 23 Feb 2024 12:17:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E3BAC131B for ; Fri, 23 Feb 2024 12:17:33 +0000 (UTC) From: "Florian Schmaus" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Florian Schmaus" Message-ID: <1708690629.6663153d5011f64051edc3e6b58b929fe5b05232.flow@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/atuin/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-shells/atuin/atuin-18.0.1.ebuild X-VCS-Directories: app-shells/atuin/ X-VCS-Committer: flow X-VCS-Committer-Name: Florian Schmaus X-VCS-Revision: 6663153d5011f64051edc3e6b58b929fe5b05232 X-VCS-Branch: master Date: Fri, 23 Feb 2024 12:17:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 42fa7b58-71b3-4637-b3b4-e6373698558e X-Archives-Hash: bcd13d307645a8460f5b300efc239487 commit: 6663153d5011f64051edc3e6b58b929fe5b05232 Author: Florian Schmaus gentoo org> AuthorDate: Fri Feb 23 11:28:34 2024 +0000 Commit: Florian Schmaus gentoo org> CommitDate: Fri Feb 23 12:17:09 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6663153d app-shells/atuin: enable server tests Closes: https://bugs.gentoo.org/925163 Closes: https://github.com/gentoo/gentoo/pull/35495 Signed-off-by: Florian Schmaus gentoo.org> app-shells/atuin/atuin-18.0.1.ebuild | 42 ++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/app-shells/atuin/atuin-18.0.1.ebuild b/app-shells/atuin/atuin-18.0.1.ebuild index db09098f28cc..23014456276e 100644 --- a/app-shells/atuin/atuin-18.0.1.ebuild +++ b/app-shells/atuin/atuin-18.0.1.ebuild @@ -457,6 +457,7 @@ REQUIRED_USE=" test? ( client server sync ) " RDEPEND="server? ( acct-user/atuin )" +DEPEND="test? ( dev-db/postgresql )" BDEPEND=">=virtual/rust-1.71.0" QA_FLAGS_IGNORED="usr/bin/${PN}" @@ -467,12 +468,6 @@ DOCS=( README.md ) -src_prepare() { - default - - rm atuin/tests/sync.rs || die -} - src_configure() { local myfeatures=( $(usev client) @@ -503,6 +498,41 @@ src_compile() { done } +src_test() { + local postgres_dir="${T}"/postgres + initdb "${postgres_dir}" || die + + local port=11123 + # -h '' → only socket connections allowed. + postgres -D "${postgres_dir}" \ + -k "${postgres_dir}" \ + -p "${port}" & + local postgres_pid=${!} + + local timeout_secs=30 + timeout "${timeout_secs}" bash -c \ + 'until printf "" >/dev/tcp/${0}/${1} 2>> "${T}/portlog"; do sleep 1; done' \ + localhost "${port}" || die "Timeout waiting for postgres port ${port} to become available" + + psql -h localhost -p "${port}" -d postgres <<-EOF || die "Failed to configure postgres" + create database atuin; + create user atuin with encrypted password 'pass'; + grant all privileges on database atuin to atuin; + \connect atuin + grant all on schema public to atuin; + EOF + + # Subshell so that postgres_pid is in scope when the trap is executed. + ( + cleanup() { + kill "${postgres_pid}" || die "failed to send SIGTERM to postgres" + } + trap cleanup EXIT + + ATUIN_DB_URI="postgres://atuin:pass@localhost:${port}/atuin" cargo_src_test + ) +} + src_install() { exeinto "/usr/bin" doexe "${ATUIN_BIN}"