Skip to content
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

Fixing docker test after changes in PR8431 #8474

Merged
merged 2 commits into from
Feb 1, 2023
Merged

Conversation

andrei-near
Copy link
Contributor

Tested on nayduck worker with:

$ /usr/bin/python3 tests/sanity/docker.py
[2023-01-31 13:54:56] INFO: Build the container
[2023-01-31 13:54:56] DEBUG: + cd /datadrive/nearcore
[..]
[2023-01-31 14:14:28] INFO: Node 0 sees block: #42 DDwMdWZRh2G16kTfPTTTXNYVqiNze3NuXaHs55ncZu9m
[2023-01-31 14:14:28] INFO: #42 DDwMdWZRh2G16kTfPTTTXNYVqiNze3NuXaHs55ncZu9m  (waiting for #42)
[2023-01-31 14:14:28] INFO: Node 1 sees block: #42 DDwMdWZRh2G16kTfPTTTXNYVqiNze3NuXaHs55ncZu9m
[2023-01-31 14:14:28] INFO: #42 DDwMdWZRh2G16kTfPTTTXNYVqiNze3NuXaHs55ncZu9m  (waiting for #42)
[2023-01-31 14:14:28] INFO: Node 2 sees block: #42 DDwMdWZRh2G16kTfPTTTXNYVqiNze3NuXaHs55ncZu9m
[2023-01-31 14:14:28] INFO: All good
[2023-01-31 14:14:28] INFO: Stopping containers
[2023-01-31 14:14:28] DEBUG: + docker rm -f a23b2ec614d93b33f391678c3b5df135db0c441f6e6b069afe7704ed32a7cbce 6d5755d9858a15a5b3c8ae622d16d954c89a166daa8ff8edc8f2a8eea4b6c10e a9727aa2653df96042babd5056fcb9b074a08d82d86704206ed46a110d406b6a
a23b2ec614d93b33f391678c3b5df135db0c441f6e6b069afe7704ed32a7cbce
6d5755d9858a15a5b3c8ae622d16d954c89a166daa8ff8edc8f2a8eea4b6c10e
a9727aa2653df96042babd5056fcb9b074a08d82d86704206ed46a110d406b6a
Untagged: nearcore-testimage-74374b87fc6445408733481d4fee89ca:latest
Deleted: sha256:bbd49ec024b013e3e357c46bca02575387a5abd1d9d7d39320e76a2c07666b35
[2023-01-31 14:14:28] INFO: Cleaning up node 127.0.0.1:24579 on script exit
[2023-01-31 14:14:28] INFO: Executed store validity tests: 0
[2023-01-31 14:14:28] INFO: Due to technical limitations logs from node is not available
[2023-01-31 14:14:28] INFO: Cleaning up node 127.0.0.1:24578 on script exit
[2023-01-31 14:14:28] INFO: Executed store validity tests: 0
[2023-01-31 14:14:28] INFO: Cleaning up node 127.0.0.1:24577 on script exit
[2023-01-31 14:14:28] INFO: Executed store validity tests: 0

@andrei-near andrei-near requested a review from a team as a code owner January 31, 2023 14:29
@jakmeier
Copy link
Contributor

@marcelo-gonzalez could you or someone else from the node team review this please?

Copy link
Contributor

@marcelo-gonzalez marcelo-gonzalez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an alternative could be:

diff --git a/pytest/tests/sanity/docker.py b/pytest/tests/sanity/docker.py
index a1513b2e3..c81e10af9 100644
--- a/pytest/tests/sanity/docker.py
+++ b/pytest/tests/sanity/docker.py
@@ -91,7 +91,10 @@ def docker_run(shell_cmd: typing.Optional[str] = None,
     Returns:
         Command’s stripped standard output if `detach` is true, None otherwise.
     """
-    cmd = ['docker', 'run', '--read-only', f'-v{volume[0]}:{volume[1]}']
+    cmd = [
+        'docker', 'run', '--read-only', f'-v{volume[0]}:{volume[1]}',
+        '--sysctl', 'net.ipv6.conf.all.disable_ipv6=0'
+    ]
 
     # Either run detached or attach standard output and standard error so they
     # are visible.

because what's happening is that 8431 changed the localnet command to bind to an IPV6 addr instead of IPV4. and for some reason disable_ipv6 is set to 1 by default when you pass --network=none

@marcelo-gonzalez
Copy link
Contributor

@marcelo-gonzalez could you or someone else from the node team review this please?

@jakmeier would you mind adding a review too if it looks good to you?

@andrei-near andrei-near force-pushed the fix-docker-test branch 2 times, most recently from 9223b68 to 7d3af8d Compare February 1, 2023 10:04
@andrei-near andrei-near removed the request for review from jakmeier February 1, 2023 10:04
@andrei-near andrei-near self-assigned this Feb 1, 2023
@andrei-near
Copy link
Contributor Author

an alternative could be:

diff --git a/pytest/tests/sanity/docker.py b/pytest/tests/sanity/docker.py
index a1513b2e3..c81e10af9 100644
--- a/pytest/tests/sanity/docker.py
+++ b/pytest/tests/sanity/docker.py
@@ -91,7 +91,10 @@ def docker_run(shell_cmd: typing.Optional[str] = None,
     Returns:
         Command’s stripped standard output if `detach` is true, None otherwise.
     """
-    cmd = ['docker', 'run', '--read-only', f'-v{volume[0]}:{volume[1]}']
+    cmd = [
+        'docker', 'run', '--read-only', f'-v{volume[0]}:{volume[1]}',
+        '--sysctl', 'net.ipv6.conf.all.disable_ipv6=0'
+    ]
 
     # Either run detached or attach standard output and standard error so they
     # are visible.

because what's happening is that 8431 changed the localnet command to bind to an IPV6 addr instead of IPV4. and for some reason disable_ipv6 is set to 1 by default when you pass --network=none

When network is set to host instead of non, this will fail:
docker: Error response from daemon: OCI runtime create failed: sysctl "net.ipv6.conf.all.disable_ipv6" not allowed in host network namespace: unknown.

@andrei-near andrei-near merged commit 0773120 into master Feb 1, 2023
@andrei-near andrei-near deleted the fix-docker-test branch February 1, 2023 16:25
@marcelo-gonzalez
Copy link
Contributor

an alternative could be:

diff --git a/pytest/tests/sanity/docker.py b/pytest/tests/sanity/docker.py
index a1513b2e3..c81e10af9 100644
--- a/pytest/tests/sanity/docker.py
+++ b/pytest/tests/sanity/docker.py
@@ -91,7 +91,10 @@ def docker_run(shell_cmd: typing.Optional[str] = None,
     Returns:
         Command’s stripped standard output if `detach` is true, None otherwise.
     """
-    cmd = ['docker', 'run', '--read-only', f'-v{volume[0]}:{volume[1]}']
+    cmd = [
+        'docker', 'run', '--read-only', f'-v{volume[0]}:{volume[1]}',
+        '--sysctl', 'net.ipv6.conf.all.disable_ipv6=0'
+    ]
 
     # Either run detached or attach standard output and standard error so they
     # are visible.

because what's happening is that 8431 changed the localnet command to bind to an IPV6 addr instead of IPV4. and for some reason disable_ipv6 is set to 1 by default when you pass --network=none

When network is set to host instead of non, this will fail: docker: Error response from daemon: OCI runtime create failed: sysctl "net.ipv6.conf.all.disable_ipv6" not allowed in host network namespace: unknown.

I see... Yeah I guess that might depend on the host setup or something, since it works fine on my computer

nikurt pushed a commit to nikurt/nearcore that referenced this pull request Feb 3, 2023
nikurt pushed a commit to nikurt/nearcore that referenced this pull request Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants