Bug#867361: sitesummary: Fix autopkgtest to work in environments with http_proxy set

2017-07-07 Thread Wolfgang Schweer
On Thu, Jul 06, 2017 at 11:58:13AM -0700, Steve Langasek wrote:
> On Thu, Jul 06, 2017 at 07:26:19AM +0200, Petter Reinholdtsen wrote:
> > [Steve Langasek]
> > > FWIW this does fix the problem with the test talking to the wrong server,
> > > but the test still fails as shown at
> > > .
> 
> > Hm, look like a race condition:
> 
> > autopkgtest [01:08:03]: test test-server-client: [---
> > /var/lib/sitesummary
> > /var/lib/sitesummary/tmpstorage
> > /var/lib/sitesummary/tmpstorage/127.0.0.1-2017-07-06T01:08:03-2349-sitesummary
> > /var/lib/sitesummary/tmpstorage/127.0.0.1-2017-07-06T01:08:03-2349-sitesummary.tar.gz
> > /var/lib/sitesummary/www
> > /var/lib/sitesummary/www/index.html
> > /var/lib/sitesummary/entries
> > error: did not find entry
> > info: terminating script
> > autopkgtest [01:08:04]: test test-server-client: ---]
> > 
> > It look like the server is still busy unpacking the submitted entry, and
> > have not yet had time to move the relevant files under entries/.
> 
> > Anyone got any idea how we can best avoid the race?  'sleep 10' seem
> > like such a crude solution...
> 
> Ah.  Seems to me like either a sleep or a poll are your only options.  I
> don't know how much processing sitesummary has to do, but maybe a one minute
> timeout on a poll would be reasonable?

There's not much to do, it's rather seconds than a minute; the overview 
page shows the test failing only randomly, times differ as well:

https://ci.debian.net/packages/s/sitesummary/unstable/amd64/

Wolfgang


signature.asc
Description: PGP signature


Bug#867361: sitesummary: Fix autopkgtest to work in environments with http_proxy set

2017-07-07 Thread Wolfgang Schweer
On Thu, Jul 06, 2017 at 07:26:19AM +0200, Petter Reinholdtsen wrote:
> 
> Hm, look like a race condition:
> 
> autopkgtest [01:08:03]: test test-server-client: [---
> /var/lib/sitesummary
> /var/lib/sitesummary/tmpstorage
> /var/lib/sitesummary/tmpstorage/127.0.0.1-2017-07-06T01:08:03-2349-sitesummary
> /var/lib/sitesummary/tmpstorage/127.0.0.1-2017-07-06T01:08:03-2349-sitesummary.tar.gz
> /var/lib/sitesummary/www
> /var/lib/sitesummary/www/index.html
> /var/lib/sitesummary/entries
> error: did not find entry
> info: terminating script
> autopkgtest [01:08:04]: test test-server-client: ---]
> 
> It look like the server is still busy unpacking the submitted entry, and
> have not yet had time to move the relevant files under entries/.
> 
> Anyone got any idea how we can best avoid the race?  'sleep 10' seem
> like such a crude solution...
 
The below one should work (even sleep 1 seems to be enough).

--- a/test-server-client2017-07-07 11:16:36.0 +0200
+++ b/test-server-client2017-07-07 12:16:17.406332996 +0200
@@ -26,6 +26,7 @@
 service apache2 restart
 
 sitesummary-client
+sleep 2
 
 find /var/lib/sitesummary
 

Wolfgang


signature.asc
Description: PGP signature


Bug#867361: sitesummary: Fix autopkgtest to work in environments with http_proxy set

2017-07-07 Thread Petter Reinholdtsen
[Wolfgang Schweer]
> The below one should work (even sleep 1 seems to be enough).

What about a loop looking for a file every 1 second, and exiting after X
seconds if no file is found.  It should handle more load while exiting
as quickly as possible.

-- 
Happy hacking
Petter Reinholdtsen



Bug#867361: sitesummary: Fix autopkgtest to work in environments with http_proxy set

2017-07-07 Thread Wolfgang Schweer
On Fri, Jul 07, 2017 at 01:19:17PM +0200, Petter Reinholdtsen wrote:
> What about a loop looking for a file every 1 second, and exiting after X
> seconds if no file is found.  It should handle more load while exiting
> as quickly as possible.
 
I guess something like this should work:

--- a/test-server-client2017-07-07 11:16:36.0 +0200
+++ b/test-server-client2017-07-07 15:21:45.881225852 +0200
@@ -29,9 +29,13 @@
 
 find /var/lib/sitesummary
 
-if find /var/lib/sitesummary | grep ether- ; then
-echo success: found entry
-else
-echo error: did not find entry
-exit 1
-fi
+for i in $(seq 0 10) ; do
+if find /var/lib/sitesummary | grep ether- ; then
+   echo success: found entry
+   exit 0
+fi
+sleep 1
+done
+
+echo error: did not find entry after waiting for 10 seconds.
+exit 1

Wolfgang


signature.asc
Description: PGP signature