示例#1
0
    def test_wait_for_page_in(self):
        """Test to make sure waiting for all the keys to be paged in works properly"""
        # Create test instance
        csdb1 = CacheStateDB(self.config_data)
        csdb2 = CacheStateDB(self.config_data)

        # Create page in channel in the first instance
        ch = csdb1.create_page_in_channel()

        # Publish a message
        csdb2.notify_page_in_complete(ch, "MY_TEST_KEY1")
        csdb2.notify_page_in_complete(ch, "MY_TEST_KEY2")

        # Wait for page in
        csdb1.wait_for_page_in(["MY_TEST_KEY1", "MY_TEST_KEY2"], ch, 5)
示例#2
0
    def test_wait_for_page_in(self):
        """Test to make sure waiting for all the keys to be paged in works properly"""
        # Create test instance
        csdb1 = CacheStateDB(self.config_data)
        csdb2 = CacheStateDB(self.config_data)

        # Create page in channel in the first instance
        ch = csdb1.create_page_in_channel()

        # Publish a message
        csdb2.notify_page_in_complete(ch, "MY_TEST_KEY1")
        csdb2.notify_page_in_complete(ch, "MY_TEST_KEY2")

        # Wait for page in
        csdb1.wait_for_page_in(["MY_TEST_KEY1", "MY_TEST_KEY2"], ch, 5)
示例#3
0
    def test_page_in_channel(self):
        """Test Page in channel creation and basic message passing"""
        # Create test instance
        csdb1 = CacheStateDB(self.config_data)
        csdb2 = CacheStateDB(self.config_data)

        # Create page in channel in the first instance
        ch = csdb1.create_page_in_channel()
        time.sleep(1.5)

        # Publish a message
        csdb2.notify_page_in_complete(ch, "MY_TEST_KEY")

        # Get message (ignore first message which is the subscribe)
        while True:
            msg = csdb1.status_client_listener.get_message()
            if not msg:
                continue
            if msg['type'] == "message":
                break

        assert msg['channel'].decode() == ch
        assert msg['data'].decode() == "MY_TEST_KEY"
示例#4
0
    def test_page_in_channel(self):
        """Test Page in channel creation and basic message passing"""
        # Create test instance
        csdb1 = CacheStateDB(self.config_data)
        csdb2 = CacheStateDB(self.config_data)

        # Create page in channel in the first instance
        ch = csdb1.create_page_in_channel()
        time.sleep(1.5)

        # Publish a message
        csdb2.notify_page_in_complete(ch, "MY_TEST_KEY")

        # Get message (ignore first message which is the subscribe)
        while True:
            msg = csdb1.status_client_listener.get_message()
            if not msg:
                continue
            if msg['type'] == "message":
                break

        assert msg['channel'].decode() == ch
        assert msg['data'].decode() == "MY_TEST_KEY"