[DRE-maint] Bug#798618: chef-client: autopkgtest race condition

Martin Pitt martin.pitt at ubuntu.com
Fri Sep 11 04:17:22 UTC 2015


Package: chef
Version: 12.3.0-2
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch wily

Hello,

chef's "init" autopkgtest fails frequently under systemd:

   http://autopkgtest.ubuntu.com/packages/c/chef/wily/amd64/

unfortunately the test doesn't give any extra information on failure:

  test_initscript_starts_stops
  ASSERT:

I made the test more verbose, turns out that the pgrep matches too broadly:

  test_initscript_starts_stops
  ASSERT:chef-client still running after stop: 7543 /lib/systemd/systemd-cgroups-agent /system.slice/chef-client.service

Attached patch fixes this.

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
diff -Nru chef-12.3.0/debian/changelog chef-12.3.0/debian/changelog
--- chef-12.3.0/debian/changelog	2015-08-25 21:56:21.000000000 +0200
+++ chef-12.3.0/debian/changelog	2015-09-11 06:15:52.000000000 +0200
@@ -1,3 +1,10 @@
+chef (12.3.0-2ubuntu1) wily; urgency=medium
+
+  * debian/tests/init: Be more verbose on failure, and tighten the pgrep to
+    avoid catching "systemd-cgroups-agent chef-client.service" after stopping.
+
+ -- Martin Pitt <martin.pitt at ubuntu.com>  Fri, 11 Sep 2015 06:14:52 +0200
+
 chef (12.3.0-2) unstable; urgency=medium
 
   * Fix installation of initscript and /etc/default file
diff -Nru chef-12.3.0/debian/tests/init chef-12.3.0/debian/tests/init
--- chef-12.3.0/debian/tests/init	2015-08-25 21:56:21.000000000 +0200
+++ chef-12.3.0/debian/tests/init	2015-09-11 06:14:47.000000000 +0200
@@ -2,9 +2,11 @@
 
 test_initscript_starts_stops() {
   service chef-client stop
-  assertFalse 'pgrep -fa chef-client'
+  if ps=$(pgrep -fa bin/chef-client); then
+    fail "chef-client still running after stop: $ps"
+  fi
   service chef-client start
-  assertTrue 'pgrep -fa chef-client'
+  assertTrue 'chef-client not running after start' 'pgrep -fa bin/chef-client'
 }
 
 . shunit2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20150911/b86e4c07/attachment.sig>


More information about the Pkg-ruby-extras-maintainers mailing list