Merge ~ahasenack/ubuntu/+source/curl:mantic-curl-slapd-dep8-test into ubuntu/+source/curl:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 123485c754bfc1f438b27673bdba0fa9d63687d3
Proposed branch: ~ahasenack/ubuntu/+source/curl:mantic-curl-slapd-dep8-test
Merge into: ubuntu/+source/curl:ubuntu/devel
Diff against target: 85 lines (+43/-6)
4 files modified
debian/changelog (+7/-0)
debian/tests/LDAP-bindata.c (+11/-5)
debian/tests/control (+1/-1)
debian/tests/curl-ldapi-test (+24/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Bryce Harrington (community) Approve
Canonical Server Reporter Pending
Review via email: mp+448832@code.launchpad.net

Description of the change

ppc64el and s390x were failing constantly in the infrastructure[1], but not in real machines (I tried ppc64el). On a hunch, I thought it could be because slapd is restarted and right afterwards the test begins, and there might not be enough time for slapd to be ready, so I added this counter.

The DEP8 tests take a long time. I have a PPA run with a slightly older version than this MP, but the changes should be insignificant (s/stdout/stderr/ in the fprintf I added, and I moved counter++ up to before that print).

The tests pass now, and the log shows at least one retry was needed:

  3962s ldapi:// connection failed, retrying (count=0)

ppa: https://launchpad.net/~ahasenack/+archive/ubuntu/plusoneweek/+packages

1. https://autopkgtest.ubuntu.com/results/autopkgtest-mantic/mantic/ppc64el/c/curl/20230806_154319_0bb08@/log.gz

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I used fprintf instead of ldap_perror() because of the format string I wanted to add (count=%d) ;)

Revision history for this message
Bryce Harrington (bryce) wrote :

Looks good, the addition of the retry logic with sleep(1) makes sense. The cleanup() logic for printing out extra debug info is a good practice that I bet would be good to spread to other dep8 tests.

Anyway, LGTM, +1.

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks! Uploaded with rich history:

Uploading curl_8.2.1-1ubuntu2.dsc
Uploading curl_8.2.1-1ubuntu2.debian.tar.xz
Uploading curl_8.2.1-1ubuntu2_source.buildinfo
Uploading curl_8.2.1-1ubuntu2_source.changes

Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: ahasenack, bryce
Uploaders: ahasenack, bryce
MP auto-approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 365b14c..51fa734 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+curl (8.2.1-1ubuntu2) mantic; urgency=medium
7+
8+ * d/t/control, d/t/curl-ldapi-test: move test-command to an actual
9+ test script and add a retry logic (LP: #2030911)
10+
11+ -- Andreas Hasenack <andreas@canonical.com> Wed, 09 Aug 2023 17:10:40 -0300
12+
13 curl (8.2.1-1ubuntu1) mantic; urgency=low
14
15 * Merge from Debian unstable. Remaining changes:
16diff --git a/debian/tests/LDAP-bindata.c b/debian/tests/LDAP-bindata.c
17index 2e6469c..69ec53c 100644
18--- a/debian/tests/LDAP-bindata.c
19+++ b/debian/tests/LDAP-bindata.c
20@@ -117,12 +117,18 @@ int main(void) {
21 ldap_perror(p, "Failed to initialize libldap");
22 exit(EXIT_FAILURE);
23 }
24- if(p = ldap_connect(ldp)) {
25- ldap_perror(p, "Failed to connect to slapd over UNIX domain socket");
26- if(p = ldap_unbind_ext(ldp, NULL, NULL)) {
27- ldap_perror(p, "Failed to deinitialize libldap");
28+ unsigned int counter = 0;
29+ while (p = ldap_connect(ldp)) {
30+ counter++;
31+ fprintf(stderr, "ldapi:// connection failed, retrying (count=%d)\n", counter);
32+ if (counter >= 10) {
33+ ldap_perror(p, "Failed to connect to slapd over UNIX domain socket");
34+ if (p = ldap_unbind_ext(ldp, NULL, NULL)) {
35+ ldap_perror(p, "Failed to deinitialize libldap");
36+ }
37+ exit(EXIT_FAILURE);
38 }
39- exit(EXIT_FAILURE);
40+ sleep(1);
41 }
42 if(p = ldap_sasl_bind_s(ldp, u8"CN=admin,DC=example,DC=com", LDAP_SASL_SIMPLE, &(struct berval){.bv_len = strlen(u8"Password"), .bv_val = u8"Password"}, NULL, NULL, NULL)) {
43 ldap_perror(p, "Failed to bind to directory server");
44diff --git a/debian/tests/control b/debian/tests/control
45index de9e1b9..c4974e1 100644
46--- a/debian/tests/control
47+++ b/debian/tests/control
48@@ -10,6 +10,6 @@ Tests: upstream-tests-nss
49 Depends: @builddeps@
50 Restrictions: allow-stderr
51
52-Test-Command: gcc debian/tests/LDAP-bindata.c $(pkgconf --cflags --libs ldap libcurl) -o "$AUTOPKGTEST_TMP"/ldap-test && "$AUTOPKGTEST_TMP"/ldap-test
53+Tests: curl-ldapi-test
54 Depends: gcc, libc-dev, libcurl4-openssl-dev | libcurl-dev, libldap-dev, slapd, pkgconf
55 Restrictions: allow-stderr, isolation-container, needs-root
56diff --git a/debian/tests/curl-ldapi-test b/debian/tests/curl-ldapi-test
57new file mode 100644
58index 0000000..4455431
59--- /dev/null
60+++ b/debian/tests/curl-ldapi-test
61@@ -0,0 +1,24 @@
62+#!/bin/sh
63+
64+set -e
65+
66+cleanup() {
67+ if [ $? -ne 0 ]; then
68+ set +e
69+ echo "## Something failed, gathering logs"
70+ echo
71+ echo "## syslog"
72+ tail -n 50 /var/log/syslog
73+ echo
74+ echo "## slapd journal"
75+ journalctl -u slapd
76+ fi
77+}
78+
79+trap cleanup EXIT
80+
81+echo "## Building ldap-test app"
82+gcc debian/tests/LDAP-bindata.c $(pkgconf --cflags --libs ldap libcurl) -o "$AUTOPKGTEST_TMP"/ldap-test
83+
84+echo "## calling ldap-test"
85+"$AUTOPKGTEST_TMP"/ldap-test

Subscribers

People subscribed via source and target branches