From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 96A3D1F9FF for ; Sun, 21 Feb 2021 21:46:43 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1613944000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=55M+zmtQxWkvMk8Lkd23uBW8EzxC4PfQbXUPq1/8Jn0=; b=YFHsxXZXRwLJ8HKSGxQwU7Xtc55mcRCMb2oldEGo8TlfVWyUYexhCh3xXOmE6e8IeXZL3g BnfMpcEP84ib/pgcursjBS3edUyziNEjnno0ulKR4PEKeYzYTCLWFhc2BhhxAeifG5pLbx 6gvcIDKlEJWDnZ0gE12U82whOh26NPxRpjSzLCkxRXBCO4O/pvonmmJ/CWIImpHUktnHwB LKRRifImI3PFb1PkJpIPYmxVSWBqaBEH/R1xCpPcjA2Y7xmWdTKHX0k8RLFrt1DwGrF/zx LZr/cHuFCOh1CNbMGwn1tUDpRM/3s5LNHXCkQjc6yvW3CGBTgImKPcwZZU0BMQ== From: Kyle Meyer To: meta@public-inbox.org Subject: [PATCH 3/3] t/www_listing: require grok-pull version 2 or later Date: Sun, 21 Feb 2021 16:46:11 -0500 Message-Id: <20210221214612.15071-4-kyle@kyleam.com> In-Reply-To: <20210221214612.15071-1-kyle@kyleam.com> References: <20210221214612.15071-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com List-Id: The grok-pull-based tests in www_listing are incompatible with Grokmirror v2 in two ways: the generated configuration format and the expected exit codes. Update the tests to work with v2, and skip them for earlier versions. This was tested with the latest release of Grokmirror, v2.0.7. Note that the "pull" and "fsck" sections are required even though they're empty. --- Another option would be to generate an appropriate v1 or v2 configuration based on which Grokmirror version is detected. I'm not sure that's worth the trouble though. t/www_listing.t | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/t/www_listing.t b/t/www_listing.t index bf35530f3494c016..6a2892de9b827fe6 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -122,22 +122,27 @@ SKIP: { my $grok_pull = which('grok-pull') or skip('grok-pull not available', 12); + my ($grok_version) = (xqx([$grok_pull, "--version"]) + =~ /(\d+)\.(?:\d+)(?:\.(\d+))?/); + $grok_version >= 2 or + skip('grok-pull v2 or later not available', 12); ok(mkdir("$tmpdir/mirror"), 'prepare grok mirror dest'); open $fh, '>', "$tmpdir/repos.conf" or die; print $fh <<"" or die; -# You can pull from multiple grok mirrors, just create -# a separate section for each mirror. The name can be anything. -[test] -site = http://$host:$port -manifest = http://$host:$port/manifest.js.gz +[core] toplevel = $tmpdir/mirror -mymanifest = $tmpdir/local-manifest.js.gz +manifest = $tmpdir/local-manifest.js.gz +[remote] +site = http://$host:$port +manifest = \${site}/manifest.js.gz +[pull] +[fsck] close $fh or die; xsys($grok_pull, '-c', "$tmpdir/repos.conf"); - is($? >> 8, 127, 'grok-pull exit code as expected'); + is($? >> 8, 0, 'grok-pull exit code as expected'); for (qw(alt bare v2/git/0.git v2/git/1.git v2/git/2.git)) { ok(-d "$tmpdir/mirror/$_", "grok-pull created $_"); } @@ -146,18 +151,19 @@ mymanifest = $tmpdir/local-manifest.js.gz # /$INBOX/v2/manifest.js.gz open $fh, '>', "$tmpdir/per-inbox.conf" or die; print $fh <<"" or die; -# You can pull from multiple grok mirrors, just create -# a separate section for each mirror. The name can be anything. -[v2] -site = http://$host:$port -manifest = http://$host:$port/v2/manifest.js.gz +[core] toplevel = $tmpdir/per-inbox -mymanifest = $tmpdir/per-inbox-manifest.js.gz +manifest = $tmpdir/per-inbox-manifest.js.gz +[remote] +site = http://$host:$port +manifest = \${site}/v2/manifest.js.gz +[pull] +[fsck] close $fh or die; ok(mkdir("$tmpdir/per-inbox"), 'prepare single-v2-inbox mirror'); xsys($grok_pull, '-c', "$tmpdir/per-inbox.conf"); - is($? >> 8, 127, 'grok-pull exit code as expected'); + is($? >> 8, 0, 'grok-pull exit code as expected'); for (qw(v2/git/0.git v2/git/1.git v2/git/2.git)) { ok(-d "$tmpdir/per-inbox/$_", "grok-pull created $_"); } -- 2.30.1