-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ehcache to latest #531
Conversation
We need to depend on a core library now, as it is no longer pulled in as a dependency of the clustered library. Statistics are now an internal class, which doesn't feel very nice as it may change between versions. https://stackoverflow.com/a/40462767/6509
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This crashes terracotta-oss with
Searching for that error, led me to Terracotta-OSS/docker#3 Which is the same issue, in a (recently archived) project for building the docker image (also has a commit from graeme backing out an ehcache update for this reason) Someone raised this in another terracotta repo Terracotta-OSS/terracotta-platform#994 and it got closed with no response... Not sure if Terracotta is DOA... And if not if it will support ehcache 3.11... And if so, how we can replace the test |
Ok, updated the terracotta server we use in test via: diff --git a/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy b/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy
index c6287f88..e62d5d73 100644
--- a/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy
+++ b/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy
@@ -20,6 +20,8 @@ import io.micronaut.context.ApplicationContext
import org.ehcache.CacheManager
import org.ehcache.clustered.client.config.ClusteringServiceConfiguration
import org.testcontainers.containers.GenericContainer
+import org.testcontainers.containers.Network
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy
import org.testcontainers.spock.Testcontainers
import spock.lang.Specification
@@ -28,13 +30,31 @@ import static org.ehcache.clustered.client.config.ClusteredResourceType.Types.*
@Testcontainers
class EhcacheClusteredSpec extends Specification {
- public GenericContainer terracotta = new GenericContainer("terracotta/terracotta-server-oss:5.6.4")
+ public Network network = Network.newNetwork()
+
+ public GenericContainer terracotta = new GenericContainer("softwareag/terracotta-server:10.15.0.0")
+ .withEnv(ACCEPT_EULA: "Y")
+ .withNetwork(network)
+ .withNetworkAliases("terracotta")
.withExposedPorts(9410)
+ def setup() {
+ terracotta.start()
+ new GenericContainer("softwareag/terracotta-config-tool:10.15.0.0")
+ .withCommand("activate", "-n", "MyCluster", "-s", "terracotta")
+ .withNetwork(network)
+ .withEnv(
+ ACCEPT_EULA: "Y",
+ LICENSE_URL: "https://www.terracotta.org/retriever.php?n=TerracottaDB101linux.xml",
+ )
+ .waitingFor(new LogMessageWaitStrategy().withRegEx(".*Command successful!.*"))
+ .start()
+ }
+
void "it can create a clustered cache"() {
given:
ApplicationContext ctx = ApplicationContext.run([
- "ehcache.cluster.uri": "terracotta://localhost:${terracotta.firstMappedPort}/my-application",
+ "ehcache.cluster.uri": "terracotta://localhost:${terracotta.getMappedPort(9410)}/my-application",
"ehcache.cluster.default-server-resource": "offheap-1",
"ehcache.cluster.resource-pools.resource-pool-a.max-size": "8Mb",
"ehcache.cluster.resource-pools.resource-pool-a.server-resource": "offheap-2", But now it fails as the client is too old for terracotta
Currently out of ideas... |
It seems to me that we no longer can use If you download Ehcache 3.10 with clustering kit, and start it as mentioned in the docs, it starts Terracotta 5.8.5. That's the version needed. Have you found a Docker image that has that? |
@alvarosanchez No I've not found one... terracotta-oss seems to stop at 5.6.4, and the softwareag one seems to be on 10.x.x |
I've done a quick build with what comes with 3.10.0. Give |
The docker image at https://hub.docker.com/r/softwareag/terracotta-server is the enterprise version of Terracotta server with free trial license. The 10.15 is the enterprise version and should work with ehcache 3.10. |
@AbfrmBlr but it doesn't work:
|
@alvarosanchez looking into it, will update shortly. |
Hello guys, Ehcache OSS Docker images have been published just now at https://hub.docker.com/u/terracotta/ with instructions on how to use them. Also, instructions on how to build our own docker images based on a Ehcache ZIP distribution have been merged (ehcache/ehcache3#3105), with some script inside to build the images and test them. WARNING: The way to start and configure the server has changed since. But if you just need 1 active server in availability mode to run some tests, you can just start a server with:
Then from another container in the same network you can connect to the server using URI If test are not ran from a docker container, you could otherwise expose a port and in this case connect to
We support OpenShift security model - you can run with any uid in group 0 (i.e. Let me know if you need anything else @alvarosanchez / @timyates :-) |
@timyates can you revisit this PR? |
# Conflicts: # gradle/libs.versions.toml
This is my version of @timyates patch diff --git a/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy b/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy
--- a/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy (revision 70c4aff138b2d76e764bbc6d1efbdad163b9cc1f)
+++ b/cache-ehcache/src/test/groovy/io/micronaut/cache/ehcache/EhcacheClusteredSpec.groovy (date 1685736310998)
@@ -20,6 +20,8 @@
import org.ehcache.CacheManager
import org.ehcache.clustered.client.config.ClusteringServiceConfiguration
import org.testcontainers.containers.GenericContainer
+import org.testcontainers.containers.Network
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy
import org.testcontainers.spock.Testcontainers
import spock.lang.Specification
@@ -28,13 +30,34 @@
@Testcontainers
class EhcacheClusteredSpec extends Specification {
- public GenericContainer terracotta = new GenericContainer("terracotta/terracotta-server-oss:5.6.4")
+ public Network network = Network.newNetwork()
+
+ public GenericContainer terracotta = new GenericContainer("terracotta/ehcache-terracotta-server:3.10.8")
+ .withEnv(ACCEPT_EULA: "Y")
+ .withNetwork(network)
+ .withNetworkAliases("terracotta-net")
.withExposedPorts(9410)
+ def setup() {
+ terracotta.start()
+ new GenericContainer("terracotta/ehcache-terracotta-server:3.10.8")
+ .withCommand("-e", "DEFAULT_ACTIVATE=true",
+ "-h", "ehcache-terracotta-server",
+ "--network", "terracotta-net",
+ "--name", "ehcache-terracotta-server")
+ .withNetwork(network)
+ .withEnv(
+ ACCEPT_EULA: "Y",
+ LICENSE_URL: "https://www.terracotta.org/retriever.php?n=TerracottaDB101linux.xml",
+ )
+ .waitingFor(new LogMessageWaitStrategy().withRegEx(".*Command successful!.*"))
+ .start()
+ }
+
void "it can create a clustered cache"() {
given:
ApplicationContext ctx = ApplicationContext.run([
- "ehcache.cluster.uri": "terracotta://localhost:${terracotta.firstMappedPort}/my-application",
+ "ehcache.cluster.uri": "terracotta://localhost:${terracotta.getMappedPort(9410)}/my-application",
"ehcache.cluster.default-server-resource": "offheap-1",
"ehcache.cluster.resource-pools.resource-pool-a.max-size": "8Mb",
"ehcache.cluster.resource-pools.resource-pool-a.server-resource": "offheap-2",
|
FYI
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
We need to depend on a core library now, as it is no longer pulled in as a dependency of the clustered library.
Statistics are now an internal class, which doesn't feel very nice as it may change between versions.
https://stackoverflow.com/a/40462767/6509