]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Tweak test_keepalived_respawns test logic
authorarmando-migliaccio <armamig@gmail.com>
Fri, 11 Sep 2015 04:54:33 +0000 (21:54 -0700)
committerarmando-migliaccio <armamig@gmail.com>
Sat, 12 Sep 2015 08:37:20 +0000 (01:37 -0700)
commit5405d9742b94f203389f555c56727a66925e9454
tree1ceb1fcaff71e369fe387c2aa8aaddf33b346799
parent0bc5c1ec4efce393a90cff5bd7b8ef10213f8f87
Tweak test_keepalived_respawns test logic

This test initial design is problematic: it spawns keepalived,
it asserts the process is up, then it attempts to kill it.

However, this is when problems may arise:

a) it does so by using the disable method on the process - we
   should be more rude than that if we want to simulate a crash!

b) keepalived may be forking while it is starting and it is
   possible that for a moment the ppid changes and the process
   owner invoking the kill has no rights to kill the spawned
   process. This is the most plausible explaination I could find
   as to why kill returns 1 with no standard error

c) it does not verify that the process has indeed disappeared
   (what if the pm.disable didn't work?) - this means that the
   test can pass, and yet the monitor may not work.

Bottom line: this test relied on the correctness of the very code
that was meant to validate...and that's not cool. To this aim, we
wait for the process to be active, kill the process with a kill -9
and verify that the process after the kill is indeed different.

Closes-bug: #1490043

Change-Id: Idaf419a1464d9d0d75b9106a7acd5cd960a7c623
neutron/tests/functional/agent/linux/test_keepalived.py