Example #1
0
 def test_create_simple_fts_index(self):
     indexName = "FTSIndex1"
     NavigationHelper(self).navigate('Indexes')
     self.ftsHelper.click_fts_tab(text="Full Text")
     self.assertTrue(self.ftsHelper.create_new_fts_index(indexName=indexName, bucketName=self.bucketname),
                     "Failed to create FTS Index")
     NavigationHelper(self).navigate('Indexes')
     self.ftsHelper.click_fts_tab(text="Full Text")
     self.assertTrue(self.ftsHelper.is_fts_index_displayed_in_list(indexName=indexName),
                     "Index not listed in the FTS Index list")
Example #2
0
 def test_create_replication(self):
     self.assertTrue(
         len(self.servers) > 1, 'This test requires at least 2 nodes')
     ip = self.input.param('ip_to_replicate', self.servers[1].ip)
     name = self.input.param('name', 'ui_auto')
     user = self.input.param('user',
                             self.input.membase_settings.rest_username)
     passwd = self.input.param('passwd',
                               self.input.membase_settings.rest_password)
     src_bucket = self.input.param('src_bucket', self.bucket)
     dest_bucket = self.input.param('dest_bucket', self.bucket)
     dest_cluster = self.input.param('dest_cluster', name)
     error = self.input.param('error', None)
     advanced_settings = self.input.param('advanced_settings', {})
     if advanced_settings:
         adv_s = advanced_settings.split('~')
         advanced_settings = {}
         for setng in adv_s:
             advanced_settings[setng.split(':')[0]] = setng.split(':')[1]
     NavigationHelper(self).navigate('XDCR')
     XDCRHelper(self).create_cluster_reference(name, ip, user, passwd)
     self.sleep(3)
     try:
         XDCRHelper(self).create_replication(
             dest_cluster,
             src_bucket,
             dest_bucket,
             advanced_settings=advanced_settings)
     except Exception, ex:
         self.log.error(str(ex))
         if error:
             self.assertTrue(
                 str(ex).find(error) != -1, 'Error is not expected')
         else:
             raise ex
Example #3
0
 def test_save_result(self):
     path = self.input.param('path', "data.json")
     check_query = self.input.param('check_query', '').replace(
         '_STAR_', '*').replace('_SEM_', ';').decode('unicode_escape')
     expected_result = self.input.param(
         'expected_result', '{"no_data_yet": "hit execute to run query"}')
     expected_result = expected_result.replace('_STAR_', '*').replace(
         '_SEM_', ';').decode('unicode_escape')
     home = expanduser("~")
     home += "\Downloads"
     saved_file = "%s\%s" % (home, path)
     try:
         if path:
             os.remove(saved_file)
         else:
             os.remove("%s\download" % home)
     except OSError:
         pass
     NavigationHelper(self).navigate('Query')
     if check_query:
         self.queryHelper.execute_query(check_query)
     self.queryHelper.save_result(path)
     if not path:
         saved_file = "%s\download" % home
     f = open(saved_file, 'r')
     content = f.read()
     search_obj = re.search(expected_result, content, re.M | re.I)
     self.assertTrue(search_obj,
                     msg='Incorrect saved query result file: %s' % content)
 def test_rebalance_out(self):
     service = self.input.param("services", '').split(';')
     NavigationHelper(self).navigate('Server Nodes')
     self.helper.add(self.input, index=1, services=service)
     self.helper.start_rebalancing()
     self.sleep(3, 'Wait some progress')
     self.helper.wait_for_rebalance_stops()
     self.helper.remove_node(ip=self.servers[1].ip, skip_wait=False)
     self.helper.wait_for_rebalance_stops()
 def test_add_node_warning(self):
     services = self.input.param("services", '').split(';')
     warning = self.input.param("warning", '')
     NavigationHelper(self).navigate('Server Nodes')
     current_warning = self.helper.add_warnings(self.input,
                                                services=services)
     self.assertTrue(
         current_warning.find(warning) != -1,
         'there was no expected warnings')
 def test_failover(self):
     service = self.input.param("services", '').split(';')
     NavigationHelper(self).navigate('Server Nodes')
     self.helper.add(self.input, index=1, services=service)
     self.helper.start_rebalancing()
     self.sleep(3, 'Wait some progress')
     self.helper.wait_for_rebalance_stops()
     if len(self.servers) < 2:
         self.fail("There is no enough VMs. Need at least 2")
     ServerHelper(self).failover(self.servers[1], confirm=True, graceful=True)
 def test_add_node(self):
     # kv n1ql moxi index
     services = self.input.param("services", '').split(';')
     error = self.input.param("error", '')
     NavigationHelper(self).navigate('Server Nodes')
     try:
         self.helper.add(self.input, services=services)
     except Exception, ex:
         if error and str(ex).find(error) != -1:
             self.log.info('Error appeared as expected')
         else:
             self.fail('unexpected error appeared %s' % str(ex))
Example #8
0
 def test_cancel_create_reference(self):
     self.assertTrue(len(self.servers) > 1, 'This test requires at least 2 nodes')
     ip = self.input.param('ip_to_replicate', self.servers[1].ip)
     name = self.input.param('name', 'ui_auto')
     user = self.input.param('user', self.input.membase_settings.rest_username)
     passwd = self.input.param('passwd', self.input.membase_settings.rest_password)
     helper = XDCRHelper(self)
     NavigationHelper(self).navigate('XDCR')
     helper.create_cluster_reference(name, ip, user, passwd, cancel=True)
     self.assertFalse(helper.is_cluster_reference_created(name, ip),
                      'Reference should not appear')
     self.log.info('Test finished as expected')
 def test_rebalance_out_last_data(self):
     service = self.input.param("services", '').split(';')
     warn = self.input.param("warning", '')
     NavigationHelper(self).navigate('Server Nodes')
     self.helper.add(self.input, index=1, services=service)
     self.helper.start_rebalancing()
     self.sleep(3, 'Wait some progress')
     self.helper.wait_for_rebalance_stops()
     self.helper.remove_node(ip=self.servers[0].ip, skip_wait=True)
     self.helper.start_rebalancing()
     alert, text = self.helper.get_alert_text()
     self.assertTrue(text.find(warn) != -1, 'Alert text does not match: %s' % alert)
     alert.accept()
 def test_rebalance_in(self):
     service = self.input.param("services", '').split(';')
     NavigationHelper(self).navigate('Server Nodes')
     self.helper.add(self.input, services=service)
     self.helper.start_rebalancing()
     self.sleep(3, 'Wait some progress')
     self.helper.wait_for_rebalance_stops()
     self.log.info("Check finished")
     if 'kv' in service:
         self.assertTrue(not self.helper.get_items(self.servers[1]).startswith('0'), 'Data is not in server!')
     else:
         self.assertTrue(self.helper.get_items(self.servers[1]).startswith('0'), 'Data is in server!')
     self.log.info("Check finished")
 def test_rebalance_swap(self):
     self.assertTrue(len(self.servers) > 2, 'Test needs more than 2 node')
     service = self.input.param("services", '').split(';')
     NavigationHelper(self).navigate('Server Nodes')
     self.helper.add(self.input, index=1, services=service)
     self.helper.start_rebalancing()
     self.sleep(3, 'Wait some progress')
     self.helper.wait_for_rebalance_stops()
     self.helper.remove_node(ip=self.servers[1].ip)
     self.helper.add(self.input, index=2, services=service)
     self.helper.start_rebalancing()
     self.sleep(3, 'Wait some progress')
     self.helper.wait_for_rebalance_stops()
     self.assertTrue(self.helper.get_number_server_rows() == 2,'Node was not added')
Example #12
0
    def test_bucket_analysis(self):
        init_analysis = self.input.param('init_analysis', None)
        expected_analysis = self.input.param('expected_analysis', None)
        init_analysis = init_analysis.replace('_STAR_', '*').replace(
            '_SEM_', ';').decode('unicode_escape').split('|')  # 4.7 vs 4.6
        expected_analysis = expected_analysis.replace('_STAR_', '*').replace(
            '_SEM_', ';').decode('unicode_escape')
        check_query = self.input.param('check_query', '').replace(
            '_STAR_', '*').replace('_SEM_', ';').decode('unicode_escape')

        NavigationHelper(self).navigate('Query')
        self.queryHelper.check_bucket_analysis_result(init_analysis)
        self.queryHelper.execute_query(check_query)
        self.queryHelper.controls.query_bucket_analysis().refresh_button.click(
            highlight=False)
        time.sleep(6)
        self.queryHelper.check_bucket_analysis_result(expected_analysis)
Example #13
0
 def test_create_reference(self):
     self.assertTrue(len(self.servers) > 1, 'This test requires at least 2 nodes')
     ip = self.input.param('ip_to_replicate', self.servers[1].ip)
     name = self.input.param('name', 'ui_auto')
     user = self.input.param('user', self.input.membase_settings.rest_username)
     passwd = self.input.param('passwd', self.input.membase_settings.rest_password)
     error = self.input.param('error', None)
     helper = XDCRHelper(self)
     NavigationHelper(self).navigate('XDCR')
     try:
         helper.create_cluster_reference(name, ip, user, passwd)
     except Exception, ex:
         self.log.error(str(ex))
         if error:
             self.assertTrue(str(ex).find(error) != -1, 'Error is not expected')
         else:
             raise ex
Example #14
0
    def test_create_indexes(self):
        expected_results = self.input.param('expected_result', None)
        if expected_results is not None:
            expected_results = expected_results.replace('_STAR_', '*').replace('_SEM_', ';').decode('unicode_escape')\
                .split('|')  # 4.7 vs 4.6 versions
        summary_result = self.input.param('summary_result', '')
        summary_result = summary_result.replace('_STAR_', '*').replace(
            '_SEM_', ';').decode('unicode_escape')
        result_mode = self.input.param('mode', 'JSON')
        if self.rest.get_nodes()[0].version <= '4.7' and result_mode in [
                'Plan Text', 'Plan'
        ]:
            self.log.info("skipp 'Plan Text', 'Plan' modes in version < 4.7")
            return
        init_query = self.input.param('init_query', '').replace(
            '_STAR_', '*').replace('_SEM_', ';').decode('unicode_escape')
        check_query = self.input.param('check_query', '').replace(
            '_STAR_', '*').replace('_SEM_', ';').decode('unicode_escape')

        NavigationHelper(self).navigate('Query')
        if init_query:
            self.queryHelper.execute_query(init_query)
            self.queryHelper.controls.query_top_screen().view_next.click()
            self.assertEqual(
                '{"no_data_yet": "hit execute to run query"}',
                self.queryHelper.controls.query_results_box().result_json_mode.
                get_text())
        self.queryHelper.execute_query(check_query)
        if expected_results is not None:
            self.queryHelper.check_result(expected_results, mode=result_mode)
        if summary_result:
            self.queryHelper.check_summary_result(summary_result,
                                                  mode=result_mode)
        if init_query:
            self.queryHelper.controls.query_top_screen().view_previous.click()
            self.assertEqual(
                init_query,
                self.queryHelper.controls.query_top_screen().
                query_editor_value.get_text())
Example #15
0
 def test_save_query(self):
     path = self.input.param('path', "n1ql_query.txt")
     check_query = self.input.param('check_query', '').replace(
         '_STAR_', '*').replace('_SEM_', ';').decode('unicode_escape')
     home = expanduser("~")
     home += "\Downloads"
     saved_file = "%s\%s" % (home, path)
     try:
         if path:
             os.remove(saved_file)
         else:
             os.remove("%s\download.txt" % home)
     except OSError:
         pass
     NavigationHelper(self).navigate('Query')
     self.queryHelper.execute_query(check_query)
     self.queryHelper.save_query(path)
     if not path:
         saved_file = "%s\download.txt" % home
     f = open(saved_file, 'r')
     content = f.read()
     self.assertEqual(content,
                      check_query,
                      msg='Incorrect saved query file: %s' % content)
Example #16
0
 def test_add_node(self):
     # kv n1ql moxi index
     services = self.input.param("services", '').split(';')
     error = self.input.param("error", '')
     NavigationHelper(self).navigate('Server Nodes')