mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
parent
494c90cb5d
commit
26497c8351
2 changed files with 63 additions and 61 deletions
|
@ -1277,9 +1277,18 @@ in {
|
||||||
ustreamer = handleTest ./ustreamer.nix {};
|
ustreamer = handleTest ./ustreamer.nix {};
|
||||||
uwsgi = handleTest ./uwsgi.nix {};
|
uwsgi = handleTest ./uwsgi.nix {};
|
||||||
v2ray = handleTest ./v2ray.nix {};
|
v2ray = handleTest ./v2ray.nix {};
|
||||||
varnish60 = handleTest ./varnish.nix { package = pkgs.varnish60; };
|
varnish60 = runTest {
|
||||||
varnish75 = handleTest ./varnish.nix { package = pkgs.varnish75; };
|
imports = [ ./varnish.nix ];
|
||||||
varnish76 = handleTest ./varnish.nix { package = pkgs.varnish76; };
|
_module.args.package = pkgs.varnish60;
|
||||||
|
};
|
||||||
|
varnish75 = runTest {
|
||||||
|
imports = [ ./varnish.nix ];
|
||||||
|
_module.args.package = pkgs.varnish75;
|
||||||
|
};
|
||||||
|
varnish76 = runTest {
|
||||||
|
imports = [ ./varnish.nix ];
|
||||||
|
_module.args.package = pkgs.varnish76;
|
||||||
|
};
|
||||||
vault = handleTest ./vault.nix {};
|
vault = handleTest ./vault.nix {};
|
||||||
vault-agent = handleTest ./vault-agent.nix {};
|
vault-agent = handleTest ./vault-agent.nix {};
|
||||||
vault-dev = handleTest ./vault-dev.nix {};
|
vault-dev = handleTest ./vault-dev.nix {};
|
||||||
|
|
|
@ -1,67 +1,60 @@
|
||||||
|
{ pkgs, package, ... }:
|
||||||
|
let
|
||||||
|
testPath = pkgs.hello;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
system ? builtins.currentSystem,
|
name = "varnish";
|
||||||
pkgs ? import ../.. { inherit system; },
|
meta = {
|
||||||
package,
|
maintainers = [ ];
|
||||||
}:
|
};
|
||||||
import ./make-test-python.nix (
|
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
testPath = pkgs.hello;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
name = "varnish";
|
|
||||||
meta = {
|
|
||||||
maintainers = [ ];
|
|
||||||
};
|
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
varnish =
|
varnish =
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
services.nix-serve = {
|
services.nix-serve = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
|
||||||
|
|
||||||
services.varnish = {
|
|
||||||
inherit package;
|
|
||||||
enable = true;
|
|
||||||
http_address = "0.0.0.0:80";
|
|
||||||
config = ''
|
|
||||||
vcl 4.0;
|
|
||||||
|
|
||||||
backend nix-serve {
|
|
||||||
.host = "127.0.0.1";
|
|
||||||
.port = "${toString config.services.nix-serve.port}";
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
||||||
system.extraDependencies = [ testPath ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
client =
|
services.varnish = {
|
||||||
{ lib, ... }:
|
inherit package;
|
||||||
{
|
enable = true;
|
||||||
nix.settings = {
|
http_address = "0.0.0.0:80";
|
||||||
require-sigs = false;
|
config = ''
|
||||||
substituters = lib.mkForce [ "http://varnish" ];
|
vcl 4.0;
|
||||||
};
|
|
||||||
|
backend nix-serve {
|
||||||
|
.host = "127.0.0.1";
|
||||||
|
.port = "${toString config.services.nix-serve.port}";
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
testScript = ''
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
start_all()
|
system.extraDependencies = [ testPath ];
|
||||||
varnish.wait_for_open_port(80)
|
};
|
||||||
|
|
||||||
client.wait_until_succeeds("curl -f http://varnish/nix-cache-info");
|
client =
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
nix.settings = {
|
||||||
|
require-sigs = false;
|
||||||
|
substituters = lib.mkForce [ "http://varnish" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
client.wait_until_succeeds("nix-store -r ${testPath}")
|
testScript = ''
|
||||||
client.succeed("${testPath}/bin/hello")
|
start_all()
|
||||||
|
varnish.wait_for_open_port(80)
|
||||||
|
|
||||||
output = varnish.succeed("varnishadm status")
|
client.wait_until_succeeds("curl -f http://varnish/nix-cache-info");
|
||||||
print(output)
|
|
||||||
assert "Child in state running" in output, "Unexpected varnishadm response"
|
client.wait_until_succeeds("nix-store -r ${testPath}")
|
||||||
'';
|
client.succeed("${testPath}/bin/hello")
|
||||||
}
|
|
||||||
)
|
output = varnish.succeed("varnishadm status")
|
||||||
|
print(output)
|
||||||
|
assert "Child in state running" in output, "Unexpected varnishadm response"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue