pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Stephen Frost <sfrost@snowman.net>
Cc: vignesh C <vignesh21@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Euler Taveira <euler.taveira@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Log message for GSS connection is missing once connection authorization is successful.
Date: Sat, 20 Mar 2021 20:29:47 +0900
Message-ID: <YFXcq2vBTDGQVBNC@paquier.xyz> (raw)
In-Reply-To: <YFWzn+3YPSnmxCp/@paquier.xyz>
References: <CALj2ACV3EuuBQQ9JwhssUi44YJ-8Kqz7GhEgPf6YJTUG+pvEsA@mail.gmail.com>
	<CAH503wCgspPM2jFx9-ir4K9GQMHTYSbBdvKyScNGJkcRd=C0DQ@mail.gmail.com>
	<CALDaNm36xidovwu89ELA4fKaHVAocC0-HUtODrohjhfqRk0iJA@mail.gmail.com>
	<CALj2ACXgk3RogNaw7T7Beq43XpHXOtZwrdxDqqU3Pmy+DRr1pg@mail.gmail.com>
	<CAH503wC8v3TfgS=pp7wJsNHxi2A7KeNTQTdLA5b3Fwt6O2q=mw@mail.gmail.com>
	<CALj2ACWkGMf5GfwmVxnLWqmccEiTyW4RzAruzr_g_Vfz1faKYg@mail.gmail.com>
	<CALDaNm0mjD0V6eCz7qpnrHLdzk2VtdgBRitHVgma5CQwXc6xiw@mail.gmail.com>
	<20201127220136.GQ16415@tamriel.snowman.net>
	<20201202194430.GZ16415@tamriel.snowman.net>
	<YFWzn+3YPSnmxCp/@paquier.xyz>

On Sat, Mar 20, 2021 at 05:37:47PM +0900, Michael Paquier wrote:
> It seems to me that this would make the tests faster, that the test
> would not need to wait for the logging collector and that the code
> could just use slurp_file($node->logfile) to get the data it wants to
> check for a given pattern without looking at current_logfiles.  I also
> think that not using truncate() on the logfile generated has the
> disadvantage to make the code fuzzy for its verification once we
> introduce patterns close to each other, as there could easily be an
> overlap.  That's one problem that SQL pattern checks had to deal with
> in the past.  Thoughts?

And, in terms of code, this really simplifies things.  Please see the
attached that I would like to apply.
--
Michael

Attachments:

krb5-test-simplify.patch (text/x-diff, 1.7K) download diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl index 079321bbfc..38e9ef7b1f 100644 --- a/src/test/kerberos/t/001_auth.pl +++ b/src/test/kerberos/t/001_auth.pl @@ -20,7 +20,7 @@ use Time::HiRes qw(usleep); if ($ENV{with_gssapi} eq 'yes') { - plan tests => 34; + plan tests => 26; } else { @@ -170,10 +170,7 @@ $node->append_conf( 'postgresql.conf', qq{ listen_addresses = '$hostaddr' krb_server_keyfile = '$keytab' -logging_collector = on log_connections = on -# these ensure stability of test results: -log_rotation_age = 0 lc_messages = 'C' }); $node->start; @@ -212,29 +209,15 @@ sub test_access # Verify specified log message is logged in the log file. if ($expect_log_msg ne '') { - my $current_logfiles = slurp_file($node->data_dir . '/current_logfiles'); - note "current_logfiles = $current_logfiles"; - like($current_logfiles, qr|^stderr log/postgresql-.*log$|, - 'current_logfiles is sane'); - - my $lfname = $current_logfiles; - $lfname =~ s/^stderr //; - chomp $lfname; - - # might need to retry if logging collector process is slow... - my $max_attempts = 180 * 10; - my $first_logfile; - for (my $attempts = 0; $attempts < $max_attempts; $attempts++) - { - $first_logfile = slurp_file($node->data_dir . '/' . $lfname); - last if $first_logfile =~ m/\Q$expect_log_msg\E/; - usleep(100_000); - } + my $first_logfile = slurp_file($node->logfile); like($first_logfile, qr/\Q$expect_log_msg\E/, 'found expected log file content'); } + # Clean up any existing contents in the node's log file so as + # future tests don't step on each other's generated contents. + truncate $node->logfile, 0; return; }
signature.asc (application/pgp-signature, 832B) download

view thread (29+ messages)  latest in thread

Message-ID: <YFXcq2vBTDGQVBNC@paquier.xyz>
Permalink:  ../YFXcq2vBTDGQVBNC@paquier.xyz/
Also on:    postgresql.org/message-id/YFXcq2vBTDGQVBNC@paquier.xyz

 ·  · 

reply

Reply instructions:

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

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, sfrost@snowman.net, vignesh21@gmail.com, bharath.rupireddyforpostgres@gmail.com, euler.taveira@2ndquadrant.com
  Subject: Re: Log message for GSS connection is missing once connection authorization is successful.
  In-Reply-To: <YFXcq2vBTDGQVBNC@paquier.xyz>
  References: <CALj2ACV3EuuBQQ9JwhssUi44YJ-8Kqz7GhEgPf6YJTUG+pvEsA@mail.gmail.com> <CAH503wCgspPM2jFx9-ir4K9GQMHTYSbBdvKyScNGJkcRd=C0DQ@mail.gmail.com> <CALDaNm36xidovwu89ELA4fKaHVAocC0-HUtODrohjhfqRk0iJA@mail.gmail.com> <CALj2ACXgk3RogNaw7T7Beq43XpHXOtZwrdxDqqU3Pmy+DRr1pg@mail.gmail.com> <CAH503wC8v3TfgS=pp7wJsNHxi2A7KeNTQTdLA5b3Fwt6O2q=mw@mail.gmail.com> <CALj2ACWkGMf5GfwmVxnLWqmccEiTyW4RzAruzr_g_Vfz1faKYg@mail.gmail.com> <CALDaNm0mjD0V6eCz7qpnrHLdzk2VtdgBRitHVgma5CQwXc6xiw@mail.gmail.com> <20201127220136.GQ16415@tamriel.snowman.net> <20201202194430.GZ16415@tamriel.snowman.net> <YFWzn+3YPSnmxCp/@paquier.xyz> <YFXcq2vBTDGQVBNC@paquier.xyz>

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

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox