Skip to content

Commit

Permalink
Run IBM cloud tests as non root
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed May 3, 2022
1 parent b78e229 commit 816ddb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .ibm/images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ RUN curl -fsSL https://clis.cloud.ibm.com/install/linux | sh && \
rm -rf /var/lib/apt/lists/*

RUN go get github.com/kadel/odo-robot@965ea0dd848856691bfc76e6824a8b787b950045

# Create non-root user and associated home directory
RUN useradd -u 2001 tester
RUN mkdir /home/tester
RUN chown tester:tester /home/tester
# Change to non-root privilege
USER tester
2 changes: 1 addition & 1 deletion tests/integration/devfile/cmd_dev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ var _ = Describe("odo dev command tests", func() {
stateFile := filepath.Join(commonVar.Context, ".odo", "devstate.json")
helper.MakeDir(filepath.Dir(stateFile))
Expect(helper.CreateFileWithContent(stateFile, "")).ToNot(HaveOccurred())
Expect(os.Chmod(stateFile, 0000)).ToNot(HaveOccurred())
Expect(os.Chmod(stateFile, 0400)).ToNot(HaveOccurred())
})
It("should fail running odo dev", func() {
res := helper.Cmd("odo", "dev", "--random-ports").ShouldFail()
Expand Down

0 comments on commit 816ddb3

Please sign in to comment.