Example #1
0
    def _check_blacklisted_tables(self, tablet, expected):
        status = tablet.get_status()
        if expected:
            self.assertIn("BlacklistedTables: %s" % " ".join(expected), status)
        else:
            self.assertNotIn("BlacklistedTables", status)

        # check we can or cannot access the tables
        utils.run_vtctl(['ReloadSchema', tablet.tablet_alias])
        for t in ["moving1", "moving2"]:
            if expected and "moving.*" in expected:
                # table is blacklisted, should get the error
                out, err = tablet.vquery("select count(1) from %s" % t,
                                         path='source_keyspace/0',
                                         raise_on_error=False)
                self.assertTrue(
                    err.find(
                        "retry: Query disallowed due to rule: enforce blacklisted tables"
                    ) != -1,
                    "Cannot find the right error message in query for blacklisted table: out=\n%serr=\n%s"
                    % (out, err))
            else:
                # table is not blacklisted, should just work
                tablet.vquery("select count(1) from %s" % t,
                              path='source_keyspace/0')
Example #2
0
    def _check_blacklisted_tables(self, tablet, expected):
        ti = utils.run_vtctl_json(['GetTablet', tablet.tablet_alias])
        logging.debug("Tablet %s has blacklisted tables: %s",
                      tablet.tablet_alias, ti['BlacklistedTables'])
        if ti['BlacklistedTables'] == []:
            ti['BlacklistedTables'] = None
        self.assertEqual(
            ti['BlacklistedTables'], expected,
            "Got unexpected BlacklistedTables: %s (expecting %s)" %
            (ti['BlacklistedTables'], expected))

        # check we can or cannot access the tables
        utils.run_vtctl(['ReloadSchema', tablet.tablet_alias])
        for t in ["moving1", "moving2"]:
            if expected and "moving.*" in expected:
                # table is blacklisted, should get the error
                out, err = tablet.vquery("select count(1) from %s" % t,
                                         path='source_keyspace/0',
                                         raise_on_error=False)
                self.assertTrue(
                    err.find(
                        "retry: Query disallowed due to rule: enforce blacklisted tables"
                    ) != -1,
                    "Cannot find the right error message in query for blacklisted table: out=\n%serr=\n%s"
                    % (out, err))
            else:
                # table is not blacklisted, should just work
                tablet.vquery("select count(1) from %s" % t,
                              path='source_keyspace/0')
Example #3
0
  def _check_blacklisted_tables(self, tablet, expected):
    status = tablet.get_status()
    if expected:
      self.assertIn("BlacklistedTables: %s" % " ".join(expected), status)
    else:
      self.assertNotIn("BlacklistedTables", status)

    # check we can or cannot access the tables
    utils.run_vtctl(['ReloadSchema', tablet.tablet_alias])
    for t in ["moving1", "moving2"]:
      if expected and "moving.*" in expected:
        # table is blacklisted, should get the error
        out, err = tablet.vquery("select count(1) from %s" % t,
                                 path='source_keyspace/0', raise_on_error=False)
        self.assertTrue(err.find("retry: Query disallowed due to rule: enforce blacklisted tables") != -1, "Cannot find the right error message in query for blacklisted table: out=\n%serr=\n%s" % (out, err))
      else:
        # table is not blacklisted, should just work
        tablet.vquery("select count(1) from %s" % t, path='source_keyspace/0')
Example #4
0
  def _check_blacklisted_tables(self, tablet, expected):
    ti = utils.run_vtctl_json(['GetTablet', tablet.tablet_alias])
    logging.debug("Tablet %s has blacklisted tables: %s", tablet.tablet_alias,
                  ti['BlacklistedTables'])
    self.assertEqual(ti['BlacklistedTables'], expected,
                     "Got unexpected BlacklistedTables: %s (expecting %s)" %(
                         ti['BlacklistedTables'], expected))

    # check we can or cannot access the tables
    utils.run_vtctl(['ReloadSchema', tablet.tablet_alias])
    for t in ["moving1", "moving2"]:
      if expected and t in expected:
        # table is blacklisted, should get the error
        out, err = tablet.vquery("select count(1) from %s" % t,
                                 path='source_keyspace/0', raise_on_error=False)
        self.assertTrue(err.find("Query disallowed due to rule: enforce blacklisted tables") != -1, "Cannot find the right error message in query for blacklisted table: out=\n%serr=\n%s" % (out, err))
      else:
        # table is not blacklisted, should just work
        tablet.vquery("select count(1) from %s" % t, path='source_keyspace/0')