user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 10/10] t/lei: add more diagnostics for failures
Date: Thu, 25 Mar 2021 06:20:26 +0200	[thread overview]
Message-ID: <20210325042026.11270-11-e@80x24.org> (raw)
In-Reply-To: <20210325042026.11270-1-e@80x24.org>

This seems to error out while looping the test suite and
I'm not 100% sure why.
---
 t/lei-import-maildir.t | 13 +++++++++----
 t/lei-q-thread.t       | 15 ++++++++-------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/t/lei-import-maildir.t b/t/lei-import-maildir.t
index bd89677a..6706b014 100644
--- a/t/lei-import-maildir.t
+++ b/t/lei-import-maildir.t
@@ -11,17 +11,20 @@ test_lei(sub {
 	symlink(abs_path('t/data/0001.patch'), "$md/cur/x:2,S") or
 		BAIL_OUT "symlink $md $!";
 	lei_ok(qw(import), $md, \'import Maildir');
+	my $imp_err = $lei_err;
 	lei_ok(qw(q s:boolean));
 	my $res = json_utf8->decode($lei_out);
-	like($res->[0]->{'s'}, qr/use boolean/, 'got expected result');
+	like($res->[0]->{'s'}, qr/use boolean/, 'got expected result')
+			or diag explain($imp_err, $res);
 	is_deeply($res->[0]->{kw}, ['seen'], 'keyword set');
 	is($res->[1], undef, 'only got one result');
 
 	lei_ok(qw(import), $md, \'import Maildir again');
+	$imp_err = $lei_err;
 	lei_ok(qw(q -d none s:boolean), \'lei q w/o dedupe');
 	my $r2 = json_utf8->decode($lei_out);
-	is_deeply($r2, $res, 'idempotent import');
-
+	is_deeply($r2, $res, 'idempotent import')
+			or diag explain($imp_err, $res);
 	rename("$md/cur/x:2,S", "$md/cur/x:2,SR") or BAIL_OUT "rename: $!";
 	lei_ok('import', "maildir:$md", \'import Maildir after +answered');
 	lei_ok(qw(q -d none s:boolean), \'lei q after +answered');
@@ -33,8 +36,10 @@ test_lei(sub {
 	symlink(abs_path('t/utf8.eml'), "$md/cur/u:2,ST") or
 		BAIL_OUT "symlink $md $!";
 	lei_ok('import', "maildir:$md", \'import Maildir w/ trashed message');
+	$imp_err = $lei_err;
 	lei_ok(qw(q -d none m:testmessage@example.com));
 	$res = json_utf8->decode($lei_out);
-	is_deeply($res, [ undef ], 'trashed message not imported');
+	is_deeply($res, [ undef ], 'trashed message not imported')
+			or diag explain($imp_err, $res);
 });
 done_testing;
diff --git a/t/lei-q-thread.t b/t/lei-q-thread.t
index c999d12b..26d06eec 100644
--- a/t/lei-q-thread.t
+++ b/t/lei-q-thread.t
@@ -13,7 +13,8 @@ test_lei(sub {
 
 	lei_ok qw(q -t m:testmessage@example.com);
 	my $res = json_utf8->decode($lei_out);
-	is_deeply($res->[0]->{kw}, [ 'seen' ], 'q -t sets keywords');
+	is_deeply($res->[0]->{kw}, [ 'seen' ], 'q -t sets keywords') or
+		diag explain($res);
 
 	$eml = eml_load('t/utf8.eml');
 	$eml->header_set('References', $eml->header('Message-ID'));
@@ -28,9 +29,9 @@ test_lei(sub {
 	pop @$res;
 	my %m = map { $_->{'m'} => $_ } @$res;
 	is_deeply($m{'testmessage@example.com'}->{kw}, ['seen'],
-		'flag set in direct hit');
-	'TODO' or is_deeply($m{'a-reply@miss'}->{kw}, ['draft'],
-		'flag set in thread hit');
+		'flag set in direct hit') or diag explain($res);
+	is_deeply($m{'a-reply@miss'}->{kw}, ['draft'],
+		'flag set in thread hit') or diag explain($res);
 
 	lei_ok qw(q -t -t m:testmessage@example.com);
 	$res = json_utf8->decode($lei_out);
@@ -38,9 +39,9 @@ test_lei(sub {
 	pop @$res;
 	%m = map { $_->{'m'} => $_ } @$res;
 	is_deeply($m{'testmessage@example.com'}->{kw}, ['flagged', 'seen'],
-		'flagged set in direct hit');
-	'TODO' or is_deeply($m{'testmessage@example.com'}->{kw}, ['draft'],
-		'flagged set in direct hit');
+		'flagged set in direct hit') or diag explain($res);
+	is_deeply($m{'a-reply@miss'}->{kw}, ['draft'],
+		'set in thread hit') or diag explain($res);
 	lei_ok qw(q -tt m:testmessage@example.com --only), "$ro_home/t2";
 	$res = json_utf8->decode($lei_out);
 	is_deeply($res->[0]->{kw}, [ qw(flagged seen) ],

      parent reply	other threads:[~2021-03-25  4:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  4:20 [PATCH 00/10] lei testing improvements Eric Wong
2021-03-25  4:20 ` [PATCH 01/10] test_common: cleanup inbox objects after use Eric Wong
2021-03-25  4:20 ` [PATCH 02/10] lei: janky $PATH2CFG garbage collection Eric Wong
2021-03-25  4:20 ` [PATCH 03/10] test_common: TEST_LEI_ERR_LOUD does not hide path names Eric Wong
2021-03-25  4:20 ` [PATCH 04/10] lei add-external: do not initialize writable store Eric Wong
2021-03-25  4:20 ` [PATCH 05/10] lei_mirror: don't show success on failure Eric Wong
2021-03-25  4:20 ` [PATCH 06/10] t/*: drop unnecessary v1-specific index calls Eric Wong
2021-03-25  4:20 ` [PATCH 07/10] tests: "check-run" uses persistent lei daemon Eric Wong
2021-03-25  4:20 ` [PATCH 08/10] lei import: force store, improve test diagnostics Eric Wong
2021-03-25  4:20 ` [PATCH 09/10] t/cmd_ipc: workaround signal handling raciness Eric Wong
2021-03-25  4:20 ` Eric Wong [this message]

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

  List information: https://public-inbox.org/README

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

  git send-email \
    --in-reply-to=20210325042026.11270-11-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).