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.wordpress: port to python #73993
Conversation
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.
nixos/tests/wordpress.nix
Outdated
machine.succeed( | ||
"systemctl --no-pager show wordpress-init-site1.local.service | grep 'ExecStart=.*status=0'" | ||
) | ||
machine.succeed( | ||
"systemctl --no-pager show wordpress-init-site2.local.service | grep 'ExecStart=.*status=0'" | ||
) | ||
machine.succeed( | ||
"grep -E '^define.*NONCE_SALT.{64,};\$' /var/lib/wordpress/site1.local/secret-keys.php" | ||
) | ||
machine.succeed( | ||
"grep -E '^define.*NONCE_SALT.{64,};\$' /var/lib/wordpress/site2.local/secret-keys.php" | ||
) |
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 only thing that defers between these two commands is the service name being 1
or 2
or this directory having site{number}
.
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.
True. something like this might be nice:
for nr in 1, 2:
machine.wait_for_unit(f"phpfpm-wordpress-site{nr}.local")
machine.succeed(
f"curl -L site{nr}.local | grep 'Welcome to the famous'",
...
)
@GrahamcOfBorg test wordpress |
@aanderse I don't currently run any Wordpress instances, but feel free to add me as a maintainer of the test for the time being. Hopefully I could be of help now that it's written in language I know how to use;) |
79e9514
to
e2ddd2e
Compare
@mmilata I added you to the maintainers list, and also did some more refactoring to use assertions and @worldofpeace, @mmilata, PTAL. |
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!
e2ddd2e
to
069364f
Compare
Hm, I broke forgot a |
@flokli Thanks. I hope we can have more of the tests not using |
Umm, this test had some issue and didn't even succeed on all test cases. |
with subtest("wordpress-init went through"): | ||
for site_name in site_names: | ||
info = machine.get_unit_info(f"wordpress-init-{site_name}") | ||
assert info.Result == "success" |
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 a dict so you'd have to do
assert info["Result"] == "success"
to not get an error.
assert info.Result == "success" | ||
|
||
with subtest("secret keys are set"): | ||
re.compile(r"^define.*NONCE_SALT.{64,};$") |
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.
not sure what the r
is here but you probably wanted to assign this to a variable so you could you it.
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.
It's raw string literal that doesn't interpret backslash escapes which is useful when working with regular expressions.
Proposed fix: #74086
Motivation for this change
#72828
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @