mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
75 lines
2.4 KiB
Nix
75 lines
2.4 KiB
Nix
import ../make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
{
|
|
name = "lxd-ui";
|
|
|
|
nodes.machine =
|
|
{ lib, ... }:
|
|
{
|
|
virtualisation = {
|
|
lxd.enable = true;
|
|
lxd.ui.enable = true;
|
|
};
|
|
|
|
environment.systemPackages =
|
|
let
|
|
seleniumScript =
|
|
pkgs.writers.writePython3Bin "selenium-script"
|
|
{
|
|
libraries = with pkgs.python3Packages; [ selenium ];
|
|
}
|
|
''
|
|
from selenium import webdriver
|
|
from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.firefox.options import Options
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
|
|
options = Options()
|
|
options.add_argument("--headless")
|
|
service = webdriver.FirefoxService(executable_path="${lib.getExe pkgs.geckodriver}") # noqa: E501
|
|
|
|
driver = webdriver.Firefox(options=options, service=service)
|
|
driver.implicitly_wait(10)
|
|
driver.get("https://localhost:8443/ui")
|
|
|
|
wait = WebDriverWait(driver, 60)
|
|
|
|
assert len(driver.find_elements(By.CLASS_NAME, "l-application")) > 0
|
|
assert len(driver.find_elements(By.CLASS_NAME, "l-navigation__drawer")) > 0
|
|
|
|
driver.close()
|
|
'';
|
|
in
|
|
with pkgs;
|
|
[
|
|
curl
|
|
firefox-unwrapped
|
|
geckodriver
|
|
seleniumScript
|
|
];
|
|
};
|
|
|
|
testScript = ''
|
|
machine.wait_for_unit("sockets.target")
|
|
machine.wait_for_unit("lxd.service")
|
|
machine.wait_for_file("/var/lib/lxd/unix.socket")
|
|
|
|
# Wait for lxd to settle
|
|
machine.succeed("lxd waitready")
|
|
|
|
# Configure LXC listen address
|
|
machine.succeed("lxc config set core.https_address :8443")
|
|
machine.succeed("systemctl restart lxd")
|
|
|
|
# Check that the LXD_UI environment variable is populated in the systemd unit
|
|
machine.succeed("cat /etc/systemd/system/lxd.service | grep 'LXD_UI'")
|
|
|
|
# Ensure the endpoint returns an HTML page with 'LXD UI' in the title
|
|
machine.succeed("curl -kLs https://localhost:8443/ui | grep '<title>LXD UI</title>'")
|
|
|
|
# Ensure the application is actually rendered by the Javascript
|
|
machine.succeed("PYTHONUNBUFFERED=1 selenium-script")
|
|
'';
|
|
}
|
|
)
|