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
tests/lib: introduce helpers for setting up /dev/random using /dev/urandom in project prepare #4354
Conversation
…andom in project prepare The hosts used for testing may run out of entropy in /dev/random, thus causing any crypto operations to potentially block. Since we do not need a high quality RNG source for the tests, set up /dev/random to be the same as /dev/urandom in project prepare and restore it back to the proper state in project restore phase. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
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.
+1 with note, please check before merging
tests/lib/random.sh
Outdated
mknod /dev/random c 1 9 | ||
} | ||
|
||
restore_dev_random() { |
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.
This is probably not correct since some distributions don't use proper random devices. We should probably mv /dev/random /dev/random.bak or .orig and then mv them back.
In any case, this is my suggestion, LGTM
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Codecov Report
@@ Coverage Diff @@
## master #4354 +/- ##
=======================================
Coverage 78.05% 78.05%
=======================================
Files 450 450
Lines 30899 30899
=======================================
Hits 24118 24118
Misses 4772 4772
Partials 2009 2009 Continue to review full report at Codecov.
|
We have set up /dev/urandom device as /dev/random. No improve entropy anymore. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
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.
LGTM
@@ -252,30 +252,6 @@ EOF | |||
systemctl start snapd.socket | |||
fi | |||
|
|||
if [[ "$SPREAD_SYSTEM" == debian-* || "$SPREAD_SYSTEM" == ubuntu-* ]]; then |
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.
Ha, much much nicer :)
# keep the original /dev/random around | ||
mv /dev/random /dev/random.orig | ||
# same as /dev/urandom | ||
mknod /dev/random c 1 9 |
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.
The device numbers are valid for urandom
mkpinentry.sh script is using MATCH, but this is not defined when running in a subshell. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
gpg-agent stuck in blocking read from /dev/random does not react to SIGTERM, use SIGKILL instead. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
…ated to /dev/random Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Avoid potential issues with gpg-agent being stuck by tests that ran previously and make sure that we get a freshly started agent. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
…ch task Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Well, at least it didn't timeout this time. The tasks that were getting stuck before, all passed now. What has failed is:
Looks unrelated, so I've restarted the build. |
FWIW, the travis job was filing before as the create-key/snap-sign/completion prepare were taking too long. Collected debug output suggests that the /dev/random node was not changed at all. This is either the Debug log in question:
|
These packages are not used any more after PR snapcore#4354
The hosts used for testing may run out of entropy in /dev/random, thus causing
any crypto operations to potentially block. Since we do not need a high quality
RNG source for the tests, set up /dev/random to be the same as /dev/urandom in
project prepare and restore it back to the proper state in project restore
phase.