def METHOD_NAME(cache_dir):
    """
    Tests if the CacheDisk can survive a corrupted cache file.
    """
    # Write valid cache file
    cache_file = cache_dir / "minion"
    cd = cache.CacheDisk(0.3, str(cache_file))
    cd["test-key"] = "test-value"
    del cd
    # Add random string to the data to make the msgpack structure un-decodable
    with cache_file.open("a") as f:
        f.write("I am data that should corrupt the msgpack file")
    # Reopen cache, try to fetch key
    cd = cache.CacheDisk(0.3, str(cache_file))
    # If the cache is unreadable, we want it to act like an empty cache (as
    # if the file did not exist in the first place), and should raise a KeyError
    with pytest.raises(KeyError):
        assert cd["test-key"]