def METHOD_NAME(self):
    """Test that cache is updated as expected on resolved env."""
    pkgcache = self._pkgcache()
    with restore_os_environ():
        # set config settings into env so rez-pkg-cache proc sees them
        os.environ.update(self.get_settings_env())
        # Creating the context will asynchronously add variants to the cache
        # in a separate proc.
        #
        c = ResolvedContext([
            "timestamped-1.2.0",
            "pyfoo-3.1.0"  # won't cache, see earlier test
        ])
    variant = c.get_resolved_package("timestamped")
    # Retry 50 times with 0.1 sec interval, 5 secs is more than enough for
    # the very small variant to be copied to cache.
    #
    cached_root = None
    for _ in range(50):
        time.sleep(0.1)
        cached_root = pkgcache.get_cached_root(variant)
        if cached_root:
            break
    self.assertNotEqual(cached_root, None)
    expected_payload_file = os.path.join(cached_root, "stuff.txt")
    self.assertTrue(os.path.exists(expected_payload_file))
    # check that refs to root point to cache location in rex code
    for ref in ("resolve.timestamped.root", "'{resolve.timestamped.root}'"):
        proc = c.execute_rex_code(
            code="info(%s)" % ref,
            stdout=subprocess.PIPE,
            universal_newlines=True
        )
        out, _ = proc.communicate()
        root = out.strip()
        self.assertEqual(
            root, cached_root,
            "Reference %r should resolve to %s, but resolves to %s"
            % (ref, cached_root, root)
        )