mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 09:29:41 +08:00
podman-linux: fix tests expected results and modules
Update the expected results to match changes in the podman generator and fix not importing the podman stub overlay with module import behind `mkIf` introduced in #6905.
This commit is contained in:
committed by
Robert Helgesson
parent
9bfca5b3a7
commit
38e187fd2f
@@ -26,5 +26,5 @@ Type=oneshot
|
||||
Wants=podman-user-wait-network-online.service
|
||||
After=podman-user-wait-network-online.service
|
||||
Description=Service for build my-bld
|
||||
RequiresMountsFor=%t/containers
|
||||
SourcePath=/nix/store/00000000000000000000000000000000-home-build-podman-my-bld/quadlets/podman-my-bld.build
|
||||
RequiresMountsFor=%t/containers
|
||||
|
||||
@@ -4,50 +4,50 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf config.test.enableLegacyIfd {
|
||||
{
|
||||
imports = [ ./podman-stubs.nix ];
|
||||
config = lib.mkIf config.test.enableLegacyIfd {
|
||||
services.podman = {
|
||||
enable = true;
|
||||
builds = {
|
||||
"my-bld" = {
|
||||
file =
|
||||
let
|
||||
containerFile = pkgs.writeTextFile {
|
||||
name = "Containerfile";
|
||||
text = ''
|
||||
FROM docker.io/alpine:latest
|
||||
'';
|
||||
};
|
||||
in
|
||||
"${containerFile}";
|
||||
};
|
||||
|
||||
services.podman = {
|
||||
enable = true;
|
||||
builds = {
|
||||
"my-bld" = {
|
||||
file =
|
||||
let
|
||||
containerFile = pkgs.writeTextFile {
|
||||
name = "Containerfile";
|
||||
text = ''
|
||||
FROM docker.io/alpine:latest
|
||||
'';
|
||||
};
|
||||
in
|
||||
"${containerFile}";
|
||||
};
|
||||
|
||||
"my-bld-2" = {
|
||||
file = "https://www.github.com/././Containerfile";
|
||||
extraConfig = {
|
||||
Build.ImageTag = [
|
||||
"locahost/somethingelse"
|
||||
"localhost/anothertag"
|
||||
];
|
||||
"my-bld-2" = {
|
||||
file = "https://www.github.com/././Containerfile";
|
||||
extraConfig = {
|
||||
Build.ImageTag = [
|
||||
"locahost/somethingelse"
|
||||
"localhost/anothertag"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-bld-2' config. Build.ImageTag: '[ "locahost/somethingelse" "localhost/anothertag" ]' does not contain 'homemanager/my-bld-2'.''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
buildFile=$configPath/podman-my-bld-build.service
|
||||
|
||||
assertFileExists $buildFile
|
||||
|
||||
buildFile=$(normalizeStorePaths $buildFile)
|
||||
|
||||
assertFileContent $buildFile ${./build-expected.service}
|
||||
'';
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-bld-2' config. Build.ImageTag: '[ "locahost/somethingelse" "localhost/anothertag" ]' does not contain 'homemanager/my-bld-2'.''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
buildFile=$configPath/podman-my-bld-build.service
|
||||
|
||||
assertFileExists $buildFile
|
||||
|
||||
buildFile=$(normalizeStorePaths $buildFile)
|
||||
|
||||
assertFileContent $buildFile ${./build-expected.service}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -27,18 +27,18 @@ WantedBy=default.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Environment=PATH=/run/wrappers/bin:/run/current-system/sw/bin:/home/hm-user/.nix-profile/bin:@systemd@/bin
|
||||
Environment=PATH=/run/wrappers/bin:/run/current-system/sw/bin:@nftables@/bin:/home/hm-user/.nix-profile/bin:@systemd@/bin
|
||||
Restart=on-failure
|
||||
TimeoutStopSec=30
|
||||
Environment=PODMAN_SYSTEMD_UNIT=%n
|
||||
KillMode=mixed
|
||||
ExecStop=/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
ExecStopPost=-/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
ExecStop=/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i my-container
|
||||
ExecStopPost=-/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i my-container
|
||||
Delegate=yes
|
||||
Type=notify
|
||||
NotifyAccess=all
|
||||
SyslogIdentifier=%N
|
||||
ExecStart=/nix/store/00000000000000000000000000000000-podman/bin/podman run --name my-container --cidfile=%t/%N.cid --replace --rm --cgroups=split --entrypoint /sleep.sh --network-alias test-alias-1 --network-alias test-alias-2 --read-only-tmpfs --network mynet --sdnotify=conmon -d --device /dev/null:/dev/null -v /tmp:/tmp --label io.containers.autoupdate=registry --publish 8080:80 --env VAL_A=A --env VAL_B=2 --env VAL_C=false --label nix.home-manager.managed=true --security-opt=no-new-privileges docker.io/alpine:latest
|
||||
ExecStart=/nix/store/00000000000000000000000000000000-podman/bin/podman run --name my-container --replace --rm --cgroups=split --entrypoint /sleep.sh --network-alias test-alias-1 --network-alias test-alias-2 --read-only-tmpfs --network mynet --sdnotify=conmon -d --device /dev/null:/dev/null -v /tmp:/tmp --label io.containers.autoupdate=registry --publish 8080:80 --env VAL_A=A --env VAL_B=2 --env VAL_C=false --label nix.home-manager.managed=true --security-opt=no-new-privileges docker.io/alpine:latest
|
||||
|
||||
[Unit]
|
||||
Wants=podman-user-wait-network-online.service
|
||||
|
||||
@@ -1,61 +1,62 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf config.test.enableLegacyIfd {
|
||||
{
|
||||
imports = [ ./podman-stubs.nix ];
|
||||
config = lib.mkIf config.test.enableLegacyIfd {
|
||||
|
||||
services.podman = {
|
||||
enable = true;
|
||||
containers = {
|
||||
"my-container" = {
|
||||
description = "home-manager test";
|
||||
autoStart = true;
|
||||
autoUpdate = "registry";
|
||||
devices = [ "/dev/null:/dev/null" ];
|
||||
entrypoint = "/sleep.sh";
|
||||
environment = {
|
||||
"VAL_A" = "A";
|
||||
"VAL_B" = 2;
|
||||
"VAL_C" = false;
|
||||
};
|
||||
extraPodmanArgs = [ "--security-opt=no-new-privileges" ];
|
||||
extraConfig = {
|
||||
Container = {
|
||||
ReadOnlyTmpfs = true;
|
||||
NetworkAlias = "test-alias-2";
|
||||
services.podman = {
|
||||
enable = true;
|
||||
containers = {
|
||||
"my-container" = {
|
||||
description = "home-manager test";
|
||||
autoStart = true;
|
||||
autoUpdate = "registry";
|
||||
devices = [ "/dev/null:/dev/null" ];
|
||||
entrypoint = "/sleep.sh";
|
||||
environment = {
|
||||
"VAL_A" = "A";
|
||||
"VAL_B" = 2;
|
||||
"VAL_C" = false;
|
||||
};
|
||||
Service.Restart = "on-failure";
|
||||
Unit.Before = "fake.target";
|
||||
extraPodmanArgs = [ "--security-opt=no-new-privileges" ];
|
||||
extraConfig = {
|
||||
Container = {
|
||||
ReadOnlyTmpfs = true;
|
||||
NetworkAlias = "test-alias-2";
|
||||
};
|
||||
Service.Restart = "on-failure";
|
||||
Unit.Before = "fake.target";
|
||||
};
|
||||
image = "docker.io/alpine:latest";
|
||||
# Should not generate Requires/After for network because there is no
|
||||
# services.podman.networks.mynet.
|
||||
network = "mynet";
|
||||
networkAlias = [ "test-alias-1" ];
|
||||
ports = [ "8080:80" ];
|
||||
volumes = [ "/tmp:/tmp" ];
|
||||
};
|
||||
image = "docker.io/alpine:latest";
|
||||
# Should not generate Requires/After for network because there is no
|
||||
# services.podman.networks.mynet.
|
||||
network = "mynet";
|
||||
networkAlias = [ "test-alias-1" ];
|
||||
ports = [ "8080:80" ];
|
||||
volumes = [ "/tmp:/tmp" ];
|
||||
};
|
||||
|
||||
"my-container-2" = {
|
||||
image = "docker.io/alpine:latest";
|
||||
extraConfig = {
|
||||
Container.ContainerName = "some-other-container-name";
|
||||
"my-container-2" = {
|
||||
image = "docker.io/alpine:latest";
|
||||
extraConfig = {
|
||||
Container.ContainerName = "some-other-container-name";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-container-2' config. Container.ContainerName: 'some-other-container-name' does not match expected type: value "my-container-2" (singular enum)''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
containerFile=$configPath/podman-my-container.service
|
||||
|
||||
assertFileExists $containerFile
|
||||
|
||||
containerFile=$(normalizeStorePaths $containerFile)
|
||||
|
||||
assertFileContent $containerFile ${./container-expected.service}
|
||||
'';
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-container-2' config. Container.ContainerName: 'some-other-container-name' does not match expected type: value "my-container-2" (singular enum)''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
containerFile=$configPath/podman-my-container.service
|
||||
|
||||
assertFileExists $containerFile
|
||||
|
||||
containerFile=$(normalizeStorePaths $containerFile)
|
||||
|
||||
assertFileContent $containerFile ${./container-expected.service}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf config.test.enableLegacyIfd {
|
||||
{
|
||||
imports = [ ./podman-stubs.nix ];
|
||||
|
||||
services.podman = {
|
||||
enable = true;
|
||||
images = {
|
||||
"my-img" = {
|
||||
image = "docker.io/alpine:latest";
|
||||
config = lib.mkIf config.test.enableLegacyIfd {
|
||||
services.podman = {
|
||||
enable = true;
|
||||
images = {
|
||||
"my-img" = {
|
||||
image = "docker.io/alpine:latest";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
imageFile=$configPath/podman-my-img-image.service
|
||||
assertFileExists $imageFile
|
||||
|
||||
imageFile=$(normalizeStorePaths $imageFile)
|
||||
|
||||
assertFileContent $imageFile ${./image-expected.service}
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
imageFile=$configPath/podman-my-img-image.service
|
||||
assertFileExists $imageFile
|
||||
|
||||
imageFile=$(normalizeStorePaths $imageFile)
|
||||
|
||||
assertFileContent $imageFile ${./image-expected.service}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -26,5 +26,5 @@ Type=oneshot
|
||||
Wants=podman-user-wait-network-online.service
|
||||
After=podman-user-wait-network-online.service
|
||||
Description=Service for build my-bld
|
||||
RequiresMountsFor=%t/containers
|
||||
SourcePath=/nix/store/00000000000000000000000000000000-home-container-podman-my-container-bld/quadlets/podman-my-bld.build
|
||||
RequiresMountsFor=%t/containers
|
||||
|
||||
@@ -15,24 +15,24 @@ WantedBy=default.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Environment=PATH=/run/wrappers/bin:/run/current-system/sw/bin:/home/hm-user/.nix-profile/bin:@systemd@/bin
|
||||
Environment=PATH=/run/wrappers/bin:/run/current-system/sw/bin:@nftables@/bin:/home/hm-user/.nix-profile/bin:@systemd@/bin
|
||||
Restart=always
|
||||
TimeoutStopSec=30
|
||||
Environment=PODMAN_SYSTEMD_UNIT=%n
|
||||
KillMode=mixed
|
||||
ExecStop=/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
ExecStopPost=-/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
ExecStop=/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i my-container-bld
|
||||
ExecStopPost=-/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i my-container-bld
|
||||
Delegate=yes
|
||||
Type=notify
|
||||
NotifyAccess=all
|
||||
SyslogIdentifier=%N
|
||||
ExecStart=/nix/store/00000000000000000000000000000000-podman/bin/podman run --name my-container-bld --cidfile=%t/%N.cid --replace --rm --cgroups=split --sdnotify=conmon -d --label nix.home-manager.managed=true homemanager/my-bld
|
||||
ExecStart=/nix/store/00000000000000000000000000000000-podman/bin/podman run --name my-container-bld --replace --rm --cgroups=split --sdnotify=conmon -d --label nix.home-manager.managed=true homemanager/my-bld
|
||||
|
||||
[Unit]
|
||||
Wants=podman-user-wait-network-online.service
|
||||
After=podman-user-wait-network-online.service
|
||||
Description=Service for container my-container-bld
|
||||
SourcePath=/nix/store/00000000000000000000000000000000-home-container-podman-my-container-bld/quadlets/podman-my-container-bld.container
|
||||
RequiresMountsFor=%t/containers
|
||||
Requires=podman-my-bld-build.service
|
||||
After=podman-my-bld-build.service
|
||||
RequiresMountsFor=%t/containers
|
||||
|
||||
@@ -18,27 +18,27 @@ WantedBy=default.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Environment=PATH=/run/wrappers/bin:/run/current-system/sw/bin:/home/hm-user/.nix-profile/bin:@systemd@/bin
|
||||
Environment=PATH=/run/wrappers/bin:/run/current-system/sw/bin:@nftables@/bin:/home/hm-user/.nix-profile/bin:@systemd@/bin
|
||||
Restart=always
|
||||
TimeoutStopSec=30
|
||||
Environment=PODMAN_SYSTEMD_UNIT=%n
|
||||
KillMode=mixed
|
||||
ExecStop=/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
ExecStopPost=-/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i --cidfile=%t/%N.cid
|
||||
ExecStop=/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i my-container
|
||||
ExecStopPost=-/nix/store/00000000000000000000000000000000-podman/bin/podman rm -v -f -i my-container
|
||||
Delegate=yes
|
||||
Type=notify
|
||||
NotifyAccess=all
|
||||
SyslogIdentifier=%N
|
||||
ExecStart=/nix/store/00000000000000000000000000000000-podman/bin/podman run --name my-container --cidfile=%t/%N.cid --replace --rm --cgroups=split --network my-app --network externalnet --sdnotify=conmon -d -v my-app:/data --label nix.home-manager.managed=true docker.io/alpine:latest
|
||||
ExecStart=/nix/store/00000000000000000000000000000000-podman/bin/podman run --name my-container --replace --rm --cgroups=split --network my-app --network externalnet --sdnotify=conmon -d -v my-app:/data --label nix.home-manager.managed=true docker.io/alpine:latest
|
||||
|
||||
[Unit]
|
||||
Wants=podman-user-wait-network-online.service
|
||||
After=podman-user-wait-network-online.service
|
||||
Description=Service for container my-container
|
||||
SourcePath=/nix/store/00000000000000000000000000000000-home-container-podman-my-container/quadlets/podman-my-container.container
|
||||
RequiresMountsFor=%t/containers
|
||||
Requires=podman-my-img-image.service
|
||||
After=podman-my-img-image.service
|
||||
RequiresMountsFor=%t/containers
|
||||
Requires=podman-my-app-network.service
|
||||
After=podman-my-app-network.service
|
||||
Requires=podman-my-app-volume.service
|
||||
|
||||
@@ -4,78 +4,79 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf config.test.enableLegacyIfd {
|
||||
{
|
||||
imports = [ ./podman-stubs.nix ];
|
||||
|
||||
services.podman = {
|
||||
enable = true;
|
||||
builds."my-bld" = {
|
||||
file =
|
||||
let
|
||||
containerFile = pkgs.writeTextFile {
|
||||
name = "Containerfile";
|
||||
text = ''
|
||||
FROM docker.io/alpine:latest
|
||||
'';
|
||||
};
|
||||
in
|
||||
"${containerFile}";
|
||||
};
|
||||
containers = {
|
||||
"my-container" = {
|
||||
image = "my-img.image";
|
||||
network = [
|
||||
"my-app.network"
|
||||
"externalnet"
|
||||
];
|
||||
volumes = [ "my-app.volume:/data" ];
|
||||
config = lib.mkIf config.test.enableLegacyIfd {
|
||||
services.podman = {
|
||||
enable = true;
|
||||
builds."my-bld" = {
|
||||
file =
|
||||
let
|
||||
containerFile = pkgs.writeTextFile {
|
||||
name = "Containerfile";
|
||||
text = ''
|
||||
FROM docker.io/alpine:latest
|
||||
'';
|
||||
};
|
||||
in
|
||||
"${containerFile}";
|
||||
};
|
||||
"my-container-bld" = {
|
||||
image = "my-bld.build";
|
||||
containers = {
|
||||
"my-container" = {
|
||||
image = "my-img.image";
|
||||
network = [
|
||||
"my-app.network"
|
||||
"externalnet"
|
||||
];
|
||||
volumes = [ "my-app.volume:/data" ];
|
||||
};
|
||||
"my-container-bld" = {
|
||||
image = "my-bld.build";
|
||||
};
|
||||
};
|
||||
images."my-img" = {
|
||||
image = "docker.io/alpine:latest";
|
||||
};
|
||||
networks."my-app" = {
|
||||
gateway = "192.168.123.1";
|
||||
subnet = "192.168.123.0/24";
|
||||
};
|
||||
volumes."my-app" = {
|
||||
device = "tmpfs";
|
||||
preserve = false;
|
||||
type = "tmpfs";
|
||||
};
|
||||
};
|
||||
images."my-img" = {
|
||||
image = "docker.io/alpine:latest";
|
||||
};
|
||||
networks."my-app" = {
|
||||
gateway = "192.168.123.1";
|
||||
subnet = "192.168.123.0/24";
|
||||
};
|
||||
volumes."my-app" = {
|
||||
device = "tmpfs";
|
||||
preserve = false;
|
||||
type = "tmpfs";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
buildFile=$configPath/podman-my-bld-build.service
|
||||
containerFile=$configPath/podman-my-container.service
|
||||
containerBldFile=$configPath/podman-my-container-bld.service
|
||||
imageFile=$configPath/podman-my-img-image.service
|
||||
networkFile=$configPath/podman-my-app-network.service
|
||||
volumeFile=$configPath/podman-my-app-volume.service
|
||||
assertFileExists $buildFile
|
||||
assertFileExists $containerFile
|
||||
assertFileExists $containerBldFile
|
||||
assertFileExists $imageFile
|
||||
assertFileExists $networkFile
|
||||
assertFileExists $volumeFile
|
||||
|
||||
buildFile=$(normalizeStorePaths $buildFile)
|
||||
containerFile=$(normalizeStorePaths $containerFile)
|
||||
containerBldFile=$(normalizeStorePaths $containerBldFile)
|
||||
imageFile=$(normalizeStorePaths $imageFile)
|
||||
networkFile=$(normalizeStorePaths $networkFile)
|
||||
volumeFile=$(normalizeStorePaths $volumeFile)
|
||||
|
||||
assertFileContent $buildFile ${./integration-build-expected.service}
|
||||
assertFileContent $containerFile ${./integration-container-expected.service}
|
||||
assertFileContent $containerBldFile ${./integration-container-bld-expected.service}
|
||||
assertFileContent $imageFile ${./integration-image-expected.service}
|
||||
assertFileContent $networkFile ${./integration-network-expected.service}
|
||||
assertFileContent $volumeFile ${./integration-volume-expected.service}
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
buildFile=$configPath/podman-my-bld-build.service
|
||||
containerFile=$configPath/podman-my-container.service
|
||||
containerBldFile=$configPath/podman-my-container-bld.service
|
||||
imageFile=$configPath/podman-my-img-image.service
|
||||
networkFile=$configPath/podman-my-app-network.service
|
||||
volumeFile=$configPath/podman-my-app-volume.service
|
||||
assertFileExists $buildFile
|
||||
assertFileExists $containerFile
|
||||
assertFileExists $containerBldFile
|
||||
assertFileExists $imageFile
|
||||
assertFileExists $networkFile
|
||||
assertFileExists $volumeFile
|
||||
|
||||
buildFile=$(normalizeStorePaths $buildFile)
|
||||
containerFile=$(normalizeStorePaths $containerFile)
|
||||
containerBldFile=$(normalizeStorePaths $containerBldFile)
|
||||
imageFile=$(normalizeStorePaths $imageFile)
|
||||
networkFile=$(normalizeStorePaths $networkFile)
|
||||
volumeFile=$(normalizeStorePaths $volumeFile)
|
||||
|
||||
assertFileContent $buildFile ${./integration-build-expected.service}
|
||||
assertFileContent $containerFile ${./integration-container-expected.service}
|
||||
assertFileContent $containerBldFile ${./integration-container-bld-expected.service}
|
||||
assertFileContent $imageFile ${./integration-image-expected.service}
|
||||
assertFileContent $networkFile ${./integration-network-expected.service}
|
||||
assertFileContent $volumeFile ${./integration-volume-expected.service}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf config.test.enableLegacyIfd {
|
||||
{
|
||||
imports = [ ./podman-stubs.nix ];
|
||||
config = lib.mkIf config.test.enableLegacyIfd {
|
||||
services.podman = {
|
||||
enable = true;
|
||||
containers."my-container-1" = {
|
||||
description = "home-manager test";
|
||||
autoUpdate = "registry";
|
||||
autoStart = true;
|
||||
image = "docker.io/alpine:latest";
|
||||
entrypoint = "sleep 1000";
|
||||
environment = {
|
||||
"VAL_A" = "A";
|
||||
"VAL_B" = 2;
|
||||
"VAL_C" = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.podman = {
|
||||
enable = true;
|
||||
containers."my-container-1" = {
|
||||
services.podman.containers."my-container-2" = {
|
||||
description = "home-manager test";
|
||||
autoUpdate = "registry";
|
||||
autoStart = true;
|
||||
image = "docker.io/alpine:latest";
|
||||
entrypoint = "sleep 1000";
|
||||
environment = {
|
||||
"VAL_A" = "A";
|
||||
"VAL_B" = 2;
|
||||
"VAL_C" = false;
|
||||
"VAL_A" = "B";
|
||||
"VAL_B" = 3;
|
||||
"VAL_C" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.podman.containers."my-container-2" = {
|
||||
description = "home-manager test";
|
||||
autoUpdate = "registry";
|
||||
autoStart = true;
|
||||
image = "docker.io/alpine:latest";
|
||||
entrypoint = "sleep 1000";
|
||||
environment = {
|
||||
"VAL_A" = "B";
|
||||
"VAL_B" = 3;
|
||||
"VAL_C" = true;
|
||||
services.podman.networks."mynet-1" = {
|
||||
subnet = "192.168.1.0/24";
|
||||
gateway = "192.168.1.1";
|
||||
};
|
||||
services.podman.networks."mynet-2" = {
|
||||
subnet = "192.168.2.0/24";
|
||||
gateway = "192.168.2.1";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/podman
|
||||
containerManifest=$configPath/containers.manifest
|
||||
networkManifest=$configPath/networks.manifest
|
||||
|
||||
assertFileExists $containerManifest
|
||||
assertFileExists $networkManifest
|
||||
|
||||
assertFileContent $containerManifest ${builtins.toFile "containers.expected" ''
|
||||
my-container-1
|
||||
my-container-2
|
||||
''}
|
||||
|
||||
assertFileContent $networkManifest ${builtins.toFile "networks.expected" ''
|
||||
mynet-1
|
||||
mynet-2
|
||||
''}
|
||||
'';
|
||||
};
|
||||
|
||||
services.podman.networks."mynet-1" = {
|
||||
subnet = "192.168.1.0/24";
|
||||
gateway = "192.168.1.1";
|
||||
};
|
||||
services.podman.networks."mynet-2" = {
|
||||
subnet = "192.168.2.0/24";
|
||||
gateway = "192.168.2.1";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/podman
|
||||
containerManifest=$configPath/containers.manifest
|
||||
networkManifest=$configPath/networks.manifest
|
||||
|
||||
assertFileExists $containerManifest
|
||||
assertFileExists $networkManifest
|
||||
|
||||
assertFileContent $containerManifest ${builtins.toFile "containers.expected" ''
|
||||
my-container-1
|
||||
my-container-2
|
||||
''}
|
||||
|
||||
assertFileContent $networkManifest ${builtins.toFile "networks.expected" ''
|
||||
mynet-1
|
||||
mynet-2
|
||||
''}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf config.test.enableLegacyIfd {
|
||||
{
|
||||
imports = [ ./podman-stubs.nix ];
|
||||
|
||||
services.podman = {
|
||||
enable = true;
|
||||
networks = {
|
||||
"my-net" = {
|
||||
subnet = "192.168.1.0/24";
|
||||
gateway = "192.168.1.1";
|
||||
extraPodmanArgs = [ "--ipam-driver dhcp" ];
|
||||
extraConfig = {
|
||||
Network = {
|
||||
NetworkName = "my-net";
|
||||
Options = {
|
||||
isolate = "true";
|
||||
config = lib.mkIf config.test.enableLegacyIfd {
|
||||
services.podman = {
|
||||
enable = true;
|
||||
networks = {
|
||||
"my-net" = {
|
||||
subnet = "192.168.1.0/24";
|
||||
gateway = "192.168.1.1";
|
||||
extraPodmanArgs = [ "--ipam-driver dhcp" ];
|
||||
extraConfig = {
|
||||
Network = {
|
||||
NetworkName = "my-net";
|
||||
Options = {
|
||||
isolate = "true";
|
||||
};
|
||||
PodmanArgs = [
|
||||
"--dns=192.168.55.1"
|
||||
"--log-level=debug"
|
||||
];
|
||||
};
|
||||
PodmanArgs = [
|
||||
"--dns=192.168.55.1"
|
||||
"--log-level=debug"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"my-net-2" = {
|
||||
subnet = "192.168.2.0/24";
|
||||
gateway = "192.168.2.1";
|
||||
extraConfig = {
|
||||
Network = {
|
||||
NetworkName = "some-other-network-name";
|
||||
"my-net-2" = {
|
||||
subnet = "192.168.2.0/24";
|
||||
gateway = "192.168.2.1";
|
||||
extraConfig = {
|
||||
Network = {
|
||||
NetworkName = "some-other-network-name";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-net-2' config. Network.NetworkName: 'some-other-network-name' does not match expected type: value "my-net-2" (singular enum)''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
networkFile=$configPath/podman-my-net-network.service
|
||||
assertFileExists $networkFile
|
||||
|
||||
networkFile=$(normalizeStorePaths $networkFile)
|
||||
|
||||
assertFileContent $networkFile ${./network-expected.service}
|
||||
'';
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-net-2' config. Network.NetworkName: 'some-other-network-name' does not match expected type: value "my-net-2" (singular enum)''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
networkFile=$configPath/podman-my-net-network.service
|
||||
assertFileExists $networkFile
|
||||
|
||||
networkFile=$(normalizeStorePaths $networkFile)
|
||||
|
||||
assertFileContent $networkFile ${./network-expected.service}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf config.test.enableLegacyIfd {
|
||||
{
|
||||
imports = [ ./podman-stubs.nix ];
|
||||
|
||||
services.podman = {
|
||||
enable = true;
|
||||
volumes = {
|
||||
"my-vol" = {
|
||||
device = "tmpfs";
|
||||
extraConfig = {
|
||||
Volume = {
|
||||
User = 1000;
|
||||
config = lib.mkIf config.test.enableLegacyIfd {
|
||||
services.podman = {
|
||||
enable = true;
|
||||
volumes = {
|
||||
"my-vol" = {
|
||||
device = "tmpfs";
|
||||
extraConfig = {
|
||||
Volume = {
|
||||
User = 1000;
|
||||
};
|
||||
};
|
||||
extraPodmanArgs = [ "--module=/etc/nvd.conf" ];
|
||||
group = 1000;
|
||||
type = "tmpfs";
|
||||
};
|
||||
extraPodmanArgs = [ "--module=/etc/nvd.conf" ];
|
||||
group = 1000;
|
||||
type = "tmpfs";
|
||||
};
|
||||
|
||||
"my-vol-2" = {
|
||||
extraConfig = {
|
||||
Volume = {
|
||||
VolumeName = "some-other-volume-name";
|
||||
"my-vol-2" = {
|
||||
extraConfig = {
|
||||
Volume = {
|
||||
VolumeName = "some-other-volume-name";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-vol-2' config. Volume.VolumeName: 'some-other-volume-name' does not match expected type: value "my-vol-2" (singular enum)''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
volumeFile=$configPath/podman-my-vol-volume.service
|
||||
assertFileExists $volumeFile
|
||||
|
||||
volumeFile=$(normalizeStorePaths $volumeFile)
|
||||
|
||||
assertFileContent $volumeFile ${./volume-expected.service}
|
||||
'';
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''In 'my-vol-2' config. Volume.VolumeName: 'some-other-volume-name' does not match expected type: value "my-vol-2" (singular enum)''
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configPath=home-files/.config/systemd/user
|
||||
volumeFile=$configPath/podman-my-vol-volume.service
|
||||
assertFileExists $volumeFile
|
||||
|
||||
volumeFile=$(normalizeStorePaths $volumeFile)
|
||||
|
||||
assertFileContent $volumeFile ${./volume-expected.service}
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user