Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit11e1577

Browse files
committed
Simplify TAP tests of kerberos with expected log file contents
The TAP tests of kerberos rely on the logs generated by the backend tocheck various connection scenarios. In order to make sure that a giventest does not overlap with the log contents generated by a previoustest, the test suite relied on a logic with the logging collector and arotation of the log files to ensure the uniqueness of the log generatedwith a wait phase.Parsing the log contents for expected patterns is a problem that hasbeen solved in a simpler way by PostgresNode::issues_sql_like() wherethe log file is truncated before checking for the contents generated,with the backend sending its output to a log file given by pg_ctlinstead. This commit switches the kerberos test suite to use such amethod, removing any wait phase and simplifying the whole logic,resulting in less code. If a failure happens in the tests, the contentsof the logs are still showed to the user at the moment of the failurethanks to like(), so this has no impact on debugging capabilities.I have bumped into this issue while reviewing a different patch setaiming at extending the kerberos test suite to check for multiplelog patterns instead of one now.Author: Michael PaquierReviewed-by: Stephen Frost, Bharath RupireddyDiscussion:https://postgr.es/m/YFXcq2vBTDGQVBNC@paquier.xyz
1 parent595b9cb commit11e1577

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

‎src/test/kerberos/t/001_auth.pl

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
if ($ENV{with_gssapi}eq'yes')
2222
{
23-
plantests=>34;
23+
plantests=>26;
2424
}
2525
else
2626
{
@@ -170,10 +170,7 @@ END
170170
'postgresql.conf',qq{
171171
listen_addresses = '$hostaddr'
172172
krb_server_keyfile = '$keytab'
173-
logging_collector = on
174173
log_connections = on
175-
# these ensure stability of test results:
176-
log_rotation_age = 0
177174
lc_messages = 'C'
178175
});
179176
$node->start;
@@ -212,29 +209,15 @@ sub test_access
212209
# Verify specified log message is logged in the log file.
213210
if ($expect_log_msgne'')
214211
{
215-
my$current_logfiles = slurp_file($node->data_dir .'/current_logfiles');
216-
note"current_logfiles =$current_logfiles";
217-
like($current_logfiles,qr|^stderr log/postgresql-.*log$|,
218-
'current_logfiles is sane');
219-
220-
my$lfname =$current_logfiles;
221-
$lfname =~s/^stderr//;
222-
chomp$lfname;
223-
224-
# might need to retry if logging collector process is slow...
225-
my$max_attempts = 180 * 10;
226-
my$first_logfile;
227-
for (my$attempts = 0;$attempts <$max_attempts;$attempts++)
228-
{
229-
$first_logfile = slurp_file($node->data_dir .'/' .$lfname);
230-
lastif$first_logfile =~m/\Q$expect_log_msg\E/;
231-
usleep(100_000);
232-
}
212+
my$first_logfile = slurp_file($node->logfile);
233213

234214
like($first_logfile,qr/\Q$expect_log_msg\E/,
235215
'found expected log file content');
236216
}
237217

218+
# Clean up any existing contents in the node's log file so as
219+
# future tests don't step on each other's generated contents.
220+
truncate$node->logfile, 0;
238221
return;
239222
}
240223

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp