ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Ivan Zakharyaschev <imz@altlinux.org>
To: devel@lists.altlinux.org
Cc: darktemplar@altlinux.org, ldv@altlinux.org
Subject: [devel] [APT PATCH] test/integration/framework/test-apt-method-http*: use nginx as a forking daemon
Date: Tue, 18 Feb 2020 06:39:01 +0300 (MSK)
Message-ID: <alpine.LFD.2.20.2002180632261.6363@imap.altlinux.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 4898 bytes --]

This is needed not to send requests to nginx before it is ready to
listen: when the main process forks and exits, nginx is considered to
be ready.

Without this change, I observed a failure in the http test, but not
the https one, probably, because the delay in the https test was
larger due to an extra package being built:

Run Testcase (22/29) test-apt-method-http
Building package: simple-package
Test for successful execution of apt-get update …
Err http://localhost x86_64 release
  Could not connect to localhost:8080 (127.0.0.1). - connect (111 Connection refused)

However:

Run Testcase (23/29) test-apt-method-https
Building package: simple-package
Building package: conflicting-package-one
Test for successful execution of apt-get update … PASS
Test that package(s) are not installed with rpm -q simple-package … PASS
Test for successful execution of apt-get install simple-package … PASS
Test that package(s) are installed with rpm -q simple-package … PASS
Pinning invalid key in apt
Test for failure in execution of apt-get update … PASS
Test that package(s) are not installed with rpm -q conflicting-package-one … PASS
Test for failure in execution of apt-get install conflicting-package-one … PASS
Test that package(s) are not installed with rpm -q conflicting-package-one … PASS
---
 test/integration/framework                                   | 2 --
 test/integration/test-apt-method-http                        | 5 +++--
 test/integration/test-apt-method-https                       | 5 +++--
 test/integration/test-apt-method-https-invalid-cert-hostname | 5 +++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/test/integration/framework b/test/integration/framework
index 5f0f58eda..eccfb174e 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -560,7 +560,6 @@ nginxsetuphttp() {
 cat >> $TMPWORKINGDIRECTORY/nginx/nginx.conf << ENDCONFIG
 worker_processes 1;
 error_log $TMPWORKINGDIRECTORY/nginx/error.log;
-daemon off;
 pid $TMPWORKINGDIRECTORY/nginx/nginx.pid;
 
 events {
@@ -606,7 +605,6 @@ nginxsetuphttps() {
 	cat >> $TMPWORKINGDIRECTORY/nginx/nginx.conf << ENDCONFIG
 worker_processes 1;
 error_log $TMPWORKINGDIRECTORY/nginx/error.log;
-daemon off;
 pid $TMPWORKINGDIRECTORY/nginx/nginx.pid;
 
 events {
diff --git a/test/integration/test-apt-method-http b/test/integration/test-apt-method-http
index 0872c99d4..d463a0d14 100755
--- a/test/integration/test-apt-method-http
+++ b/test/integration/test-apt-method-http
@@ -17,8 +17,9 @@ rpm http://localhost:8080/ $(getarchitecture) apt-tests
 rpm http://localhost:8080/ noarch apt-tests
 END
 
-/usr/sbin/nginx -c $TMPWORKINGDIRECTORY/nginx/nginx.conf -p $TMPWORKINGDIRECTORY &>> $TMPWORKINGDIRECTORY/nginx/process-stderr.log &
-NGINXPID=$!
+/usr/sbin/nginx -c $TMPWORKINGDIRECTORY/nginx/nginx.conf -p $TMPWORKINGDIRECTORY &>> $TMPWORKINGDIRECTORY/nginx/process-stderr.log
+NGINXPID="$(cat $TMPWORKINGDIRECTORY/nginx/nginx.pid)"
+[ -n "$NGINXPID" ]
 
 addtrap 'prefix' "kill -SIGTERM $NGINXPID; [ \"$EXIT_CODE\" = '0' ] || cat $TMPWORKINGDIRECTORY/nginx/process-stderr.log;"
 
diff --git a/test/integration/test-apt-method-https b/test/integration/test-apt-method-https
index 29e4d2d2b..4b2463a4c 100755
--- a/test/integration/test-apt-method-https
+++ b/test/integration/test-apt-method-https
@@ -30,8 +30,9 @@ rpm https://localhost:8080/ $(getarchitecture) apt-tests
 rpm https://localhost:8080/ noarch apt-tests
 END
 
-/usr/sbin/nginx -c $TMPWORKINGDIRECTORY/nginx/nginx.conf -p $TMPWORKINGDIRECTORY &>> $TMPWORKINGDIRECTORY/nginx/process-stderr.log &
-NGINXPID=$!
+/usr/sbin/nginx -c $TMPWORKINGDIRECTORY/nginx/nginx.conf -p $TMPWORKINGDIRECTORY &>> $TMPWORKINGDIRECTORY/nginx/process-stderr.log
+NGINXPID="$(cat $TMPWORKINGDIRECTORY/nginx/nginx.pid)"
+[ -n "$NGINXPID" ]
 
 addtrap 'prefix' "kill -SIGTERM $NGINXPID; [ \"$EXIT_CODE\" = '0' ] || cat $TMPWORKINGDIRECTORY/nginx/process-stderr.log;"
 
diff --git a/test/integration/test-apt-method-https-invalid-cert-hostname b/test/integration/test-apt-method-https-invalid-cert-hostname
index 33e80b613..b7b036bbd 100755
--- a/test/integration/test-apt-method-https-invalid-cert-hostname
+++ b/test/integration/test-apt-method-https-invalid-cert-hostname
@@ -29,8 +29,9 @@ rpm https://localhost:8080/ $(getarchitecture) apt-tests
 rpm https://localhost:8080/ noarch apt-tests
 END
 
-/usr/sbin/nginx -c $TMPWORKINGDIRECTORY/nginx/nginx.conf -p $TMPWORKINGDIRECTORY &>> $TMPWORKINGDIRECTORY/nginx/process-stderr.log &
-NGINXPID=$!
+/usr/sbin/nginx -c $TMPWORKINGDIRECTORY/nginx/nginx.conf -p $TMPWORKINGDIRECTORY &>> $TMPWORKINGDIRECTORY/nginx/process-stderr.log
+NGINXPID="$(cat $TMPWORKINGDIRECTORY/nginx/nginx.pid)"
+[ -n "$NGINXPID" ]
 
 addtrap 'prefix' "kill -SIGTERM $NGINXPID; [ \"$EXIT_CODE\" = '0' ] || cat $TMPWORKINGDIRECTORY/nginx/process-stderr.log;"
 
-- 
2.24.1


-- 
Best regards,
Ivan

             reply	other threads:[~2020-02-18  3:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18  3:39 Ivan Zakharyaschev [this message]
2020-02-18  8:03 ` Aleksei Nikiforov
2020-02-18 12:44   ` Ivan Zakharyaschev
2020-02-18 13:17     ` Aleksei Nikiforov
2020-02-18 13:41 ` Dmitry V. Levin
2020-02-18 14:12   ` Ivan Zakharyaschev
2020-02-18 14:28     ` Dmitry V. Levin
2020-02-18 14:47       ` Aleksei Nikiforov
2020-02-18 14:58         ` Dmitry V. Levin

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

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

  git send-email \
    --in-reply-to=alpine.LFD.2.20.2002180632261.6363@imap.altlinux.org \
    --to=imz@altlinux.org \
    --cc=darktemplar@altlinux.org \
    --cc=devel@lists.altlinux.org \
    --cc=ldv@altlinux.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

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git