Merge lp:~yolanda.robla/ubuntu/saucy/squid3/fix-squid3-startstop into lp:ubuntu/saucy/squid3

Proposed by Yolanda Robla
Status: Merged
Merged at revision: 47
Proposed branch: lp:~yolanda.robla/ubuntu/saucy/squid3/fix-squid3-startstop
Merge into: lp:ubuntu/saucy/squid3
Diff against target: 77 lines (+27/-8)
3 files modified
debian/changelog (+6/-0)
debian/tests/test-squid.py (+1/-1)
debian/tests/testlib_httpd.py (+20/-7)
To merge this branch: bzr merge lp:~yolanda.robla/ubuntu/saucy/squid3/fix-squid3-startstop
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+167804@code.launchpad.net

Description of the change

Fix squid3 start/stop

To post a comment you must log in.
47. By Yolanda Robla

debian/tests: modified start/stop squid3

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks that fixes the tests indeed. However, I spotted this:

53 + # check if process is running
54 + rc, pidof = testlib.cmd(['pidof', '-x', self.initscript])

The init.d script will only actuall run for a very brief period of time, and the upstart script will never run at all. Doesn't this want to check "pidof squid" or something like that, i. e. check for the actual daemon?

32 def _start(self):
33 '''Start httpd'''

That looks like a copy&paste error, same in _stop(). Can you please adjust the docstring to avoid confusion? Or is that really apache, and the changelog should say "apache", not "squid"?

48. By Yolanda Robla

fixes in start/stop

Revision history for this message
Yolanda Robla (yolanda.robla) wrote :

pushed new revision, recheck

Revision history for this message
Martin Pitt (pitti) wrote :

Looks good, thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-05-27 12:50:14 +0000
3+++ debian/changelog 2013-06-07 09:47:20 +0000
4@@ -1,3 +1,9 @@
5+squid3 (3.1.20-1ubuntu6) UNRELEASED; urgency=low
6+
7+ * debian/tests: modified start/stop squid3
8+
9+ -- Yolanda Robla <yolanda.robla@canonical.com> Thu, 06 Jun 2013 18:21:48 +0200
10+
11 squid3 (3.1.20-1ubuntu5) saucy; urgency=low
12
13 * debian/rules: fix FTBFS, removed --with-cppunit-basedir flag
14
15=== modified file 'debian/tests/test-squid.py'
16--- debian/tests/test-squid.py 2013-05-24 10:56:53 +0000
17+++ debian/tests/test-squid.py 2013-06-07 09:47:20 +0000
18@@ -95,7 +95,7 @@
19
20 self._set_initscript("/etc/init.d/squid")
21 if self.lsb_release['Release'] >= 12.04:
22- self._set_initscript("/etc/init.d/squid3")
23+ self._set_initscript("squid3")
24
25 testlib_httpd.HttpdCommon._setUp(self)
26
27
28=== modified file 'debian/tests/testlib_httpd.py'
29--- debian/tests/testlib_httpd.py 2013-05-24 10:56:53 +0000
30+++ debian/tests/testlib_httpd.py 2013-06-07 09:47:20 +0000
31@@ -47,7 +47,7 @@
32 self.access_log = "/var/log/apache2/access.log"
33 self.error_log = "/var/log/apache2/error.log"
34 if not hasattr(self, 'initscript'):
35- self._set_initscript("/etc/init.d/apache2")
36+ self._set_initscript("apache2")
37
38 # Dapper's apache2 is disabled by default
39 if self.lsb_release['Release'] == 6.06:
40@@ -83,18 +83,31 @@
41 testlib.config_restore(self.apache2_default)
42
43 def _start(self):
44- '''Start httpd'''
45- #print self.initscript,"start"
46- rc, report = testlib.cmd([self.initscript, 'start'])
47+ '''Start process'''
48+ # check if there is a /etc/init/initscript.conf
49+ if os.path.exists("/etc/init/%s.conf" % self.initscript):
50+ rc, report = testlib.cmd(['start', self.initscript])
51+ else:
52+ rc, report = testlib.cmd(["/etc/init.d/%s" % self.initscript, 'start'])
53+
54 expected = 0
55 result = 'Got exit code %d, expected %d\n' % (rc, expected)
56 self.assertEquals(expected, rc, result + report)
57 time.sleep(2)
58
59 def _stop(self):
60- '''Stop httpd'''
61- #print self.initscript,"stop"
62- rc, report = testlib.cmd([self.initscript, 'stop'])
63+ '''Stop process'''
64+ # check if process is running
65+ if os.path.exists("/etc/init/%s.conf" % self.initscript):
66+ rc, pidof = testlib.cmd(['pidof', '-x', self.initscript])
67+ if pidof:
68+ rc, report = testlib.cmd(['stop', self.initscript])
69+ else:
70+ # no need to stop it, it's stopped
71+ rc, report = (0, '')
72+ else:
73+ rc, report = testlib.cmd([self.initscript, 'stop'])
74+
75 expected = 0
76 result = 'Got exit code %d, expected %d\n' % (rc, expected)
77 self.assertEquals(expected, rc, result + report)

Subscribers

People subscribed via source and target branches

to all changes: