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.ec2: Port tests that depend on common/ec2.nix #79696
Conversation
@GrahamcOfBorg test openstack-image ec2 |
@GrahamcOfBorg test ec2-nixops |
$startCommand .= " -drive file=$diskImage,if=virtio,werror=report"; | ||
$startCommand .= " \$QEMU_OPTS"; | ||
image_dir = os.path.join( | ||
os.environ.get("TMPDIR", tempfile.gettempdir()), "tmp", "vm-state-machine" |
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.
do you know why we create new temporary folders here?
I'd expect it to be due workaround leftover files when invoking nix-build nixos/tests/ec2.nix
, but I'm not sure… Did you check the commit history?
If that's the case, some comment might help.
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 didn't check the history, but it could be to reproduce the behavior of other tests: if you start the test interactively, the VM state files are created in the /tmp/vm-<machine-name>/state
directory.
# again when it deletes link-local addresses.) Ideally we'd | ||
# turn off the DHCP server, but qemu does not have an option | ||
# to do that. | ||
start_command = ( |
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 don't really understand why we invoke qemu here manually - shouldn't that be job of the testing harness and abstracted away entirely? If it's just to pass in the metadata, maybe add a knob in the harness, and wrap the creation of the metadata inside a nix derivation, instead of the test driver script?
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 don't know much about the amazon ami image stuff in nixpkgs. But my guess is that the image that config.system.build.amazonImage
create is a format that qemu doesn't directly consume, so the test creates a .qcow1 file.
And then, that together with the DHCP foo and webservice is a bit too much for the normal machine abstraction.
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 think a new qemu image is created because the provided image is readonly since it is in the store. This new qemu image uses "copy on write" from provided image.
Then, a comment mentions an issue with the qemu embeded dhcp server. To make it working, the network configuration of the machine needs to be explicitly specified.
I think this use case is really different from other NIxOS tests because we use a prebuilt image (no shared store...), and we need to do some tricks on the network configuration of the machine. This could explain why this test is a bit different!
@GrahamcOfBorg test ec2-config |
@nlewo would you be able to take a look at this? |
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.
Thanks for this PR!
$startCommand .= " -drive file=$diskImage,if=virtio,werror=report"; | ||
$startCommand .= " \$QEMU_OPTS"; | ||
image_dir = os.path.join( | ||
os.environ.get("TMPDIR", tempfile.gettempdir()), "tmp", "vm-state-machine" |
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 didn't check the history, but it could be to reproduce the behavior of other tests: if you start the test interactively, the VM state files are created in the /tmp/vm-<machine-name>/state
directory.
# again when it deletes link-local addresses.) Ideally we'd | ||
# turn off the DHCP server, but qemu does not have an option | ||
# to do that. | ||
start_command = ( |
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 think a new qemu image is created because the provided image is readonly since it is in the store. This new qemu image uses "copy on write" from provided image.
Then, a comment mentions an issue with the qemu embeded dhcp server. To make it working, the network configuration of the machine needs to be explicitly specified.
I think this use case is really different from other NIxOS tests because we use a prebuilt image (no shared store...), and we need to do some tricks on the network configuration of the machine. This could explain why this test is a bit different!
I rebased on master and couldn't get it to build:
|
@tfc can you rebase this and give it another look? |
This test wants to download things from the internet while building the system. It can probably be fixed by ensuring these paths are present in the initial nix-store.
It seems the merge conflicts resolved themselves (or GitHub doesn't show a Anyhow - I assume more things need to be added to the initial closure to make it succeed, but the "porting parts" of this test seem to be fine. I'll mark |
I opened #96069 to unbreak nixosTests.ec2-config. |
Motivation for this change
#72828
This is a bundle of ports because it is not possible to port only a portion of the tests that depend on common/ec2.nix unfortunately.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)