Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e tests: fix incorrect os.User.Name #17290

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/e2e/generate_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ var _ = Describe("Podman kube generate", func() {
It("podman generate kube on pod with user namespace", func() {
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())
name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/pod_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ ENTRYPOINT ["sleep","99999"]
Expect(session).Should(Exit(0))
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())
Expect(session.OutputToString()).To(ContainSubstring(u.Name))
Expect(session.OutputToString()).To(Equal(u.Username))

// root owns /usr
session = podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "stat", "-c%u", "/usr"})
Expand Down Expand Up @@ -715,10 +715,10 @@ ENTRYPOINT ["sleep","99999"]
Expect(err).ToNot(HaveOccurred())
// container inside pod inherits user from infra container if --user is not set
// etc/passwd entry will look like USERNAME:*:1000:1000:Full User Name:/:/bin/sh
exec1 := podmanTest.Podman([]string{"exec", ctrName, "cat", "/etc/passwd"})
exec1 := podmanTest.Podman([]string{"exec", ctrName, "id", "-un"})
exec1.WaitWithDefaultTimeout()
Expect(exec1).Should(Exit(0))
Expect(exec1.OutputToString()).To(ContainSubstring(u.Name))
Expect(exec1.OutputToString()).To(Equal(u.Username))

exec2 := podmanTest.Podman([]string{"exec", ctrName, "useradd", "testuser"})
exec2.WaitWithDefaultTimeout()
Expand All @@ -733,7 +733,7 @@ ENTRYPOINT ["sleep","99999"]
It("podman pod create with --userns=auto", func() {
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())
name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down Expand Up @@ -768,7 +768,7 @@ ENTRYPOINT ["sleep","99999"]
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())

name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down Expand Up @@ -804,7 +804,7 @@ ENTRYPOINT ["sleep","99999"]
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())

name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down Expand Up @@ -841,7 +841,7 @@ ENTRYPOINT ["sleep","99999"]
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())

name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/run_userns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman build with --userns=auto", func() {
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())
name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down Expand Up @@ -157,7 +157,7 @@ var _ = Describe("Podman UserNS support", func() {
Expect(session).Should(Exit(0))
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())
Expect(session.OutputToString()).To(ContainSubstring(u.Name))
Expect(session.OutputToString()).To(Equal(u.Username))
})

It("podman --userns=keep-id root owns /usr", func() {
Expand Down Expand Up @@ -201,7 +201,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman --userns=auto", func() {
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())
name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down Expand Up @@ -239,7 +239,7 @@ var _ = Describe("Podman UserNS support", func() {
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())

name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down Expand Up @@ -277,7 +277,7 @@ var _ = Describe("Podman UserNS support", func() {
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())

name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down Expand Up @@ -306,7 +306,7 @@ var _ = Describe("Podman UserNS support", func() {
u, err := user.Current()
Expect(err).ToNot(HaveOccurred())

name := u.Name
name := u.Username
if name == "root" {
name = "containers"
}
Expand Down