class CartRpcOneNodeTest(Test): """ Runs basic CaRT RPC tests :avocado: tags=all,rpc,one_node """ def setUp(self): """ Test setup """ print("Running setup\n") self.utils = CartUtils() self.env = self.utils.get_env(self) def tearDown(self): """ Test tear down """ print("Run TearDown\n") def test_cart_rpc(self): """ Test CaRT RPC :avocado: tags=all,rpc,one_node """ urifile = self.utils.create_uri_file() srvcmd = self.utils.build_cmd(self, self.env, "srv", True, urifile) clicmd = self.utils.build_cmd(self, self.env, "cli", False, urifile) self.utils.launch_srv_cli_test(self, srvcmd, clicmd) self.utils.log_check(self)
class CartCtlOneNodeTest(Test): """ Runs basic CaRT ctl tests :avocado: tags=all,ctl,one_node """ def setUp(self): """ Test setup """ print("Running setup\n") self.utils = CartUtils() self.env = self.utils.get_env(self) def tearDown(self): """ Test tear down """ print("Run TearDown\n") def test_cart_ctl(self): """ Test CaRT ctl :avocado: tags=all,ctl,one_node """ urifile = self.utils.create_uri_file() srvcmd = self.utils.build_cmd(self, self.env, "srv", True, urifile) print("\nServer cmd : %s\n" % srvcmd) try: srv_rtn = self.utils.launch_cmd_bg(self, srvcmd) except Exception as e: print("Exception in launching server : {}".format(e)) self.fail("Test failed.\n") # Verify the server is still running. if not self.utils.check_process(srv_rtn): procrtn = self.utils.stop_process(srv_rtn) self.fail("Server did not launch, return code %s" \ % procrtn) clicmd = self.utils.build_cmd(self, self.env, "cli1", False, urifile) print("\nClient cmd : %s\n" % clicmd) self.utils.launch_test(self, clicmd, srv_rtn) clicmd = self.utils.build_cmd(self, self.env, "cli2", False, urifile) print("\nClient cmd : %s\n" % clicmd) self.utils.launch_test(self, clicmd, srv_rtn) clicmd = self.utils.build_cmd(self, self.env, "cli3", False, urifile) print("\nClient cmd : %s\n" % clicmd) self.utils.launch_test(self, clicmd, srv_rtn) clicmd = self.utils.build_cmd(self, self.env, "cli4", False, urifile) print("\nClient cmd : %s\n" % clicmd) self.utils.launch_test(self, clicmd, srv_rtn) clicmd = self.utils.build_cmd(self, self.env, "cli5", False, urifile) print("\nClient cmd : %s\n" % clicmd) self.utils.launch_test(self, clicmd, srv_rtn) clicmd = self.utils.build_cmd(self, self.env, "cli6", False, urifile) print("\nClient cmd : %s\n" % clicmd) self.utils.launch_test(self, clicmd, srv_rtn)
class CartSelfTwoNodeTest(Test): """ Runs basic CaRT self test :avocado: tags=all,selftest,two_node """ def setUp(self): """ Test setup """ print("Running setup\n") self.utils = CartUtils() self.env = self.utils.get_env(self) def tearDown(self): """ Test tear down """ print("Run TearDown\n") def test_cart_selftest(self): """ Test CaRT Self Test :avocado: tags=all,selftest,two_node """ urifile = self.utils.create_uri_file() srvcmd = self.utils.build_cmd(self, self.env, "srv", True, urifile) clicmd = self.utils.build_cmd(self, self.env, "cli", False, urifile) print("\nServer cmd : %s\n" % srvcmd) print("\nClient cmd : %s\n" % clicmd) srv_rtn = self.utils.launch_cmd_bg(self, srvcmd) # Verify the server is still running. if not self.utils.check_process(srv_rtn): procrtn = self.utils.stop_process(srv_rtn) self.fail("Server did not launch, return code %s" % procrtn) self.utils.launch_test(self, clicmd, srv_rtn) self.utils.stop_process(srv_rtn)
class CartGroupTiersThreeNodeTest(Test): """ Runs basic CaRT group tier tests :avocado: tags=all,group_tiers,three_node """ def setUp(self): """ Test setup """ print("Running setup\n") self.utils = CartUtils() self.env = self.utils.get_env(self) def tearDown(self): """ Test tear down """ print("Run TearDown\n") def test_group_tier(self): """ Test CaRT group_tier :avocado: tags=all,multi_tier,group_tiers,three_node """ urifile1 = self.utils.create_uri_file() srvcmd = self.utils.build_cmd(self, self.env, "srv1", True, urifile1) urifile2 = self.utils.create_uri_file() srv2cmd = self.utils.build_cmd(self, self.env, "srv2", True, urifile2) try: srv2_rtn = self.utils.launch_cmd_bg(self, srv2cmd) except Exception as e: self.utils.print("Exception in launching server : {}".format(e)) self.fail("Test failed.\n") time.sleep(8) try: srv_rtn = self.utils.launch_cmd_bg(self, srvcmd) except Exception as e: self.utils.print("Exception in launching server : {}".format(e)) self.fail("Test failed.\n") time.sleep(4) clicmd = self.utils.build_cmd(self, self.env, "cli1", False, urifile2) self.utils.launch_test(self, clicmd, srv_rtn, srv2_rtn) clicmd = self.utils.build_cmd(self, self.env, "cli2", False, urifile1) self.utils.launch_test(self, clicmd, srv_rtn, srv2_rtn) # Stop the server self.utils.print("Stopping server process 2 {}".format(srv2_rtn)) procrtn2 = self.utils.stop_process(srv2_rtn) self.utils.print("Stopping server process 1 {}".format(srv_rtn)) procrtn1 = self.utils.stop_process(srv_rtn) if procrtn2 or procrtn1: self.fail("Test failed. \ server 1 ret code {} \ server 2 ret code {}".format(procrtn1, procrtn2))
class CartSingletonTwoNodeTest(Test): """ Runs basic CaRT singleton tests :avocado: tags=all,singleton,two_node """ def setUp(self): """ Test setup """ print("Running setup\n") self.utils = CartUtils() self.env = self.utils.get_env(self) self.tempdir = tempfile.mkdtemp() os.environ["CRT_PHY_ADDR_STR"] = self.params.get("CRT_PHY_ADDR_STR", '/run/defaultENV/') os.environ["OFI_INTERFACE"] = self.params.get("OFI_INTERFACE", '/run/defaultENV/') os.environ["CRT_CTX_NUM"] = self.params.get("cli_CRT_CTX_NUM", '/run/defaultENV/') os.environ["CRT_CTX_SHARE_ADDR"] = self.params.get("CRT_CTX_SHARE_ADDR", '/run/env_CRT_CTX_SHARE_ADDR/*/') def tearDown(self): """ Test tear down """ print("Run TearDown\n") shutil.rmtree(self.tempdir) def test_cart_singleton(self): """ Test CaRT Singleton :avocado: tags=all,singleton,two_node """ urifile = self.utils.create_uri_file() srvcmd = self.utils.build_cmd(self, self.env, "srv", True, urifile) srvcmd += " -p {} -s".format(self.tempdir) try: srv_rtn = self.utils.launch_cmd_bg(self, srvcmd) except Exception as e: self.utils.print("Exception in launching server : {}".format(e)) self.fail("Test failed.\n") time.sleep(5) # Verify the server is still running. if not self.utils.check_process(srv_rtn): procrtn = self.utils.stop_process(srv_rtn) self.fail("Server did not launch, return code %s" \ % procrtn) clicmd = self.params.get("cli_bin", '/run/tests/*/') clicmd += " -p {} -s".format(self.tempdir) self.utils.launch_test(self, clicmd, srv_rtn) # Stop the server self.utils.print("Stopping server process {}".format(srv_rtn)) procrtn = self.utils.stop_process(srv_rtn) if procrtn: self.fail("Test failed. Server ret code {}".format(procrtn)) def test_multi_tier_singleton_attach(self): """ Test CaRT Multi_tier singleton attach test on two nodes :avocado: tags=all,singleton,multi_tier,two_node """ urifile = self.utils.create_uri_file() srvcmd = self.utils.build_cmd(self, self.env, "srv", True, urifile) srvcmd += " -p {} -s -m".format(self.tempdir) srv2_bin = self.params.get("srv2_bin", '/run/tests/*/') srv2_ctx = self.params.get("srv2_CRT_CTX_NUM", '/run/defaultENV/') srv2_hos = self.params.get("srv2", '/run/hosts/*/') srv2_ppn = self.params.get("srv2_ppn", '/run/tests/*/') hostfile = self.utils.write_host_file(srv2_hos, srv2_ppn) srvcmd += " : {} -x CRT_CTX_NUM={} -N {} --hostfile {} {}".format(self.env, srv2_ctx, srv2_ppn, hostfile, srv2_bin) try: srv_rtn = self.utils.launch_cmd_bg(self, srvcmd) except Exception as e: self.utils.print("Exception in launching server : {}".format(e)) self.fail("Test failed.\n") time.sleep(10) # Verify the server is still running. if not self.utils.check_process(srv_rtn): procrtn = self.utils.stop_process(srv_rtn) self.fail("Server did not launch, return code %s" \ % procrtn) clicmd = self.params.get("cli_bin", '/run/tests/*/') clicmd += " -p {} -s -m".format(self.tempdir) self.utils.launch_test(self, clicmd, srv_rtn) # Stop the server self.utils.print("Stopping server process {}".format(srv_rtn)) procrtn = self.utils.stop_process(srv_rtn) if procrtn: self.fail("Test failed. Server ret code {}".format(procrtn)) def test_multi_tier_without_singleton_attach(self): """ Test CaRT Multi_tier without singleton attach test on two nodes :avocado: tags=all,singleton,multi_tier,two_node """ urifile = self.utils.create_uri_file() srvcmd = self.utils.build_cmd(self, self.env, "srv", True, urifile) srvcmd += " -m" srv2cmd = self.utils.build_cmd(self, self.env, "srv2", False, urifile) try: srv_rtn = self.utils.launch_cmd_bg(self, srvcmd) except Exception as e: self.utils.print("Exception in launching server : {}".format(e)) self.fail("Test failed.\n") time.sleep(10) try: srv2_rtn = self.utils.launch_cmd_bg(self, srv2cmd) except Exception as e: self.utils.print("Exception in launching server : {}".format(e)) self.fail("Test failed.\n") # Verify the server is still running. if not self.utils.check_process(srv_rtn): procrtn = self.utils.stop_process(srv_rtn) self.fail("Server did not launch, return code %s" \ % procrtn) clicmd = self.utils.build_cmd(self, self.env, "cli", False, urifile) clicmd += " -m" self.utils.launch_test(self, clicmd, srv_rtn, srv2_rtn) # Stop the server self.utils.print("Stopping server process {}".format(srv_rtn)) procrtn1 = self.utils.stop_process(srv_rtn) self.utils.print("Stopping server process {}".format(srv2_rtn)) procrtn2 = self.utils.stop_process(srv2_rtn) if procrtn1 or procrtn2: self.fail("Test failed. \ Server ret code {} {}".format(procrtn1, procrtn2))