[MASSMAIL]LDAP & Kerberos test woes

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема [MASSMAIL]LDAP & Kerberos test woes
Дата
Msg-id fb898a70-3a88-4629-88e9-f2375020061d@iki.fi
обсуждение исходный текст
Ответы Re: LDAP & Kerberos test woes  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
While refactoring the Kerberos test module in preparation for adding 
libpq encryption negotiation tests [1], I noticed that if the test 
script die()s during setup, the whole test is marked as SKIPped rather 
than failed. The cleanup END section is missing this trick:

--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -203,7 +203,12 @@ system_or_bail $krb5kdc, '-P', $kdc_pidfile;

  END
  {
+       # take care not to change the script's exit value
+       my $exit_code = $?;
+
         kill 'INT', `cat $kdc_pidfile` if defined($kdc_pidfile) && -f 
$kdc_pidfile;
+
+       $? = $exit_code;
  }

The PostgreSQL::Cluster module got that right, but this test and the 
LdapServer module didn't get the memo.

After fixing that, the ldap tests started failing on my laptop:

[12:45:28.997](0.054s) # setting up LDAP server
# Checking port 59839
# Found port 59839
# Checking port 59840
# Found port 59840
# Running: /usr/sbin/slapd -f 
/home/heikki/git-sandbox/postgresql/build/testrun/ldap/001_auth/data/ldap-001_auth_j_WZ/slapd.conf 
-s0 -h ldap://localhost:59839 ldaps://localhost:59840
Can't exec "/usr/sbin/slapd": No such file or directory at 
/home/heikki/git-sandbox/postgresql/src/test/perl/PostgreSQL/Test/Utils.pm 
line 349.
[12:45:29.004](0.008s) Bail out!  command "/usr/sbin/slapd -f 
/home/heikki/git-sandbox/postgresql/build/testrun/ldap/001_auth/data/ldap-001_auth_j_WZ/slapd.conf 
-s0 -h ldap://localhost:59839 ldaps://localhost:59840" exited with value 2

That's because I don't have 'slapd' installed. The test script it 
supposed to check for that, and mark the test as SKIPped, but it's not 
really doing that on Linux. Attached patch fixes that, and also makes 
the error message a bit more precise, when the OpenLDAP installation is 
not found.

There's a lot more we could do with that code that tries to find the 
OpenLDAP installation. It should probably be a configure/meson test. 
This patch is just the minimum to keep this working after fixing the END 
block.

1st patch fixes the LDAP setup tests, and 2nd patch fixes the error 
handling in the END blocks.

[1] https://commitfest.postgresql.org/47/4742/

-- 
Heikki Linnakangas
Neon (https://neon.tech)
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: John Naylor
Дата:
Сообщение: Re: Add bump memory context type and use it for tuplesorts
Следующее
От: Tender Wang
Дата:
Сообщение: Re: Can't find not null constraint, but \d+ shows that