-
-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
nixosTests.containers*: port rest to python #74761
Conversation
|
||
# Status of the webserver container. | ||
$machine->succeed("nixos-container status webserver") =~ /up/ or die; | ||
with subtest("Status of the webserver container"): |
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.
in failure cases, the subtest title should ideally tell you what the high-level expectations are. While the container will have some kind of status, it is most helpful when the title says "Status of webserver container is UP".
$machine->succeed("ip link show veth1") =~ /master br1/ or die; | ||
with subtest("Ensure the veth1 is part of br1 on the host"): | ||
out = machine.succeed("ip link show veth1") | ||
assert "master br1" in out | ||
|
||
# Debug |
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.
there's a lot to comment out in debug cases. Is it likely that all these prints will help in case this test fails in the future? if so, why not add some constant DEBUG_OUTPUT
in the beginning of the test and then put these commands into some conditional - then the debugging user can simply set one variable to True
and get it all with less work.
server.wait_for_unit("default.target") | ||
server.succeed("ip link show dev eth1 >&2") | ||
|
||
with subtest("simple physical interface"): |
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.
with subtest("simple physical interface"): | |
with subtest("Simple physical interface is up"): |
# that the device is present in the container. | ||
server.succeed("nixos-container run server -- ip a show dev eth1 >&2") | ||
|
||
with subtest("physical device in bridge in container"): |
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.
"...is up" or "...can be pinged" or something.
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.
Please change the subtest titles in a way that they tell the user more about the high level expectations
2ede8fd
to
e32692f
Compare
@tfc fixed, please take a look |
@tfc not sure I follow. Like changing this
into
? |
@mmilata more like: machine.succeed(
"ping -n -c 1 192.168.0.100",
"ping -n -c 1 fc00::2"
) |
e32692f
to
931a305
Compare
@tfc oh, I had no idea |
|
||
# Destroying a declarative container should fail. | ||
$machine->fail("nixos-container destroy webserver"); | ||
DEBUG_OUTPUT = False |
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 (and the conditionals further down) should probably go away.
DEBUG_OUTPUT = False | ||
|
||
machine.wait_for_unit("default.target") | ||
out = machine.succeed("nixos-container list") |
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.
I'd better call it output
, out
is too similar to $out
;-)
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.
I've changed this to assert "substr" in machine.succeed("cmd")
which seems to be widely used.
@mmilata could you adress the requested changes? Would be nice to merge this in :-) |
931a305
to
6fbb76c
Compare
@flokli sure, PTAL |
import ./make-test.nix ({ pkgs, ...} : { | ||
name = "containers-bridge"; | ||
import ./make-test-python.nix ({ pkgs, ...} : { | ||
name = "containers-extra_veth"; |
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.
Nice catch, thanks!
Motivation for this change
#72828
Things done
sandbox
innix.conf
on non-NixOS linux)Notify maintainers
cc @kampfschlaefer @tfc @flokli @worldofpeace