示例#1
0
    def test_cuboids_exist_with_cache_miss(self, fake_get_region):
        """Test method for checking if cuboids exist in S3 index while supporting
        the cache miss key index parameter"""
        os = AWSObjectStore(self.object_store_config)

        expected_keys = [
            "CACHED-CUBOID&1&1&1&0&0&12", "CACHED-CUBOID&1&1&1&0&0&13",
            "CACHED-CUBOID&1&1&1&0&0&14"
        ]
        test_keys = [
            "CACHED-CUBOID&1&1&1&0&0&100", "CACHED-CUBOID&1&1&1&0&0&13",
            "CACHED-CUBOID&1&1&1&0&0&14", "CACHED-CUBOID&1&1&1&0&0&15"
        ]

        expected_object_keys = os.cached_cuboid_to_object_keys(expected_keys)

        # Populate table
        for k in expected_object_keys:
            os.add_cuboid_to_index(k)

        # Check for keys
        exist_keys, missing_keys = os.cuboids_exist(test_keys, [1, 2])

        assert exist_keys == [1, 2]
        assert missing_keys == []
示例#2
0
    def test_cuboids_exist(self):
        """Test method for checking if cuboids exist in S3 index"""
        os = AWSObjectStore(self.object_store_config)

        expected_keys = ["CACHED-CUBOID&1&1&1&0&0&12", "CACHED-CUBOID&1&1&1&0&0&13", "CACHED-CUBOID&1&1&1&0&0&14"]
        test_keys = ["CACHED-CUBOID&1&1&1&0&0&100", "CACHED-CUBOID&1&1&1&0&0&13", "CACHED-CUBOID&1&1&1&0&0&14",
                     "CACHED-CUBOID&1&1&1&0&0&15"]

        expected_object_keys = os.cached_cuboid_to_object_keys(expected_keys)

        # Populate table
        for k in expected_object_keys:
            os.add_cuboid_to_index(k)

        # Check for keys
        exist_keys, missing_keys = os.cuboids_exist(test_keys)

        assert exist_keys == [1, 2]
        assert missing_keys == [0, 3]