0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

Merge staging-next into staging

This commit is contained in:
github-actions[bot] 2024-09-06 18:04:26 +00:00 committed by GitHub
commit 1fc7b4e48c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 2850 additions and 1761 deletions

View file

@ -57,15 +57,16 @@ import ./make-test-python.nix ({ lib, ... }: {
testScript = ''
with subtest("Web server gets ready"):
machine.wait_for_unit("dex.service")
machine.wait_for_unit("dex.service", timeout=120)
# Wait until server accepts connections
machine.wait_until_succeeds("curl -fs 'localhost:8080/dex/auth/mock?client_id=oidcclient&response_type=code&redirect_uri=https://example.com/callback&scope=openid'")
machine.wait_until_succeeds("curl -fs 'localhost:8080/dex/auth/mock?client_id=oidcclient&response_type=code&redirect_uri=https://example.com/callback&scope=openid'", timeout=120)
with subtest("Login"):
state = machine.succeed("curl -fs 'localhost:8080/dex/auth/mock?client_id=oidcclient&response_type=code&redirect_uri=https://example.com/callback&scope=openid' | sed -n 's/.*state=\\(.*\\)\">.*/\\1/p'").strip()
print(f"Got state {state}")
machine.succeed(f"curl -fs 'localhost:8080/dex/auth/mock/login?back=&state={state}' -d 'login=admin&password=password'")
code = machine.succeed(f"curl -fs localhost:8080/dex/approval?req={state} | sed -n 's/.*code=\\(.*\\)&.*/\\1/p'").strip()
# Login request returns 303 with redirect_url that has code as query parameter:
# https://example.com/callback?code=kibsamwdupuy2iwqnlbqei3u6&state=
code = machine.succeed(f"curl -fs 'localhost:8080/dex/auth/mock/login?back=&state={state}' -d 'login=admin&password=password' -w '%{{redirect_url}}' | sed -n 's/.*code=\\(.*\\)&.*/\\1/p'")
print(f"Got approval code {code}")
bearer = machine.succeed(f"curl -fs localhost:8080/dex/token -u oidcclient:oidcclientsecret -d 'grant_type=authorization_code&redirect_uri=https://example.com/callback&code={code}' | jq .access_token -r").strip()
print(f"Got access token {bearer}")

View file

@ -1,46 +1,47 @@
import ./make-test-python.nix ({ pkgs, ... }:
{
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "samba";
meta.maintainers = [ ];
meta.maintainers = [ lib.maintainers.anthonyroussel ];
nodes =
{ client =
{ pkgs, ... }:
{ virtualisation.fileSystems =
{ "/public" = {
fsType = "cifs";
device = "//server/public";
options = [ "guest" ];
};
};
nodes = {
client =
{ ... }:
{
virtualisation.fileSystems = {
"/public" = {
fsType = "cifs";
device = "//server/public";
options = [ "guest" ];
};
};
};
server =
{ ... }:
{ services.samba.enable = true;
services.samba.openFirewall = true;
services.samba.shares.public =
{ path = "/public";
server =
{ ... }:
{
services.samba = {
enable = true;
openFirewall = true;
settings = {
"public" = {
"path" = "/public";
"read only" = true;
browseable = "yes";
"browseable" = "yes";
"guest ok" = "yes";
comment = "Public samba share.";
"comment" = "Public samba share.";
};
};
};
};
};
};
# client# [ 4.542997] mount[777]: sh: systemd-ask-password: command not found
testScript = ''
server.start()
server.wait_for_unit("samba.target")
server.succeed("mkdir -p /public; echo bar > /public/foo")
testScript =
''
server.start()
server.wait_for_unit("samba.target")
server.succeed("mkdir -p /public; echo bar > /public/foo")
client.start()
client.wait_for_unit("remote-fs.target")
client.succeed("[[ $(cat /public/foo) = bar ]]")
'';
client.start()
client.wait_for_unit("remote-fs.target")
client.succeed("[[ $(cat /public/foo) = bar ]]")
'';
})