-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
All Elasticsearch module tests fail #640
Comments
In Java, we implemented this change regarding default heapsize for ES, so it would probably help here as well? |
Thank you @kiview for quick reply. |
I am not that experienced with the current module structure in the .NET implementation, but in general, if we can identify good default values for a container in the context of integration testing, it generally makes sense to make them part of the default module implementation. |
I would favor to increase the default heap size too. Modules should contain a set of configurations that devs can immediately start. I think it is fine to set or override the env variable, for now. I would not prefer to mount the option files. @kiview what do you think? |
In Java, we copy (don't mount) a default config file into the container before startup: One of the reasons was also about the ENV approach being not a super stable integration point:
|
I will update the PR to have default value set up to minimal required value. I will try all possible ways to do it. |
I am not sure if we can "copy" files like Java does at the moment. If not it would be a good opportunity to add it, otherwise we can simply use the Java approach right away. |
Will investigate .NET possibilities |
It looks like it is not supported yet, but we can add it without much effort I think. We simply copy read-only files (from diff --git a/src/Testcontainers/Containers/TestcontainersContainer.cs b/src/Testcontainers/Containers/TestcontainersContainer.cs
index 2b2a199..a3ca7bd 100644
--- a/src/Testcontainers/Containers/TestcontainersContainer.cs
+++ b/src/Testcontainers/Containers/TestcontainersContainer.cs
@@ -303,6 +303,9 @@ namespace DotNet.Testcontainers.Containers
var id = await this.client.RunAsync(this.configuration, ct)
.ConfigureAwait(false);
+ await this.client.CopyFileAsync(id, "/tmp/foo", Array.Empty<byte>(), 384, 0, 0, ct)
+ .ConfigureAwait(false);
+
return await this.client.InspectContainer(id, ct)
.ConfigureAwait(false);
} OC, we need some more logic to detect which files we copy / directories we mount. |
I was thinking same way but with full implementation. I will push it soon. |
I thought about it too. I think we should move it to _ = Task.WhenAll(configuration.Mounts
.Where(mount => AccessMode.ReadOnly.Equals(mount.AccessMode))
.Where(mount => File.Exists(mount.Source))
.Select(mount => this.CopyFileAsync(id, mount.Target, Array.Empty<byte>(), 420, 0, 0))); Probably we need another property in |
Running the tests on Windows (WSL) I noticed that this issue is not related to the Elasticsearch JVM options. It is a host limitation:
@kiview Do I miss anything? How does tc-java make sure the host is set up correct? |
…annot access same file stream in the same process)
@HofmeisterAn You are completely right, I mixed this up with the other issue we observed in Testcontainers for Java regarding non-optimal default JVM heap settings for Elasticsearch. However, I just tested Docker Desktop with WSL2 backend on my Windows, and the The JVM settings we set are:
So how do you think I should be able to reproduce the error in Java? |
@kiview can you check following: wsl -d docker-desktop
cat /proc/sys/vm/max_map_count |
which is the default low value. So quite interesting that I don't see this issue occur when running the |
Describe the bug
All Elasticsearch module tests fail on clean operating system.
To Reproduce
Steps to reproduce the behavior:
Docker.DotNet.DockerApiException : Docker API responded with status code=Conflict, response={"message":"Container 776f26413636a94482827057706c065e5d697951e882c6a84a0827979d6aea6a is not running"}
Expected behavior
All tests should pass.
Screenshots
Desktop (please complete the following information):
Additional context
Elasticsearch container does not want to start and fail. Container logs provide the following evidences:
As the last log message:
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
It refers to result of bootstrap check service:
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Based on the following discussions there is several ways how to solve it:
The last one contains information regarding disabling the bootstrap check for non production and for low memory clusters. I think this is the best approach to fix tests. I will try to provide a PR to fix this based on last option.
The text was updated successfully, but these errors were encountered: