Integration testing of Node and Engine

For a while we’ve got the Engine Appliance around for the hosted-engine use-case. With this commit this appliance is now also leveraged to do integration testing.

How does it work? Take the Engine appliance, an additional Node appliance, put them in libvirt user session VMs, connect them using a UDP multicast group, configure them with cloud-init, and finally use ssh to director them.

At the bottom this is quite nice, because all of this fit’s into neat python-ish unittest like this one:

  28 class TestIntegrationSanity(IntegrationTestCase):
  29     """Basic integration testing between Node and Engine
  30 
  31     Add a host, add storage, and spawn a disk-less VM.
  32 
  33     Any testcase involving one Node and one Engine should go
  34     here.
  35     """
  36     def test_add_host(self):
  37         """Create and add a host and wait for it to come up
  38         """
  39         nodename = "node-host"
  40 
  41         self.engine_shell(("add host --name {nodename} --address 10.11.12.77 "
  42                            "--root_password 77 --cluster-name Default"
  43                            ).format(nodename=nodename))
  44 
  45         debug("Check that the host is now recognized")
  46         self.assertTrue(nodename in self.engine_shell("list hosts"))
  47 
  48         debug("Check that the host is getting up")
  49         self.engine_shell_wait(nodename, "list hosts --query 'status=up'")

A lot is going on in the background to enable this. The main features (makeing it distinct from previous approaches) are:

  • Completely in user sessions, no root privileges required
  • Clean test environment per testcase by leveraging snapshots

What is also important? A few test cases seem redundant, i.e. there are test cases to check that SSH is working, or snapshots are working correct. The redundancy is there to make it much easier to find regressions. It is much more complicated to find the root cause of a failure if you only got a single high-level test-case. By adding several smaller ones (for the building blocks of the high-level test-case), it should become more obvious what the cause for a failure is.

::: {#footer} [ November 10th, 2015 5:08pm ]{#timestamp} [ovirt]{.tag} [ci]{.tag} [node]{.tag} [engine]{.tag} :::