Skip to content

Commit

Permalink
Merge pull request #247823 from emilylange/caddy
Browse files Browse the repository at this point in the history
  • Loading branch information
fpletz authored Aug 8, 2023
2 parents 96920fb + efdcf6b commit 7fdf825
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 48 deletions.
44 changes: 0 additions & 44 deletions nixos/tests/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ import ./make-test-python.nix ({ pkgs, ... }: {
'';
services.caddy.enableReload = true;

specialisation.etag.configuration = {
services.caddy.extraConfig = lib.mkForce ''
http://localhost {
encode gzip
file_server
root * ${
pkgs.runCommand "testdir2" {} ''
mkdir "$out"
echo changed > "$out/example.html"
''
}
}
'';
};

specialisation.config-reload.configuration = {
services.caddy.extraConfig = ''
http://localhost:8080 {
Expand All @@ -55,7 +39,6 @@ import ./make-test-python.nix ({ pkgs, ... }: {

testScript = { nodes, ... }:
let
etagSystem = "${nodes.webserver.system.build.toplevel}/specialisation/etag";
justReloadSystem = "${nodes.webserver.system.build.toplevel}/specialisation/config-reload";
multipleConfigs = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-configs";
in
Expand All @@ -65,33 +48,6 @@ import ./make-test-python.nix ({ pkgs, ... }: {
webserver.wait_for_open_port(80)
def check_etag(url):
etag = webserver.succeed(
"curl --fail -v '{}' 2>&1 | sed -n -e \"s/^< [Ee][Tt][Aa][Gg]: *//p\"".format(
url
)
)
etag = etag.replace("\r\n", " ")
http_code = webserver.succeed(
"curl --fail --silent --show-error -o /dev/null -w \"%{{http_code}}\" --head -H 'If-None-Match: {}' {}".format(
etag, url
)
)
assert int(http_code) == 304, "HTTP code is {}, expected 304".format(http_code)
return etag
with subtest("check ETag if serving Nix store paths"):
old_etag = check_etag(url)
webserver.succeed(
"${etagSystem}/bin/switch-to-configuration test >&2"
)
webserver.sleep(1)
new_etag = check_etag(url)
assert old_etag != new_etag, "Old ETag {} is the same as {}".format(
old_etag, new_etag
)
with subtest("config is reloaded on nixos-rebuild switch"):
webserver.succeed(
"${justReloadSystem}/bin/switch-to-configuration test >&2"
Expand Down
8 changes: 4 additions & 4 deletions pkgs/servers/caddy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
, installShellFiles
}:
let
version = "2.6.4";
version = "2.7.3";
dist = fetchFromGitHub {
owner = "caddyserver";
repo = "dist";
rev = "v${version}";
hash = "sha256-SJO1q4g9uyyky9ZYSiqXJgNIvyxT5RjrpYd20YDx8ec=";
hash = "sha256-fQhujBYyl2p3cdqyf+LVebPBGxXn2lKMB/dsvTo5+NM=";
};
in
buildGoModule {
Expand All @@ -23,10 +23,10 @@ buildGoModule {
owner = "caddyserver";
repo = "caddy";
rev = "v${version}";
hash = "sha256-3a3+nFHmGONvL/TyQRqgJtrSDIn0zdGy9YwhZP17mU0=";
hash = "sha256-KezKMpx3M7rdKXEWf5XUSXqY5SEimACkv3OB/4XccCE=";
};

vendorHash = "sha256-toi6efYZobjDV3YPT9seE/WZAzNaxgb1ioVG4txcuXM=";
vendorHash = "sha256-mTHEM+0yakKiy4ZFi+2qakjSlKFyRkbjeXOXdvx+9lA=";

subPackages = [ "cmd/caddy" ];

Expand Down

0 comments on commit 7fdf825

Please sign in to comment.