def testWithOpts(self): """ test calling createSlave() with --relocatable and --allow-shutdown options specified. """ options = self.options.copy() options["relocatable"] = True options["allow-shutdown"] = "signal" # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments options["allow-shutdown"] = "'signal'" expected_tac_contents = \ "".join(create_slave.slaveTACTemplate) % options self.assertMakeFunctionsCalls(self.options["basedir"], expected_tac_contents, options["quiet"]) # check that correct info message was printed self.assertStdoutEqual("buildslave configured in bdir\n")
def testWithOpts(self): """ test calling createSlave() with --relocatable and --allow-shutdown options specified. """ options = self.options.copy() options["relocatable"] = True options["allow-shutdown"] = "signal" # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments options["allow-shutdown"] = "'signal'" expected_tac_contents = \ "".join(create_slave.slaveTACTemplate) % options self.assertMakeFunctionsCalls(self.options["basedir"], expected_tac_contents, options["quiet"]) # check that correct info message was printed to the log self.assertLogged("buildslave configured in bdir")
def testCreateError(self): """ test that errors while creating buildslave directory are handled correctly by createSlave() """ # patch _make*() functions to raise an exception self.setUpMakeFunctions(create_slave.CreateSlaveError("err-msg")) # call createSlave() and check that we get error exit code self.assertEquals(create_slave.createSlave(self.options), 1, "unexpected exit code") # check that correct error message was printed the the log self.assertLogged("err-msg", "failed to configure buildslave in bdir")
def testCreateError(self): """ test that errors while creating buildslave directory are handled correctly by createSlave() """ # patch _make*() functions to raise an exception self.setUpMakeFunctions(create_slave.CreateSlaveError("err-msg")) # call createSlave() and check that we get error exit code self.assertEquals(create_slave.createSlave(self.options), 1, "unexpected exit code") # check that correct error message was printed the the log self.assertLogged("err-msg", "failed to configure buildslave in bdir")
def testMinArgs(self): """ test calling createSlave() with only required arguments """ # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(self.options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments expected_tac_contents = \ "".join(create_slave.slaveTACTemplate) % self.options self.assertMakeFunctionsCalls(self.options["basedir"], expected_tac_contents, self.options["quiet"]) # check that correct info message was printed to the log self.assertLogged("buildslave configured in bdir")
def testMinArgs(self): """ test calling createSlave() with only required arguments """ # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(self.options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments expected_tac_contents = \ "".join(create_slave.slaveTACTemplate) % self.options self.assertMakeFunctionsCalls(self.options["basedir"], expected_tac_contents, self.options["quiet"]) # check that correct info message was printed self.assertStdoutEqual("buildslave configured in bdir\n")
def testQuiet(self): """ test calling createSlave() with --quiet flag """ options = self.options.copy() options["quiet"] = True # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments expected_tac_contents = \ "".join(create_slave.slaveTACTemplate) % options self.assertMakeFunctionsCalls(options["basedir"], expected_tac_contents, options["quiet"]) # there should be no output on stdout self.assertWasQuiet()
def testQuiet(self): """ test calling createSlave() with --quiet flag """ options = self.options.copy() options["quiet"] = True # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments expected_tac_contents = \ "".join(create_slave.slaveTACTemplate) % options self.assertMakeFunctionsCalls(options["basedir"], expected_tac_contents, options["quiet"]) # there should be no output on stdout self.assertWasQuiet()
def testNoLogRotate(self): """ test that when --no-logrotate options is used, correct tac file is generated. """ options = self.options.copy() options["no-logrotate"] = True # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments expected_tac_contents = (create_slave.slaveTACTemplate[0] + create_slave.slaveTACTemplate[2]) % options self.assertMakeFunctionsCalls(self.options["basedir"], expected_tac_contents, self.options["quiet"]) # check that correct info message was printed to the log self.assertLogged("buildslave configured in bdir")
def testNoLogRotate(self): """ test that when --no-logrotate options is used, correct tac file is generated. """ options = self.options.copy() options["no-logrotate"] = True # patch _make*() functions to do nothing self.setUpMakeFunctions() # call createSlave() and check that we get success exit code self.assertEquals(create_slave.createSlave(options), 0, "unexpected exit code") # check _make*() functions were called with correct arguments expected_tac_contents = (create_slave.slaveTACTemplate[0] + create_slave.slaveTACTemplate[2]) % options self.assertMakeFunctionsCalls(self.options["basedir"], expected_tac_contents, self.options["quiet"]) # check that correct info message was printed self.assertStdoutEqual("buildslave configured in bdir\n")