mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 09:04:17 +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
70 lines
2.3 KiB
Nix
70 lines
2.3 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, lib, ... }:
|
|
|
|
let
|
|
apikey = "testapikey";
|
|
in
|
|
{
|
|
name = "octoprint";
|
|
meta.maintainers = with lib.maintainers; [ gador ];
|
|
|
|
nodes.machine =
|
|
{ pkgs, ... }:
|
|
{
|
|
environment.systemPackages = with pkgs; [ jq ];
|
|
services.octoprint = {
|
|
enable = true;
|
|
extraConfig = {
|
|
server = {
|
|
firstRun = false;
|
|
};
|
|
api = {
|
|
enabled = true;
|
|
key = apikey;
|
|
};
|
|
plugins = {
|
|
# these need internet access and pollute the output with connection failed errors
|
|
_disabled = [
|
|
"softwareupdate"
|
|
"announcements"
|
|
"pluginmanager"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
import json
|
|
|
|
@polling_condition
|
|
def octoprint_running():
|
|
machine.succeed("pgrep octoprint")
|
|
|
|
with subtest("Wait for octoprint service to start"):
|
|
machine.wait_for_unit("octoprint.service")
|
|
machine.wait_until_succeeds("pgrep octoprint")
|
|
|
|
with subtest("Wait for final boot"):
|
|
# this appears whe octoprint is almost finished starting
|
|
machine.wait_for_file("/var/lib/octoprint/uploads")
|
|
|
|
# octoprint takes some time to start. This makes sure we'll retry just in case it takes longer
|
|
# retry-all-errors in necessary, since octoprint will report a 404 error when not yet ready
|
|
curl_cmd = "curl --retry-all-errors --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 \
|
|
--retry-max-time 40 -X GET --header 'X-API-Key: ${apikey}' "
|
|
|
|
# used to fail early, in case octoprint first starts and then crashes
|
|
with octoprint_running: # type: ignore[union-attr]
|
|
with subtest("Check for web interface"):
|
|
machine.wait_until_succeeds("curl -s localhost:5000")
|
|
|
|
with subtest("Check API"):
|
|
version = json.loads(machine.succeed(curl_cmd + "localhost:5000/api/version"))
|
|
server = json.loads(machine.succeed(curl_cmd + "localhost:5000/api/server"))
|
|
assert version["server"] == str("${pkgs.octoprint.version}")
|
|
assert server["safemode"] == None
|
|
'';
|
|
}
|
|
)
|