I've added a commit that properly tests the image cache in EC2. It is tricky because in EC2 images are filtered by owner by default, and the images created by the ImageExtension are owned by the current user. When the image cache is refreshed due to the session expiration, the created image is no longer found (the current user is not in the list of queried owners, and we don't want to rebuild the context as we want to test the singleton image cache).
The test in EC2 directly inspects the ImageCache using reflection to avoid falling back to its lazy loading and avoiding an eventual cache refresh. This is the latest change. I've tested several providers and in all them the new tests for the ImageCache are working as expected. I'll merge this PR once the build is green. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/885#issuecomment-172691355
