diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-04-02 10:34:48 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-04-02 18:15:37 +0200 |
| commit | af76c020bf19de5fe2e92f31d8b85cbd55c481de (patch) | |
| tree | 2810b6d4285bdce32d3ddbdd06167c2f1248d749 /tests | |
| parent | 36d69ac993a322aea5b9021bc9920c135ab5edbb (diff) | |
linux-container: Make the guest UID and GID a parameter.
* gnu/build/linux-container.scm (initialize-user-namespace): Add
#:guest-uid and #:guest-gid parameters and honor them.
(run-container): Likewise.
(call-with-container): Likewise.
* tests/containers.scm ("call-with-container, user namespace, guest UID/GID"):
New test.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/containers.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/containers.scm b/tests/containers.scm index 5323e5037dc..37408f380d3 100644 --- a/tests/containers.scm +++ b/tests/containers.scm | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> | 2 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> |
| 3 | ;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org> | ||
| 3 | ;;; | 4 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 6 | ;;; |
| @@ -52,6 +53,16 @@ | |||
| 52 | #:namespaces '(user)))) | 53 | #:namespaces '(user)))) |
| 53 | 54 | ||
| 54 | (skip-if-unsupported) | 55 | (skip-if-unsupported) |
| 56 | (test-assert "call-with-container, user namespace, guest UID/GID" | ||
| 57 | (zero? | ||
| 58 | (call-with-container '() | ||
| 59 | (lambda () | ||
| 60 | (assert-exit (and (= 42 (getuid)) (= 77 (getgid))))) | ||
| 61 | #:guest-uid 42 | ||
| 62 | #:guest-gid 77 | ||
| 63 | #:namespaces '(user)))) | ||
| 64 | |||
| 65 | (skip-if-unsupported) | ||
| 55 | (test-assert "call-with-container, uts namespace" | 66 | (test-assert "call-with-container, uts namespace" |
| 56 | (zero? | 67 | (zero? |
| 57 | (call-with-container '() | 68 | (call-with-container '() |
