示例#1
0
 def test_023_MYS_763_getCluster(self):
     '''MYS-763 [MYAA] dba.getCluster([name][, options])'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3322"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.deploySandboxInstance(" + instance + ", { sandboxDir: \"" + cluster_Path + "\"});\n",
                'Please enter a MySQL root password for the new instance:'),
               (LOCALHOST.password + '\n',
                "Instance localhost:" + instance + " successfully deployed and started."),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     try:
         if results.find(bytearray("FAIL", "ascii"), 0, len(results)) > -1:
             self.assertEqual(results, 'PASS')
     except Exception as ex:
             self.assertEqual('FAIL', 'PASS')
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--mysql']
     x_cmds = [("dba.createCluster(\"Cluster2\", {\"clusterAdminType\": \"local\"});\n", "<Cluster:Cluster2>"),
               ("dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_023_MYS_763_getCluster(self):
     '''MYS-763 [MYAA] dba.getCluster([name][, options])'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3322"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.deploySandboxInstance(" + instance + ", { sandboxDir: \"" + cluster_Path + "\"});\n",
                'Please enter a MySQL root password for the new instance:'),
               (LOCALHOST.password + '\n',
                "Instance localhost:" + instance + " successfully deployed and started."),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     try:
         if results.find(bytearray("FAIL", "ascii"), 0, len(results)) > -1:
             self.assertEqual(results, 'PASS')
     except Exception as ex:
             self.assertEqual('FAIL', 'PASS')
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--classic']
     x_cmds = [("dba.createCluster(\"Cluster2\", {\"clusterAdminType\": \"local\"});\n", "<Cluster:Cluster2>"),
               ("dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#3
0
  def test_025_MYS_767_cluster_addInstance_UC3(self):
      '''MYS-767 [MYAA] clust.addInstance with valid values and with an instance not available'''
      logger.debug("--------- " + str(self._testMethodName) + " ---------")
      ################################ deploySandboxInstance 3312  #####################################################
      instance1 = "3322"
      ################################ deploySandboxInstance 3313  #####################################################
      instance2 = "3323"
      results = ''
      init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
      x_cmds = [("dba.deploySandboxInstance(" + instance2 + ", { sandboxDir: \"" + cluster_Path + "\"});\n",
                 'Please enter a MySQL root password for the new instance:'),
                (LOCALHOST.password + '\n',
                 "Instance localhost:" + instance2 + " successfully deployed and started."),
                ]
      results = exec_xshell_commands(init_command, x_cmds)
      try:
          if results.find(bytearray("FAIL", "ascii"), 0, len(results)) > -1:
              self.assertEqual(results, 'PASS')
      except Exception as ex:
              self.assertEqual('FAIL', 'PASS')
      #################################### createCluster  #################################################
      results = ''
      init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance1, '--mysql']
      x_cmds = [("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
                ("cluster.addInstance( \"{0}:{1}@{2}:".format(LOCALHOST.user, LOCALHOST.password,
                                                              LOCALHOST.host) + instance2 + "\");\n",
                 "was successfully added to the cluster"),
                ("cluster.addInstance( \"{0}:{1}@{2}:3399\");\n".format(LOCALHOST.user, LOCALHOST.password,
                                                                        LOCALHOST.host),
                 "Can't connect to MySQL server on")

                ]
      results = exec_xshell_commands(init_command, x_cmds)
      self.assertEqual(results, 'PASS')
示例#4
0
 def test_026_MYS_769_cluster_removeInstance(self):
     '''Add instance to a cluster, then remove instance, use sandboxDir parameter'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3322"
     ################################ deploySandboxInstance 3313  #####################################################
     instance2 = "3323"
     ################################# deploySandboxInstance 3314  ###################################################
     instance3 = "3324"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.deploySandboxInstance(" + instance3 + ", { sandboxDir: \"" + cluster_Path + "\"});\n",
                'Please enter a MySQL root password for the new instance:'),
               (LOCALHOST.password + '\n',
                "Instance localhost:" + instance3 + " successfully deployed and started."),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     try:
         if results.find(bytearray("FAIL", "ascii"), 0, len(results)) > -1:
             self.assertEqual(results, 'PASS')
     except Exception as ex:
             self.assertEqual('FAIL', 'PASS')
     #################################### createCluster  #################################################
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance1, '--mysql']
     x_cmds = [("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
               ("cluster.addInstance( \"{0}:{1}@{2}:".format(LOCALHOST.user, LOCALHOST.password,
                                                             LOCALHOST.host) + instance3 + "\");\n",
                "was successfully added to the cluster"),
               ("cluster.removeInstance(\"{0}:".format(LOCALHOST.host) + instance1 + "\");\n",
                "was successfully removed from the cluster.")
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_028_MYS_850(self):
     '''[MYS-850] Cluster.status output is mixed up, kind of nested and not easily readable'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance4 = "3322"
     instance5 = "3323"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P ' + instance5, '--mysql'
     ]
     x_cmds = [
         ("dba.verbose=2\n", "2"),
         ("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
         ("cluster.addInstance(\"{0}:{1}@{2}:".format(
             LOCALHOST.user, LOCALHOST.password, LOCALHOST.host) +
          instance4 + "\");\n", "was successfully added to the cluster")
     ]
     time.sleep(10)
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
     time.sleep(10)
     # cluster.status() display recovering for some added instances, require some time to set it to ONLINE
     x_cmds = [
         ("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
         ("cluster.status()\n",
          "{" + os.linesep + "    \"clusterName\": \"Cluster2\", " +
          os.linesep + "    \"defaultReplicaSet\": {" + os.linesep +
          "        \"name\": \"default\", " + os.linesep +
          "        \"primary\": \"localhost:3323\", " + os.linesep +
          "        \"status\": \"OK\", " + os.linesep +
          "        \"statusText\": \"Cluster is ONLINE and can tolerate up to ONE failure.\", "
          + os.linesep + "        \"topology\": {" + os.linesep +
          "            \"localhost:3322\": {" + os.linesep +
          "                \"address\": \"localhost:3322\", " + os.linesep +
          "                \"mode\": \"R/O\", " + os.linesep +
          "                \"readReplicas\": {}, " + os.linesep +
          "                \"role\": \"HA\", " + os.linesep +
          "                \"status\": \"ONLINE\"" + os.linesep +
          "            }, " + os.linesep +
          "            \"localhost:3323\": {" + os.linesep +
          "                \"address\": \"localhost:3323\", " + os.linesep +
          "                \"mode\": \"R/W\", " + os.linesep +
          "                \"readReplicas\": {}, " + os.linesep +
          "                \"role\": \"HA\", " + os.linesep +
          "                \"status\": \"ONLINE\"" + os.linesep +
          "            }, " + os.linesep +
          "            \"localhost:3324\": {" + os.linesep +
          "                \"address\": \"localhost:3324\", " + os.linesep +
          "                \"mode\": \"R/O\", " + os.linesep +
          "                \"readReplicas\": {}, " + os.linesep +
          "                \"role\": \"HA\", " + os.linesep +
          "                \"status\": \"ONLINE\"" + os.linesep +
          "            }" + os.linesep + "        }" + os.linesep +
          "    }" + os.linesep + "}" + os.linesep)
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#6
0
 def test_028_MYS_850(self):
     '''[MYS-850] Cluster.status output is mixed up, kind of nested and not easily readable'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance4 = "3322"
     instance5 = "3323"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P ' + instance5, '--mysql']
     x_cmds = [("dba.verbose=2\n","2"),
               ("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
               ("cluster.addInstance(\"{0}:{1}@{2}:".format(LOCALHOST.user, LOCALHOST.password,
                                                            LOCALHOST.host) + instance4 + "\");\n",
                "was successfully added to the cluster")]
     time.sleep(10)
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
     time.sleep(10)
     # cluster.status() display recovering for some added instances, require some time to set it to ONLINE
     x_cmds = [("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
               ("cluster.status()\n",
                "{" + os.linesep +
                "    \"clusterName\": \"Cluster2\", " + os.linesep +
                "    \"defaultReplicaSet\": {" + os.linesep +
                "        \"name\": \"default\", " + os.linesep +
                "        \"primary\": \"localhost:3323\", " + os.linesep +
                "        \"status\": \"OK\", " + os.linesep +
                "        \"statusText\": \"Cluster is ONLINE and can tolerate up to ONE failure.\", " + os.linesep +
                "        \"topology\": {" + os.linesep +
                "            \"localhost:3322\": {" + os.linesep +
                "                \"address\": \"localhost:3322\", " + os.linesep +
                "                \"mode\": \"R/O\", " + os.linesep +
                "                \"readReplicas\": {}, " + os.linesep +
                "                \"role\": \"HA\", " + os.linesep +
                "                \"status\": \"ONLINE\"" + os.linesep +
                "            }, " + os.linesep +
                "            \"localhost:3323\": {" + os.linesep +
                "                \"address\": \"localhost:3323\", " + os.linesep +
                "                \"mode\": \"R/W\", " + os.linesep +
                "                \"readReplicas\": {}, " + os.linesep +
                "                \"role\": \"HA\", " + os.linesep +
                "                \"status\": \"ONLINE\"" + os.linesep +
                "            }, " + os.linesep +
                "            \"localhost:3324\": {" + os.linesep +
                "                \"address\": \"localhost:3324\", " + os.linesep +
                "                \"mode\": \"R/O\", " + os.linesep +
                "                \"readReplicas\": {}, " + os.linesep +
                "                \"role\": \"HA\", " + os.linesep +
                "                \"status\": \"ONLINE\"" + os.linesep +
                "            }" + os.linesep +
                "        }" + os.linesep +
                "    }" + os.linesep +
                "}" + os.linesep )]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_021_MYS_774(self):
     '''NGSHELL CRASHES WHEN DBA.GETCLUSTER WITHOUT A CLUSTER SETUP'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3312"
     results = 'PASS'
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("\connect root:" + LOCALHOST.password + "@localhost:" +
          instance1 + "\n",
          'Classic Session successfully established. No default schema selected.'
          ),
         ("myCluster = dba.getCluster(\"Cluster1\")\n",
          "<Cluster:Cluster1>"),
         ("myCluster.dissolve({force: true})\n",
          "The cluster was successfully dissolved"),
         ("myCluster.status()\n",
          "Cluster.status: This function is not available through a session to a standalone instance"
          ),
         ("cluster = dba.getCluster()\n",
          "Dba.getCluster: This function is not available through a session to a standalone instance"
          )
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#8
0
 def test_036_MYS_756_killSandboxInstance(self):
     '''MYS-756 [MYAA] dba.killLocalInstance(port[, options])'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3314"
     instance2 = "3323"
     instance3 = "3324"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("dba.killSandboxInstance(" + instance1 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n", "successfully killed."),
         ("dba.deleteSandboxInstance(" + instance1 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n", 'successfully deleted.'),
         ("dba.killSandboxInstance(" + instance2 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n", "successfully killed."),
         ("dba.deleteSandboxInstance(" + instance2 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n", 'successfully deleted.'),
         ("dba.killSandboxInstance(" + instance3 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n", "successfully killed."),
         ("dba.deleteSandboxInstance(" + instance3 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n", 'successfully deleted.')
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#9
0
 def test_022_MYS_829(self):
     '''MYS-829 NOT ABLE TO ADD A REMOVED PRIMARY TO THE CLUSTER'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3312"
     instance2 = "3313"
     instance3 = "3314"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("\connect root:" + LOCALHOST.password + "@localhost:" + instance1 + "\n",
                'Classic Session successfully established. No default schema selected.'),
               ("myCluster = dba.createCluster(\"Cluster1\")\n",
                'Cluster successfully created'),
               ("myCluster.addInstance(\"root:" + LOCALHOST.password + "@localhost:" + instance2 + "\")\n",
                "The instance \'root@localhost:" + instance2 + "\' was successfully added to the cluster"),
               ("myCluster.addInstance(\"root:" + LOCALHOST.password + "@localhost:" + instance3 + "\")\n",
                "The instance \'root@localhost:" + instance3 + "\' was successfully added to the cluster"),
               ("myCluster.removeInstance('localhost:" + instance1 + "')\n",
                "The instance 'localhost:" + instance1 + "' was successfully removed from the cluster"),
               ("\connect root:" + LOCALHOST.password + "@localhost:" + instance2 + "\n",
                'Classic Session successfully established. No default schema selected.'),
               ("myCluster2 = dba.getCluster()\n",
                '<Cluster:Cluster1>'),
               ("myCluster2.addInstance(\"root:" + LOCALHOST.password + "@localhost:" + instance1 + "\")\n",
                "The instance 'root@localhost:" + instance1 + "' was successfully added to the cluster")
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#10
0
  def test_031_MYS_956(self):
      '''MYS-956 CREATECLUSTER() AFTER DISSOLVING EXISTING CLUSTER FAILS'''
      logger.debug("--------- " + str(self._testMethodName) + " ---------")
      instance1 = "3312"
      instance2 = "3313"
      instance3 = "3314"
      instance4 = "3322"
      default_sandbox_path = "/mysql-sandboxes"

      results = ''
      init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
      x_cmds = [("dba.verbose=2\n","2"),
                ("\connect root:" + LOCALHOST.password + "@localhost:" + instance1 + "\n",
                 'Session successfully established. No default schema selected.'),
                ("myCluster = dba.getCluster(\"Cluster1\")\n",
                 "<Cluster:Cluster1>"),
                ("myCluster.dissolve({force:true})\n",
                 'The cluster was successfully dissolved.'),
                ("\connect root:" + LOCALHOST.password + "@localhost:" + instance3 + "\n",
                 'Session successfully established. No default schema selected.'),
                ("myCluster2 = dba.createCluster(\"Cluster1\")\n",
                 'Cluster successfully created')
                ]
      results = exec_xshell_commands(init_command, x_cmds)
      self.assertEqual(results, 'PASS')
示例#11
0
    def test_031_MYS_956(self):
        '''MYS-956 CREATECLUSTER() AFTER DISSOLVING EXISTING CLUSTER FAILS'''
        logger.debug("--------- " + str(self._testMethodName) + " ---------")
        instance1 = "3312"
        instance2 = "3313"
        instance3 = "3314"
        instance4 = "3322"
        default_sandbox_path = "/mysql-sandboxes"

        results = ''
        init_command = [
            MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
        ]
        x_cmds = [
            ("dba.verbose=2\n", "2"),
            ("\connect root:" + LOCALHOST.password + "@localhost:" +
             instance1 + "\n",
             'Session successfully established. No default schema selected.'),
            ("myCluster = dba.getCluster(\"Cluster1\")\n",
             "<Cluster:Cluster1>"),
            ("myCluster.dissolve({force:true})\n",
             'The cluster was successfully dissolved.'),
            ("\connect root:" + LOCALHOST.password + "@localhost:" +
             instance3 + "\n",
             'Session successfully established. No default schema selected.'),
            ("myCluster2 = dba.createCluster(\"Cluster1\")\n",
             'Cluster successfully created')
        ]
        results = exec_xshell_commands(init_command, x_cmds)
        self.assertEqual(results, 'PASS')
 def test_035_MYS_cleanup_dissolveClusters(self):
     '''Required to dissolve all the clusters created for this test, add dissolveCluster clauses accordingly'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3314"
     instance2 = "3323"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("dba.verbose=2\n", "2"),
         ("\connect root:" + LOCALHOST.password + "@localhost:" +
          instance1 + "\n",
          'Classic Session successfully established. No default schema selected.'
          ),
         ("myCluster = dba.getCluster(\"Cluster1\")\n",
          "<Cluster:Cluster1>"),
         ("myCluster.dissolve({force: true})\n",
          "The cluster was successfully dissolved"),
         ("\connect root:" + LOCALHOST.password + "@localhost:" +
          instance2 + "\n",
          'Classic Session successfully established. No default schema selected.'
          ),
         ("myCluster2 = dba.getCluster(\"Cluster2\")\n",
          "<Cluster:Cluster2>"),
         ("myCluster2.dissolve({force: true})\n",
          "The cluster was successfully dissolved")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#13
0
 def test_030_MYS_900(self):
     '''MYS-900 REMOVED SEED NODE SHOWN AS OFFLINE CLUSTER MEMBER'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     default_sandbox_path = "/mysql-sandboxes"
     instance1 = "3313"
     instance2 = "3312"
     results = 'PASS'
     init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("\connect root:" + LOCALHOST.password + "@localhost:" + instance1 + "\n",
                'Classic Session successfully established. No default schema selected.'),
               ("cluster = dba.getCluster();\n", "<Cluster:Cluster1>"),
               ("cluster.removeInstance('localhost:" + instance1 + "')\n",
                "The instance 'localhost:" + instance1 + "' was successfully removed from the cluster"),
               ("\connect root:" + LOCALHOST.password + "@localhost:" + instance2 + "\n",
                'Classic Session successfully established. No default schema selected.'),
               ("cluster.status()\n",
                "root@localhost:" + instance2 + "")
               ]
     try:
         results = exec_xshell_commands(init_command, x_cmds)
         if results.find("localhost:" + instance1 + "") == -1:
             results = 'PASS'
     except Exception as ex:
         results = "FAIL: " + str(results)
         if results.find("localhost:" + instance1 + "") == -1:
             results = 'PASS'
     self.assertEqual(results, 'PASS')
示例#14
0
 def test_030_MYS_900(self):
     '''MYS-900 REMOVED SEED NODE SHOWN AS OFFLINE CLUSTER MEMBER'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     default_sandbox_path = "/mysql-sandboxes"
     instance1 = "3313"
     instance2 = "3312"
     results = 'PASS'
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("\connect root:" + LOCALHOST.password + "@localhost:" +
          instance1 + "\n",
          'Classic Session successfully established. No default schema selected.'
          ), ("cluster = dba.getCluster();\n", "<Cluster:Cluster1>"),
         ("cluster.removeInstance('localhost:" + instance1 + "')\n",
          "The instance 'localhost:" + instance1 +
          "' was successfully removed from the cluster"),
         ("\connect root:" + LOCALHOST.password + "@localhost:" +
          instance2 + "\n",
          'Classic Session successfully established. No default schema selected.'
          ), ("cluster.status()\n", "root@localhost:" + instance2 + "")
     ]
     try:
         results = exec_xshell_commands(init_command, x_cmds)
         if results.find("localhost:" + instance1 + "") == -1:
             results = 'PASS'
     except Exception as ex:
         results = "FAIL: " + str(results)
         if results.find("localhost:" + instance1 + "") == -1:
             results = 'PASS'
     self.assertEqual(results, 'PASS')
示例#15
0
 def test_026_MYS_769_cluster_removeInstance(self):
     '''Add instance to a cluster, then remove instance, use sandboxDir parameter'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3322"
     ################################ deploySandboxInstance 3313  #####################################################
     instance2 = "3323"
     ################################# deploySandboxInstance 3314  ###################################################
     instance3 = "3324"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("dba.deploySandboxInstance(" + instance3 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n",
          'Please enter a MySQL root password for the new instance:'),
         (LOCALHOST.password + '\n', "Instance localhost:" + instance3 +
          " successfully deployed and started."),
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     try:
         if results.find(bytearray("FAIL", "ascii"), 0, len(results)) > -1:
             self.assertEqual(results, 'PASS')
     except Exception as ex:
         self.assertEqual('FAIL', 'PASS')
     #################################### createCluster  #################################################
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance1, '--mysql'
     ]
     x_cmds = [
         ("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
         ("cluster.addInstance( \"{0}:{1}@{2}:".format(
             LOCALHOST.user, LOCALHOST.password, LOCALHOST.host) +
          instance3 + "\");\n", "was successfully added to the cluster"),
         ("cluster.removeInstance(\"{0}:".format(LOCALHOST.host) +
          instance1 + "\");\n",
          "was successfully removed from the cluster.")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#16
0
 def test_014_MYS_758_stopSandboxInstance(self):
     '''MYS-758 [MYAA] dba.stopSandboxInstance(port[, options]) using sandboxDir parameter'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance="3313"
     results = ''
     init_command =  [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.stopSandboxInstance("+instance+", { sandboxDir: \""+cluster_Path+
                "\", password:\"" + LOCALHOST.password + "\"});\n",'successfully stopped.')]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#17
0
 def test_003_MYS_633_startSandboxInstance(self):
     '''MYS-633 [MYAA] dba.startLocalInstance(port)'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     time.sleep(5)
     init_command =  [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.startSandboxInstance("+instance+");\n",'successfully started.')]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#18
0
 def test_002_MYS_634_stopSandboxInstance(self):
     '''MYS-634 [MYAA] dba.stopLocalInstance(port)'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command =  [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.stopSandboxInstance("+instance+", {password:\"" + LOCALHOST.password + "\"});\n",
                'successfully stopped.')]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#19
0
 def test_005_MYS_622_createCluster(self):
     '''MYS-622 [MYAA] dba.createCluster(name)'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host,'-P' + instance, '--mysql']
     x_cmds = [("dba.createCluster(\"Cluster1\");\n","<Cluster:Cluster1>")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#20
0
 def test_005_MYS_622_createCluster(self):
     '''MYS-622 [MYAA] dba.createCluster(name)'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host,'-P' + instance, '--classic']
     x_cmds = [("dba.createCluster(\"Cluster1\");\n","<Cluster:Cluster1>")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#21
0
 def test_033_MYS_749_killSandboxInstance(self):
     '''MYS-749 [MYAA] dba.killLocalInstance(port)'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance="3313"
     results = ''
     init_command =  [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.killSandboxInstance("+instance+", { sandboxDir: \"" + cluster_Path + "\"});\n","successfully killed."),
               ("dba.deleteSandboxInstance("+instance+", { sandboxDir: \"" + cluster_Path + "\"});\n","successfully deleted.")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#22
0
 def test_025_MYS_767_cluster_addInstance_UC3(self):
     '''MYS-767 [MYAA] clust.addInstance with valid values and with an instance not available'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3322"
     ################################ deploySandboxInstance 3313  #####################################################
     instance2 = "3323"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("dba.deploySandboxInstance(" + instance2 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n",
          'Please enter a MySQL root password for the new instance:'),
         (LOCALHOST.password + '\n', "Instance localhost:" + instance2 +
          " successfully deployed and started."),
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     try:
         if results.find(bytearray("FAIL", "ascii"), 0, len(results)) > -1:
             self.assertEqual(results, 'PASS')
     except Exception as ex:
         self.assertEqual('FAIL', 'PASS')
     #################################### createCluster  #################################################
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance1, '--classic'
     ]
     x_cmds = [
         ("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
         ("cluster.addInstance( \"{0}:{1}@{2}:".format(
             LOCALHOST.user, LOCALHOST.password, LOCALHOST.host) +
          instance2 + "\");\n", "was successfully added to the cluster"),
         ("cluster.addInstance( \"{0}:{1}@{2}:3399\");\n".format(
             LOCALHOST.user, LOCALHOST.password,
             LOCALHOST.host), "Can't connect to MySQL server on")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#23
0
 def test_018_MYS_635_cluster_addInstance_UC2(self):
     '''MYS-635 [MYAA] cluster.addInstance() with a just deployed instance using sandboxDir parameter'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3312"
     ################################ deploySandboxInstance 3313  #####################################################
     instance2 = "3313"
     ################################# deploySandboxInstance 3314  ###################################################
     instance3 = "3314"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("dba.deploySandboxInstance(" + instance3 + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n",
          'Please enter a MySQL root password for the new instance:'),
         (LOCALHOST.password + '\n', "Instance localhost:" + instance3 +
          " successfully deployed and started."),
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     try:
         if results.find(bytearray("FAIL", "ascii"), 0, len(results)) > -1:
             self.assertEqual(results, 'PASS')
     except Exception as ex:
         self.assertEqual('FAIL', 'PASS')
     #################################### createCluster  #################################################
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance1, '--classic'
     ]
     x_cmds = [
         ("cluster = dba.getCluster('Cluster1');\n", "<Cluster:Cluster1>"),
         ("cluster.addInstance(\"{0}:{1}@{2}:".format(
             LOCALHOST.user, LOCALHOST.password, LOCALHOST.host) +
          instance3 + "\");\n", "was successfully added to the cluster"),
         #"cluster.addInstance( \"root:guidev!@localhost:3314\");\n", "was successfully added to the cluster")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#24
0
 def test_001_MYS_619_deploySandboxInstance(self):
     '''MYS-619 [MYAA] dba.deployLocalInstance(port)'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance="3312"
     results = ''
     init_command =  [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.deploySandboxInstance("+instance+");\n", 'Please enter a MySQL root password for the new instance:'),
               (LOCALHOST.password + '\n', "Instance localhost:"+instance+" successfully deployed and started."),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#25
0
 def test_016_MYS_742_dba_checkInstanceConfig(self):
     '''MYS-742 [MYAA] dba.checkInstanceConfig() command'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3313"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--mysql']
     x_cmds = [("dba.checkInstanceConfiguration(\"" + LOCALHOST.user + ":" + LOCALHOST.password + "@" +
                LOCALHOST.host + ":" + instance + "\");\n",  "\"status\": \"ok\"")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#26
0
 def test_011_MYS_625_cluster_status(self):
     '''MYS-625 [MYAA] cluster.status() command'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--mysql']
     x_cmds = [("cluster = dba.getCluster('Cluster1');\n", "<Cluster:Cluster1>"),
               ("cluster.status();\n", "\"clusterName\": \"Cluster1\"")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#27
0
 def test_008_MYS_737_cluster_getName(self):
     '''MYS-737 [MYAA] cluster.getName()'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--mysql']
     x_cmds = [("cluster = dba.getCluster();\n", "<Cluster:Cluster1>" + os.linesep),
               ("cluster.getName();\n", os.linesep + "Cluster1" + os.linesep),
               ("session\n", "Classic")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_006_MYS_720_cluster_dissolve(self):
     '''MYS-720 [MYAA] cluster.dissolve() with and without force:true'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--classic']
     x_cmds = [("cluster = dba.getCluster('Cluster1');\n", "<Cluster:Cluster1>"),
               ("cluster.dissolve();\n", "The cluster still has active ReplicaSets."),
               ("cluster.dissolve({force:true});\n", "The cluster was successfully dissolved."),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_009_MYS_738_cluster_adminType(self):
     '''MYS-738 [MYAA] cluster.adminType and cluster.getAdminType commands'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--mysql']
     x_cmds = [("cluster = dba.getCluster();\n", "<Cluster:Cluster1>"),
               ("cluster.adminType;\n", "local"),
               ("cluster.getAdminType();\n", "local")
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#30
0
 def test_024_MYS_764_getCluster_InvalidName(self):
     '''MYS-764 [MYAA] dba.getCluster([name][, options]) FAILOVER-Invalid Cluster'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3322"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance, '--mysql'
     ]
     x_cmds = [("dba.getCluster('devClusterz');\n",
                "The cluster with the name 'devClusterz' does not exist.")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#31
0
 def test_029_MYS_855_checkInstanceState_UC1(self):
     '''MYS-855 [MYAA] cluster.checkInstanceState()'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3313"
     results = ''
     findString = "The instance '" + LOCALHOST.host + ":" + instance + "' is valid for the cluster." + os.linesep + "The instance is fully recoverable."
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance, '--mysql', '--passwords-from-stdin']
     x_cmds = [("cluster= dba.getCluster(\"Cluster1\");\n", "<Cluster:Cluster1>"),
               ("cluster.checkInstanceState('" + LOCALHOST.host + ":" + instance + "');\n","Please provide the password "),
               (LOCALHOST.password + '\n', "is valid for the cluster."),
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_009_MYS_738_cluster_adminType(self):
     '''MYS-738 [MYAA] cluster.adminType and cluster.getAdminType commands'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance, '--mysql'
     ]
     x_cmds = [("cluster = dba.getCluster();\n", "<Cluster:Cluster1>"),
               ("cluster.adminType;\n", "local"),
               ("cluster.getAdminType();\n", "local")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#33
0
 def test_027_MYS_770_cluster_removeInstance_InvalidInstance(self):
     '''Try to remove instance not part of the Cluster, verify correct error displayed to the user'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3323"
     #################################### createCluster  #################################################
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance1, '--mysql']
     x_cmds = [("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
               ("cluster.removeInstance(\"{0}:3399\");\n".format(LOCALHOST.host),
                "does not belong to the ReplicaSet")
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#34
0
 def test_034_MYS_755_deleteSandboxInstance(self):
     '''MYS-755 [MYAA] dba.deleteLocalInstance(port[, options])'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3322"
     instance2 = "3323"
     results = ''
     init_command =  [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin', '-u' + LOCALHOST.user,
                      '--password='******'-h' + LOCALHOST.host, '-P ' + instance2, '--mysql']
     x_cmds = [("c = dba.getCluster('Cluster2')\n",'<Cluster:Cluster2>'),
               ("c.removeInstance('localhost:3322')\n", 'was successfully removed from the cluster'),
               ("dba.stopSandboxInstance("+instance+", { sandboxDir: \""+cluster_Path+
                "\", password:\"" + LOCALHOST.password + "\"});\n",'successfully stopped.'),
               ("dba.deleteSandboxInstance("+instance+", { sandboxDir: \""+cluster_Path+"\"});\n",'successfully deleted.')]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_016_MYS_742_dba_checkInstanceConfig(self):
     '''MYS-742 [MYAA] dba.checkInstanceConfig() command'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3313"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance, '--classic'
     ]
     x_cmds = [("dba.checkInstanceConfiguration(\"" + LOCALHOST.user + ":" +
                LOCALHOST.password + "@" + LOCALHOST.host + ":" + instance +
                "\");\n", "\"status\": \"ok\"")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#36
0
 def test_013_MYS_751_deploySandboxInstance(self):
     '''MYS-751 [MYAA] dba.deploySandboxInstance(port[, options]) usind sandboxDir parameter'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3313"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [("dba.deploySandboxInstance(" + instance +
                ", { sandboxDir: \"" + cluster_Path + "\"});\n",
                'Please enter a MySQL root password for the new instance:'),
               (LOCALHOST.password + '\n', "Instance localhost:" +
                instance + " successfully deployed and started.")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#37
0
 def test_007_MYS_622_createCluster_UC2(self):
     '''MYS-622 [MYAA] dba.createCluster(name) and using clusterAdminType: local'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance, '--mysql'
     ]
     x_cmds = [
         ("dba.createCluster('Cluster1',{clusterAdminType:'local'});\n",
          "<Cluster:Cluster1>")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#38
0
 def test_020_MYS_809(self):
     '''MYS-809 configLocalInstance on an instance already part of a cluster'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3312"
     instance2 = "3313"
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("\connect root:" + LOCALHOST.password + "@localhost:" + instance1 + "\n",
                'Classic Session successfully established. No default schema selected.'),
               ("dba.configureLocalInstance('{0}:{1}@{2}:".format(LOCALHOST.user, LOCALHOST.password,
                                                                  LOCALHOST.host) + instance2 + "')\n",
                "The instance '{0}:{1}'".format(LOCALHOST.host, instance2) +
                " is valid for Cluster usage" + os.linesep)
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#39
0
 def test_001_MYS_619_deploySandboxInstance(self):
     '''MYS-619 [MYAA] dba.deployLocalInstance(port)'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("dba.deploySandboxInstance(" + instance + ");\n",
          'Please enter a MySQL root password for the new instance:'),
         (LOCALHOST.password + '\n', "Instance localhost:" + instance +
          " successfully deployed and started."),
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#40
0
 def test_008_MYS_737_cluster_getName(self):
     '''MYS-737 [MYAA] cluster.getName()'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3312"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance, '--mysql'
     ]
     x_cmds = [("cluster = dba.getCluster();\n",
                "<Cluster:Cluster1>" + os.linesep),
               ("cluster.getName();\n",
                os.linesep + "Cluster1" + os.linesep),
               ("session\n", "Classic")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_019_MYS_684_cluster_removeInstance(self):
     '''MYS-684 [MYAA] cluster.removeInstance()'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3312"
     ################################ deploySandboxInstance 3313  #####################################################
     instance2 = "3313"
     ################################# deploySandboxInstance 3314  ###################################################
     instance3 = "3314"
     #################################### createCluster  #################################################
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance1, '--classic']
     x_cmds = [("cluster = dba.getCluster('Cluster1');\n", "<Cluster:Cluster1>"),
               ("cluster.removeInstance(\"localhost:" + instance3 + "\");\n", "was successfully removed from the cluster.")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#42
0
 def test_019_MYS_684_cluster_removeInstance(self):
     '''MYS-684 [MYAA] cluster.removeInstance()'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3312"
     ################################ deploySandboxInstance 3313  #####################################################
     instance2 = "3313"
     ################################# deploySandboxInstance 3314  ###################################################
     instance3 = "3314"
     #################################### createCluster  #################################################
     results = ''
     init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + instance1, '--mysql']
     x_cmds = [("cluster = dba.getCluster('Cluster1');\n", "<Cluster:Cluster1>"),
               ("cluster.removeInstance(\"localhost:" + instance3 + "\");\n", "was successfully removed from the cluster.")]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
 def test_035_MYS_cleanup_dissolveClusters(self):
     '''Required to dissolve all the clusters created for this test, add dissolveCluster clauses accordingly'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3314"
     instance2 = "3323"
     results = ''
     init_command =  [MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin']
     x_cmds = [("dba.verbose=2\n","2"),
               ("\connect root:" + LOCALHOST.password + "@localhost:" + instance1 + "\n",
                'Classic Session successfully established. No default schema selected.'),
               ("myCluster = dba.getCluster(\"Cluster1\")\n", "<Cluster:Cluster1>"),
               ("myCluster.dissolve({force: true})\n", "The cluster was successfully dissolved"),
               ("\connect root:" + LOCALHOST.password + "@localhost:" + instance2 + "\n",
                'Classic Session successfully established. No default schema selected.'),
               ("myCluster2 = dba.getCluster(\"Cluster2\")\n", "<Cluster:Cluster2>"),
               ("myCluster2.dissolve({force: true})\n", "The cluster was successfully dissolved")
               ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#44
0
 def test_027_MYS_770_cluster_removeInstance_InvalidInstance(self):
     '''Try to remove instance not part of the Cluster, verify correct error displayed to the user'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3323"
     #################################### createCluster  #################################################
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance1, '--mysql'
     ]
     x_cmds = [
         ("cluster = dba.getCluster('Cluster2');\n", "<Cluster:Cluster2>"),
         ("cluster.removeInstance(\"{0}:3399\");\n".format(LOCALHOST.host),
          "does not belong to the ReplicaSet")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#45
0
 def test_029_MYS_855_checkInstanceState_UC1(self):
     '''MYS-855 [MYAA] cluster.checkInstanceState()'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3313"
     results = ''
     findString = "The instance '" + LOCALHOST.host + ":" + instance + "' is valid for the cluster." + os.linesep + "The instance is fully recoverable."
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance, '--mysql', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("cluster= dba.getCluster(\"Cluster1\");\n", "<Cluster:Cluster1>"),
         ("cluster.checkInstanceState('" + LOCALHOST.host + ":" + instance +
          "');\n", "Please provide the password "),
         (LOCALHOST.password + '\n', "is valid for the cluster."),
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#46
0
 def test_020_MYS_809(self):
     '''MYS-809 configLocalInstance on an instance already part of a cluster'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3312"
     instance2 = "3313"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [(
         "\connect root:" + LOCALHOST.password + "@localhost:" + instance1 +
         "\n",
         'Classic Session successfully established. No default schema selected.'
     ),
               ("dba.configureLocalInstance('{0}:{1}@{2}:".format(
                   LOCALHOST.user, LOCALHOST.password, LOCALHOST.host) +
                instance2 + "')\n",
                "The instance '{0}:{1}'".format(LOCALHOST.host, instance2) +
                " is valid for Cluster usage" + os.linesep)]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#47
0
 def test_017_MYS_635_cluster_addInstance_UC1(self):
     '''MYS-635 [MYAA] addAnInsance to the clister'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     ################################ deploySandboxInstance 3312  #####################################################
     instance1 = "3312"
     ################################ deploySandboxInstance 3313  #####################################################
     instance2 = "3313"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
         '--password='******'-h' + LOCALHOST.host,
         '-P' + instance1, '--classic'
     ]
     x_cmds = [
         ("cluster = dba.getCluster('Cluster1');\n", "<Cluster:Cluster1>"),
         ("cluster.addInstance(\"{0}:{1}@{2}:".format(
             LOCALHOST.user, LOCALHOST.password, LOCALHOST.host) +
          instance2 + "\");\n", "was successfully added to the cluster")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     ##########################
     self.assertEqual(results, 'PASS')
示例#48
0
 def test_022_MYS_829(self):
     '''MYS-829 NOT ABLE TO ADD A REMOVED PRIMARY TO THE CLUSTER'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance1 = "3312"
     instance2 = "3313"
     instance3 = "3314"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin'
     ]
     x_cmds = [
         ("\connect root:" + LOCALHOST.password + "@localhost:" +
          instance1 + "\n",
          'Classic Session successfully established. No default schema selected.'
          ),
         ("myCluster = dba.createCluster(\"Cluster1\")\n",
          'Cluster successfully created'),
         ("myCluster.addInstance(\"root:" + LOCALHOST.password +
          "@localhost:" + instance2 + "\")\n",
          "The instance \'root@localhost:" + instance2 +
          "\' was successfully added to the cluster"),
         ("myCluster.addInstance(\"root:" + LOCALHOST.password +
          "@localhost:" + instance3 + "\")\n",
          "The instance \'root@localhost:" + instance3 +
          "\' was successfully added to the cluster"),
         ("myCluster.removeInstance('localhost:" + instance1 + "')\n",
          "The instance 'localhost:" + instance1 +
          "' was successfully removed from the cluster"),
         ("\connect root:" + LOCALHOST.password + "@localhost:" +
          instance2 + "\n",
          'Classic Session successfully established. No default schema selected.'
          ), ("myCluster2 = dba.getCluster()\n", '<Cluster:Cluster1>'),
         ("myCluster2.addInstance(\"root:" + LOCALHOST.password +
          "@localhost:" + instance1 + "\")\n",
          "The instance 'root@localhost:" + instance1 +
          "' was successfully added to the cluster")
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#49
0
 def test_034_MYS_755_deleteSandboxInstance(self):
     '''MYS-755 [MYAA] dba.deleteLocalInstance(port[, options])'''
     logger.debug("--------- " + str(self._testMethodName) + " ---------")
     instance = "3322"
     instance2 = "3323"
     results = ''
     init_command = [
         MYSQL_SHELL, '--interactive=full', '--passwords-from-stdin',
         '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P ' + instance2, '--mysql'
     ]
     x_cmds = [
         ("c = dba.getCluster('Cluster2')\n", '<Cluster:Cluster2>'),
         ("c.removeInstance('localhost:3322')\n",
          'was successfully removed from the cluster'),
         ("dba.stopSandboxInstance(" + instance + ", { sandboxDir: \"" +
          cluster_Path + "\", password:\"" + LOCALHOST.password + "\"});\n",
          'successfully stopped.'),
         ("dba.deleteSandboxInstance(" + instance + ", { sandboxDir: \"" +
          cluster_Path + "\"});\n", 'successfully deleted.')
     ]
     results = exec_xshell_commands(init_command, x_cmds)
     self.assertEqual(results, 'PASS')
示例#50
0
    def test_000_MYS_setUpClass(self):
        logger.info("--------- " + str(self._testMethodName) + " ---------")
        # install xplugin
        results = ''
        init_command = [
            MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
            '--password='******'-h' + LOCALHOST.host,
            '-P' + LOCALHOST.port, '--mysql', '--dba', 'enableXProtocol'
        ]
        p = subprocess.Popen(init_command,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             stdin=subprocess.PIPE)
        p.stdin.flush()
        stdin, stdout = p.communicate()
        if stdin.find(
                bytearray(
                    "X Protocol plugin is already enabled and listening for connections",
                    "ascii"), 0, len(stdin)) >= 0:
            results = "PASS"
        else:
            raise ValueError("FAILED installing xplugin")

        # def test_0_1(self):
        # create world_x and world_x-data
        init_command = [
            MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
            '--password='******'-h' + LOCALHOST.host,
            '-P' + LOCALHOST.port, '--sqlc', '--mysql',
            '--file=' + Exec_files_location + 'world_x.sql'
        ]
        p = subprocess.Popen(init_command,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             stdin=subprocess.PIPE)
        stdin, stdout = p.communicate()
        results = ''
        init_command = [MYSQL_SHELL, '--interactive=full']
        x_cmds = [
            ('\\connect --mx {0}:{1}@{2}\n'.format(LOCALHOST.user,
                                                   LOCALHOST.password,
                                                   LOCALHOST.host),
             "mysql-js>"),
            ("\\sql\n", "mysql-sql>"),
            ("use world_x;\n", "mysql-sql>"),
            ("show tables ;\n", "4 rows in set"),
        ]

        results = exec_xshell_commands(init_command, x_cmds)
        if results != "PASS":
            raise ValueError("FAILED initializing schema world_x")

        # create sakila and sakila-data
        init_command = [
            MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
            '--password='******'-h' + LOCALHOST.host,
            '-P' + LOCALHOST.port, '--sqlc', '--mysql',
            '--file=' + Exec_files_location + 'sakila-schema.sql'
        ]
        p = subprocess.Popen(init_command,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             stdin=subprocess.PIPE)
        stdin, stdout = p.communicate()
        init_command = [
            MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
            '--password='******'-h' + LOCALHOST.host,
            '-P' + LOCALHOST.port, '--sqlc', '--mysql',
            '--file=' + Exec_files_location + 'sakila-data-5712.sql'
        ]
        p = subprocess.Popen(init_command,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             stdin=subprocess.PIPE)
        stdin, stdout = p.communicate()
        # if stdout.find(bytearray("ERROR","ascii"),0,len(stdout))> -1:
        #  self.assertEqual(stdin, 'PASS')
        results = ''
        init_command = [MYSQL_SHELL, '--interactive=full']
        x_cmds = [
            ('\\connect --mx {0}:{1}@{2}\n'.format(LOCALHOST.user,
                                                   LOCALHOST.password,
                                                   LOCALHOST.host),
             "mysql-js>"),
            ("\\sql\n", "mysql-sql>"),
            ("use sakila;\n", "mysql-sql>"),
            ("select count(*) from actor;\n", "200"),
            ("select count(*) from city;\n", "600"),
            ("select count(*) from rental;\n", "16044"),
        ]
        results = exec_xshell_commands(init_command, x_cmds)
        if results != "PASS":
            raise ValueError("FAILED initializing schema sakila")

        # create sakila_x
        init_command = [
            MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user,
            '--password='******'-h' + LOCALHOST.host,
            '-P' + LOCALHOST.port, '--sqlc', '--mysql',
            '--file=' + Exec_files_location + 'sakila_x.sql'
        ]
        p = subprocess.Popen(init_command,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             stdin=subprocess.PIPE)
        stdin, stdout = p.communicate()
        results = ''
        init_command = [MYSQL_SHELL, '--interactive=full']
        x_cmds = [
            ('\\connect --mx {0}:{1}@{2}\n'.format(LOCALHOST.user,
                                                   LOCALHOST.password,
                                                   LOCALHOST.host),
             "mysql-js>"),
            ("\\sql\n", "mysql-sql>"),
            ("use sakila_x;\n", "mysql-sql>"),
            ("select count(*) from movies;\n", "1 row in set"),
            ("select count(*) from users;\n", "1 row in set"),
        ]
        results = exec_xshell_commands(init_command, x_cmds)
        if results != "PASS":
            raise ValueError("FAILED initializing schema sakila_x")
示例#51
0
  def test_000_MYS_setUpClass(self):
      logger.info("--------- " + str(self._testMethodName) + " ---------")
      # install xplugin
      results = ''
      init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + LOCALHOST.port, '--mysql', '--dba', 'enableXProtocol']
      p = subprocess.Popen(init_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
      p.stdin.flush()
      stdin, stdout = p.communicate()
      if stdin.find(bytearray("X Protocol plugin is already enabled and listening for connections", "ascii"), 0,
                    len(stdin)) >= 0:
          results = "PASS"
      else:
          raise ValueError("FAILED installing xplugin")

      # def test_0_1(self):
      # create world_x and world_x-data
      init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + LOCALHOST.port, '--sqlc', '--mysql',
                      '--file=' + Exec_files_location + 'world_x.sql']
      p = subprocess.Popen(init_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
      stdin, stdout = p.communicate()
      results = ''
      init_command = [MYSQL_SHELL, '--interactive=full']
      x_cmds = [('\\connect --mx {0}:{1}@{2}\n'.format(LOCALHOST.user, LOCALHOST.password, LOCALHOST.host), "mysql-js>"),
                ("\\sql\n", "mysql-sql>"),
                ("use world_x;\n", "mysql-sql>"),
                ("show tables ;\n", "4 rows in set"),
                ]

      results = exec_xshell_commands(init_command, x_cmds)
      if results != "PASS":
          raise ValueError("FAILED initializing schema world_x")

      # create sakila and sakila-data
      init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + LOCALHOST.port, '--sqlc', '--mysql',
                      '--file=' + Exec_files_location + 'sakila-schema.sql']
      p = subprocess.Popen(init_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
      stdin, stdout = p.communicate()
      init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + LOCALHOST.port, '--sqlc', '--mysql',
                      '--file=' + Exec_files_location + 'sakila-data-5712.sql']
      p = subprocess.Popen(init_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
      stdin, stdout = p.communicate()
      # if stdout.find(bytearray("ERROR","ascii"),0,len(stdout))> -1:
      #  self.assertEqual(stdin, 'PASS')
      results = ''
      init_command = [MYSQL_SHELL, '--interactive=full']
      x_cmds = [('\\connect --mx {0}:{1}@{2}\n'.format(LOCALHOST.user, LOCALHOST.password, LOCALHOST.host), "mysql-js>"),
                ("\\sql\n", "mysql-sql>"),
                ("use sakila;\n", "mysql-sql>"),
                ("select count(*) from actor;\n", "200"),
                ("select count(*) from city;\n", "600"),
                ("select count(*) from rental;\n", "16044"),
                ]
      results = exec_xshell_commands(init_command, x_cmds)
      if results != "PASS":
          raise ValueError("FAILED initializing schema sakila")

      # create sakila_x
      init_command = [MYSQL_SHELL, '--interactive=full', '-u' + LOCALHOST.user, '--password='******'-h' + LOCALHOST.host, '-P' + LOCALHOST.port, '--sqlc', '--mysql',
                      '--file=' + Exec_files_location + 'sakila_x.sql']
      p = subprocess.Popen(init_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
      stdin, stdout = p.communicate()
      results = ''
      init_command = [MYSQL_SHELL, '--interactive=full']
      x_cmds = [('\\connect --mx {0}:{1}@{2}\n'.format(LOCALHOST.user, LOCALHOST.password, LOCALHOST.host), "mysql-js>"),
                ("\\sql\n", "mysql-sql>"),
                ("use sakila_x;\n", "mysql-sql>"),
                ("select count(*) from movies;\n", "1 row in set"),
                ("select count(*) from users;\n", "1 row in set"),
                ]
      results = exec_xshell_commands(init_command, x_cmds)
      if results != "PASS":
          raise ValueError("FAILED initializing schema sakila_x")