@Test
    void testNoCachingOfErrorRequests() {
        ConfigTester tester = new ConfigTester();
        // Simulate an error response
        source.put(fooConfig.getKey(), createConfigWithNextConfigGeneration(fooConfig, ErrorCode.INTERNAL_ERROR));

        MemoryCache memoryCache = proxy.memoryCache();
        assertEquals(0, memoryCache.size());

        RawConfig res = proxy.resolveConfig(tester.createRequest(fooConfig)).orElseThrow();
        assertNotNull(res.getPayload());
        assertTrue(res.isError());
        assertEquals(0, memoryCache.size());

        // Put a version of the same config into backend without error and see that it now works (i.e. we are
        // not getting a cached response (of the error in the previous request)
        source.put(fooConfig.getKey(), createConfigWithNextConfigGeneration(fooConfig, 0));

        // Verify that we get the config now and that it is cached
        res = proxy.resolveConfig(tester.createRequest(fooConfig)).orElseThrow();
        assertNotNull(res.getPayload().getData());
        assertEquals(ConfigTester.fooPayload.toString(), res.getPayload().toString());
        assertEquals(1, memoryCache.size());

        JRTServerConfigRequest newRequestBasedOnResponse = tester.createRequest(res);
        RawConfig res2 = proxy.resolveConfig(newRequestBasedOnResponse).orElseThrow();
        assertFalse(ProxyServer.configOrGenerationHasChanged(res2, newRequestBasedOnResponse));
        assertEquals(1, memoryCache.size());
    }
Verifies that error responses are not cached. When the config has been successfully retrieved,
it must be updated in cache.
config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java