Skip to content

Commit

Permalink
Add e2e test to verify generated /etc/passwd
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Klein <[email protected]>
  • Loading branch information
dennisklein authored and dtrudg committed Sep 13, 2024
1 parent 5cf98a2 commit a33c2b6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion e2e/actions/actions.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2023, Sylabs Inc. All rights reserved.
// Copyright (c) 2019-2024, Sylabs Inc. All rights reserved.
// Copyright (c) Contributors to the Apptainer project, established as
// Apptainer a Series of LF Projects LLC.
// This software is licensed under a 3-clause BSD license. Please consult the
Expand Down Expand Up @@ -2956,6 +2956,7 @@ func E2ETests(env e2e.TestEnv) testhelper.Tests {
"issue 5690": c.issue5690, // https://github.com/sylabs/singularity/issues/5690
"issue 1950": c.issue1950, // https://github.com/sylabs/singularity/issues/1950
"issue 2690": c.issue2690, // https://github.com/sylabs/singularity/issues/2690
"issue 1848": c.issue1848, // https://github.com/apptainer/apptainer/issues/1848
"network": c.actionNetwork, // test basic networking
"netns-path": c.actionNetnsPath, // test netns joining
"binds": c.actionBinds, // test various binds with --bind and --mount
Expand Down
28 changes: 27 additions & 1 deletion e2e/actions/regressions.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2020, Sylabs Inc. All rights reserved.
// Copyright (c) 2020-2024, Sylabs Inc. All rights reserved.
// Copyright (c) Contributors to the Apptainer project, established as
// Apptainer a Series of LF Projects LLC.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand Down Expand Up @@ -912,3 +914,27 @@ func (c actionTests) issue3129(t *testing.T) {
e2e.ExpectExit(0),
)
}

// Verify the generated host user data appended to /etc/passwd
func (c actionTests) issue1848(t *testing.T) {
e2e.EnsureImage(t, c.env)
user := e2e.UserProfile.HostUser(t)
expectedPasswdLine := fmt.Sprintf("%s:x:%d:%d:%s:%s:%s",
user.Name,
user.UID,
user.GID,
user.Gecos,
user.Dir,
user.Shell,
)

c.env.RunSingularity(
t,
e2e.WithProfile(e2e.UserProfile),
e2e.WithCommand("exec"),
e2e.WithArgs(c.env.ImagePath, "tail", "-1", "/etc/passwd"),
e2e.ExpectExit(0,
e2e.ExpectOutput(e2e.ExactMatch, expectedPasswdLine),
),
)
}

0 comments on commit a33c2b6

Please sign in to comment.