mirror of
https://github.com/0xbbjubjub/miniguest.git
synced 2024-09-11 05:55:35 +03:00
Add check for lxc container template
This commit is contained in:
parent
016f2cde04
commit
e667591ed9
@ -16,4 +16,5 @@ inputs: system:
|
||||
|
||||
import ./simple-guests.nix inputs system //
|
||||
import ./declarative-management.nix inputs system //
|
||||
import ./imperative-management.nix inputs system
|
||||
import ./imperative-management.nix inputs system //
|
||||
import ./templates.nix inputs system
|
||||
|
43
checks/templates.nix
Normal file
43
checks/templates.nix
Normal file
@ -0,0 +1,43 @@
|
||||
inputs@{ self, nixpkgs, ... }: system:
|
||||
|
||||
with nixpkgs.legacyPackages.${system};
|
||||
with self.packages.${system};
|
||||
let
|
||||
in
|
||||
lib.optionalAttrs stdenv.isLinux {
|
||||
create_container = nixosTest {
|
||||
name = "miniguest-create-container";
|
||||
machine = {
|
||||
imports = [ self.nixosModules.declarative ];
|
||||
|
||||
virtualisation.lxc.enable = true;
|
||||
users.users.root = {
|
||||
subUidRanges = [{ startUid = 1000000; count = 65536; }];
|
||||
subGidRanges = [{ startGid = 1000000; count = 65536; }];
|
||||
};
|
||||
|
||||
miniguests.container.configuration = {
|
||||
boot.miniguest.enable = true;
|
||||
boot.miniguest.guestType = "lxc";
|
||||
boot.miniguest.storeCorruptionWarning = false;
|
||||
};
|
||||
environment.systemPackages = [ miniguest ];
|
||||
|
||||
virtualisation.memorySize = 1024;
|
||||
};
|
||||
testScript = ''
|
||||
machine.succeed("""
|
||||
cat >extra-config <<EOF
|
||||
lxc.idmap = u 0 1000000 65536
|
||||
lxc.idmap = g 0 1000000 65536
|
||||
EOF
|
||||
""");
|
||||
machine.succeed("""
|
||||
miniguest create -t lxc container | sh
|
||||
""");
|
||||
machine.succeed("""
|
||||
lxc-start container
|
||||
""");
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user