Skip to content

Commit a33c2b6

Browse files
denniskleindtrudg
authored andcommitted
Add e2e test to verify generated /etc/passwd
Signed-off-by: Dennis Klein <[email protected]>
1 parent 5cf98a2 commit a33c2b6

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

e2e/actions/actions.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2023, Sylabs Inc. All rights reserved.
1+
// Copyright (c) 2019-2024, Sylabs Inc. All rights reserved.
22
// Copyright (c) Contributors to the Apptainer project, established as
33
// Apptainer a Series of LF Projects LLC.
44
// This software is licensed under a 3-clause BSD license. Please consult the
@@ -2956,6 +2956,7 @@ func E2ETests(env e2e.TestEnv) testhelper.Tests {
29562956
"issue 5690": c.issue5690, // https://github.com/sylabs/singularity/issues/5690
29572957
"issue 1950": c.issue1950, // https://github.com/sylabs/singularity/issues/1950
29582958
"issue 2690": c.issue2690, // https://github.com/sylabs/singularity/issues/2690
2959+
"issue 1848": c.issue1848, // https://github.com/apptainer/apptainer/issues/1848
29592960
"network": c.actionNetwork, // test basic networking
29602961
"netns-path": c.actionNetnsPath, // test netns joining
29612962
"binds": c.actionBinds, // test various binds with --bind and --mount

e2e/actions/regressions.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// Copyright (c) 2020, Sylabs Inc. All rights reserved.
1+
// Copyright (c) 2020-2024, Sylabs Inc. All rights reserved.
2+
// Copyright (c) Contributors to the Apptainer project, established as
3+
// Apptainer a Series of LF Projects LLC.
24
// This software is licensed under a 3-clause BSD license. Please consult the
35
// LICENSE.md file distributed with the sources of this project regarding your
46
// rights to use or distribute this software.
@@ -912,3 +914,27 @@ func (c actionTests) issue3129(t *testing.T) {
912914
e2e.ExpectExit(0),
913915
)
914916
}
917+
918+
// Verify the generated host user data appended to /etc/passwd
919+
func (c actionTests) issue1848(t *testing.T) {
920+
e2e.EnsureImage(t, c.env)
921+
user := e2e.UserProfile.HostUser(t)
922+
expectedPasswdLine := fmt.Sprintf("%s:x:%d:%d:%s:%s:%s",
923+
user.Name,
924+
user.UID,
925+
user.GID,
926+
user.Gecos,
927+
user.Dir,
928+
user.Shell,
929+
)
930+
931+
c.env.RunSingularity(
932+
t,
933+
e2e.WithProfile(e2e.UserProfile),
934+
e2e.WithCommand("exec"),
935+
e2e.WithArgs(c.env.ImagePath, "tail", "-1", "/etc/passwd"),
936+
e2e.ExpectExit(0,
937+
e2e.ExpectOutput(e2e.ExactMatch, expectedPasswdLine),
938+
),
939+
)
940+
}

0 commit comments

Comments
 (0)