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 4365515939F for ; Tue, 9 Jul 2024 19:29:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1FDBFE2A6E; Tue, 9 Jul 2024 19:29:34 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F0D36E2A58 for ; Tue, 9 Jul 2024 19:29:33 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0B810342FF7 for ; Tue, 9 Jul 2024 19:29:33 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3D4411DF8 for ; Tue, 9 Jul 2024 19:29:31 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1720553360.18ccbe44a8dfad05bdaac3cf2ccca6ec1ce68103.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pymongo/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/pymongo/pymongo-4.7.2.ebuild X-VCS-Directories: dev-python/pymongo/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 18ccbe44a8dfad05bdaac3cf2ccca6ec1ce68103 X-VCS-Branch: master Date: Tue, 9 Jul 2024 19:29:31 +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: 00f5379a-6428-4024-a0bc-3bbaff96126a X-Archives-Hash: b24e045c8e6f7f14776db470c2d51d41 commit: 18ccbe44a8dfad05bdaac3cf2ccca6ec1ce68103 Author: Michał Górny gentoo org> AuthorDate: Tue Jul 9 18:53:20 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Tue Jul 9 19:29:20 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18ccbe44 dev-python/pymongo: Split test suite to workaround mongodb crash Bug: https://bugs.gentoo.org/934389 Signed-off-by: Michał Górny gentoo.org> dev-python/pymongo/pymongo-4.7.2.ebuild | 94 ++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 37 deletions(-) diff --git a/dev-python/pymongo/pymongo-4.7.2.ebuild b/dev-python/pymongo/pymongo-4.7.2.ebuild index fedcb4086de1..0b7255b485fd 100644 --- a/dev-python/pymongo/pymongo-4.7.2.ebuild +++ b/dev-python/pymongo/pymongo-4.7.2.ebuild @@ -99,6 +99,16 @@ python_test() { # fragile to timing? fails because we're getting too many logs test/test_connection_logging.py::TestConnectionLoggingConnectionPoolOptions::test_maxConnecting_should_be_included_in_connection_pool_created_message_when_specified ) + local run_separately=( + # need to run some tests separately and then restart mongodb + # to prevent it from crashing + # https://bugs.gentoo.org/934389 + # note that this list must not overlap with EPYTEST_DESELECT + test/test_change_stream.py + test/test_collation.py + test/test_database.py + test/test_gridfs.py + ) if ! use test-full; then # .invalid is guaranteed to return NXDOMAIN per RFC 6761 @@ -114,45 +124,55 @@ python_test() { local dbpath=${TMPDIR}/mongo.db local logpath=${TMPDIR}/mongod.log - # Now, the hard part: we need to find a free port for mongod. - # We're just trying to run it random port numbers and check the log - # for bind errors. It shall be noted that 'mongod --fork' does not - # return failure when it fails to bind. - - mkdir -p "${dbpath}" || die - while true; do - ebegin "Trying to start mongod on port ${DB_PORT}" - - LC_ALL=C \ - mongod --dbpath "${dbpath}" --nojournal \ - --bind_ip ${DB_IP} --port ${DB_PORT} \ - --unixSocketPrefix "${TMPDIR}" \ - --logpath "${logpath}" --fork \ - && sleep 2 - - # Now we need to check if the server actually started... - if [[ ${?} -eq 0 && -S "${TMPDIR}"/mongodb-${DB_PORT}.sock ]]; then - # yay! - eend 0 - break - elif grep -q 'Address already in use' "${logpath}"; then - # ay, someone took our port! - eend 1 - : $(( DB_PORT += 1 )) - continue - else - eend 1 - eerror "Unable to start mongod for tests. See the server log:" - eerror " ${logpath}" - die "Unable to start mongod for tests." - fi + local stage failed= + for stage in 1 2; do + # Now, the hard part: we need to find a free port for mongod. + # We're just trying to run it random port numbers and check the log + # for bind errors. It shall be noted that 'mongod --fork' does not + # return failure when it fails to bind. + + mkdir -p "${dbpath}" || die + while true; do + ebegin "Trying to start mongod on port ${DB_PORT}" + + LC_ALL=C \ + mongod --dbpath "${dbpath}" --nojournal \ + --bind_ip ${DB_IP} --port ${DB_PORT} \ + --unixSocketPrefix "${TMPDIR}" \ + --logpath "${logpath}" --fork \ + && sleep 2 + + # Now we need to check if the server actually started... + if [[ ${?} -eq 0 && -S "${TMPDIR}"/mongodb-${DB_PORT}.sock ]]; then + # yay! + eend 0 + break + elif grep -q 'Address already in use' "${logpath}"; then + # ay, someone took our port! + eend 1 + : $(( DB_PORT += 1 )) + continue + else + eend 1 + eerror "Unable to start mongod for tests. See the server log:" + eerror " ${logpath}" + die "Unable to start mongod for tests." + fi + done + + case ${stage} in + 1) + nonfatal epytest "${run_separately[@]}" || failed=1 + ;; + 2) + EPYTEST_DESELECT+=( "${run_separately[@]}" ) + nonfatal epytest || failed=1 + ;; + esac + + mongod --dbpath "${dbpath}" --shutdown || die done - local failed - nonfatal epytest || failed=1 - - mongod --dbpath "${dbpath}" --shutdown || die - [[ ${failed} ]] && die "Tests fail with ${EPYTHON}" rm -rf "${dbpath}" || die