Skip to content

Commit

Permalink
container-structure-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
david sewell committed Mar 30, 2021
1 parent 96cc074 commit 925feee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ ARG GLIBC_VERSION
USER 0
RUN yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-${RHEL_ENDPOINT_VERSION}.x86_64.rpm \
&& yum -y install git-${GIT_VERSION} \
&& yum -y install libgcc.i686-${GCC_VERSION} \
libgcc-c++.i686-${GCC_VERSION} \
glibc-devel.i686-${GLIBC_VERSION} \
libstdc++-devel.i686-${GCC_VERSION} \
&& yum -y install libgcc-${GCC_VERSION} \
libgcc-c++-${GCC_VERSION} \
glibc-devel-${GLIBC_VERSION} \
libstdc++-devel-${GCC_VERSION} \
--setopt=protected_multilib=false \
&& yum -y install libgcc-${GCC_VERSION}.i686 \
libgcc-c++-${GCC_VERSION}.i686 \
glibc-devel-${GLIBC_VERSION}.i686 \
libstdc++-devel-${GCC_VERSION}.i686 \
--setopt=protected_multilib=false \
&& yum clean all
USER 1001
Expand All @@ -31,7 +36,9 @@ USER 0
RUN groupadd --gid 5001 nonroot \
# user needs a home folder to store azure credentials
&& useradd --gid nonroot --create-home --uid 5001 nonroot \
&& chown nonroot:nonroot /workspace
&& chown nonroot:nonroot /workspace \
&& chmod 755 /home/nonroot \
&& chmod 755 /workspace
USER nonroot

CMD ["bash"]
22 changes: 16 additions & 6 deletions tests/container-structure-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,35 @@ commandTests:
- name: "Check Python version"
command: "python"
args: ["--version"]
expectedOutput: ["Python 2.7.5"]
expectedError: ["Python 2.7.5"]

- name: "Check Git version"
command: "git"
args: ["--version"]
expectedOutput: ["git version 1.8.3.1"]
expectedOutput: ["git version 2.30.1"]

- name: "Check GCC version"
command: "gcc"
args: ["--version"]
expectedOutput: ["Red Hat 7.3.1-5"]

- name: "Check G++ version"
command: "g++"
args: ["--version"]
expectedOutput: ["Red Hat 7.3.1-5"]

fileExistenceTests:
- name: 'Check nonroot user home'
path: '/home/nonroot'
shouldExist: true
permissions: 'drwxr-xr-x'
uid: 1001
gid: 1001
uid: 5001
gid: 5001
isExecutableBy: 'group'
- name: 'Check nonroot user rights on /workspace folder'
path: '/workspace'
shouldExist: true
permissions: 'drwxr-xr-x'
uid: 1001
gid: 1001
uid: 5001
gid: 5001
isExecutableBy: 'group'

0 comments on commit 925feee

Please sign in to comment.