mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
nixosTests.vault-agent: init
This commit is contained in:
parent
4e8bde773f
commit
524fe7ff51
@ -746,6 +746,7 @@ in {
|
|||||||
varnish60 = handleTest ./varnish.nix { package = pkgs.varnish60; };
|
varnish60 = handleTest ./varnish.nix { package = pkgs.varnish60; };
|
||||||
varnish72 = handleTest ./varnish.nix { package = pkgs.varnish72; };
|
varnish72 = handleTest ./varnish.nix { package = pkgs.varnish72; };
|
||||||
vault = handleTest ./vault.nix {};
|
vault = handleTest ./vault.nix {};
|
||||||
|
vault-agent = handleTest ./vault-agent.nix {};
|
||||||
vault-dev = handleTest ./vault-dev.nix {};
|
vault-dev = handleTest ./vault-dev.nix {};
|
||||||
vault-postgresql = handleTest ./vault-postgresql.nix {};
|
vault-postgresql = handleTest ./vault-postgresql.nix {};
|
||||||
vaultwarden = handleTest ./vaultwarden.nix {};
|
vaultwarden = handleTest ./vaultwarden.nix {};
|
||||||
|
52
nixos/tests/vault-agent.nix
Normal file
52
nixos/tests/vault-agent.nix
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
||||||
|
name = "vault-agent";
|
||||||
|
|
||||||
|
nodes.machine = { config, pkgs, ... }: {
|
||||||
|
services.vault-agent.instances.example.settings = {
|
||||||
|
vault.address = config.environment.variables.VAULT_ADDR;
|
||||||
|
|
||||||
|
auto_auth = [{
|
||||||
|
method = [{
|
||||||
|
type = "token_file";
|
||||||
|
config.token_file_path = pkgs.writeText "vault-token" config.environment.variables.VAULT_TOKEN;
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
|
||||||
|
template = [{
|
||||||
|
contents = ''
|
||||||
|
{{- with secret "secret/example" }}
|
||||||
|
{{ .Data.data.key }}"
|
||||||
|
{{- end }}
|
||||||
|
'';
|
||||||
|
perms = "0600";
|
||||||
|
destination = "/example";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.vault = {
|
||||||
|
enable = true;
|
||||||
|
dev = true;
|
||||||
|
devRootTokenID = config.environment.variables.VAULT_TOKEN;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
systemPackages = [ pkgs.vault ];
|
||||||
|
variables = {
|
||||||
|
VAULT_ADDR = "http://localhost:8200";
|
||||||
|
VAULT_TOKEN = "root";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("vault.service")
|
||||||
|
machine.wait_for_open_port(8200)
|
||||||
|
|
||||||
|
machine.wait_until_succeeds('vault kv put secret/example key=example')
|
||||||
|
|
||||||
|
machine.wait_for_unit("vault-agent-example.service")
|
||||||
|
|
||||||
|
machine.wait_for_file("/example")
|
||||||
|
machine.succeed('grep "example" /example')
|
||||||
|
'';
|
||||||
|
})
|
@ -38,7 +38,7 @@ buildGoModule rec {
|
|||||||
--prefix PATH ${lib.makeBinPath [ gawk glibc ]}
|
--prefix PATH ${lib.makeBinPath [ gawk glibc ]}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.tests = { inherit (nixosTests) vault vault-postgresql vault-dev; };
|
passthru.tests = { inherit (nixosTests) vault vault-postgresql vault-dev vault-agent; };
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://www.vaultproject.io/";
|
homepage = "https://www.vaultproject.io/";
|
||||||
|
Loading…
Reference in New Issue
Block a user