Skip to content

Commit

Permalink
Merge pull request #152 from nahara7/nahara-image-tests
Browse files Browse the repository at this point in the history
Goss Image Tests
  • Loading branch information
nahara7 authored Jul 13, 2021
2 parents de5f9c3 + 06fc8bb commit 59b5e9d
Show file tree
Hide file tree
Showing 18 changed files with 183 additions and 41 deletions.
2 changes: 2 additions & 0 deletions connect/.env
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
RSC_VERSION=1.8.8.2
R_VERSION=3.6.2
PYTHON_VERSION=3.6.5
2 changes: 2 additions & 0 deletions connect/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ services:
environment:
# uses .env by default
- RSC_VERSION
- R_VERSION
- PYTHON_VERSION
volumes:
- "./test/run_tests.sh:/run_tests.sh"
- "./test/goss.yaml:/tmp/goss.yaml"
49 changes: 34 additions & 15 deletions connect/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,54 @@ package:

file:
/etc/rstudio-connect/license.lic:
# currently does not exist
# be sure it is NOT a directory
# Currently does not exist
# Be sure it is NOT a directory
exists: false
/opt/rstudio-connect/:
exists: true
/opt/rstudio-connect/bin/connect:
exists: true
/usr/local/bin/tini:
exists: true
# Ensure startup file exists
/usr/local/bin/startup.sh:
exists: true
owner: root
group: root
filetype: file
# Ensure log files exist
/var/log/rstudio-connect.log:
exists: true
/opt/python/{{.Env.PYTHON_VERSION}}/bin/python:
exists: true

# check product version
# Check product version
command:
"/opt/rstudio-connect/bin/connect --version":
title: connect_version_matches
exit-status: 0
stdout: [
title: connect_version_matches
exit-status: 0
stdout: [
"/{{ .Env.RSC_VERSION }}/"
]
# goss times out after 10 seconds
]

# Goss times out after 10 seconds
"timeout --signal=SIGINT 7 /opt/rstudio-connect/bin/connect --config /etc/rstudio-connect/rstudio-connect.gcfg":
title: connect_starts
# the timeout should stop connect, not a failure
# The timeout should stop connect, not a failure
exit-status: 124
# maybe optimistic that Connect finishes starting...
#stderr: [
# "Starting HTTP listener on :3939"
#]
"/opt/R/3.6.2/bin/R --version":

# Ensure correct R version
"/opt/R/{{ .Env.R_VERSION }}/bin/R --version":
title: r_version_match
exit-status: 0
stdout: [
"/3.6.2/"
"/{{ .Env.R_VERSION }}/"
]

# Ensure correct python version
"/opt/python/{{ .Env.PYTHON_VERSION }}/bin/python --version":
title: python_version_matches
exit-status: 0
stderr: [
"/{{ .Env.PYTHON_VERSION }}/"
]
1 change: 1 addition & 0 deletions package-manager/.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
RSPM_VERSION=1.2.2.1-17
R_VERSION=3.6.2
1 change: 1 addition & 0 deletions package-manager/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
environment:
# uses .env by default
- RSPM_VERSION
- R_VERSION
volumes:
- "./test/run_tests.sh:/run_tests.sh"
- "./test/goss.yaml:/tmp/goss.yaml"
24 changes: 21 additions & 3 deletions package-manager/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package:

file:
/etc/rstudio-pm/license.lic:
# currently does not exist
# be sure it is NOT a directory
# Currently does not exist
# Be sure it is NOT a directory
exists: false
/opt/rstudio-pm/:
exists: true
Expand All @@ -26,12 +26,30 @@ file:
exists: true
/usr/local/bin/rspm:
exists: true
/usr/local/bin/tini:
exists: true
/var/log/rstudio-pm.log:
exists: true
filetype: file

# check product version

# Check product version
command:
"/opt/rstudio-pm/bin/rstudio-pm --version":
title: package-manager_version_matches
exit-status: 0
stdout: [
"/{{ .Env.RSPM_VERSION }}/"
]
# Ensure package manager is running
"/opt/rstudio-pm/bin/rstudio-pm --config /etc/rstudio-pm/rstudio-pm.gcfg":
title: rspm_start
exit-status: 0

# Ensure correct R version
"/opt/R/{{ .Env.R_VERSION }}/bin/R --version":
title: r_version_match
exit-status: 0
stdout: [
"/{{ .Env.R_VERSION }}/"
]
4 changes: 4 additions & 0 deletions r-session-complete/bionic/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
R_VERSION=4.0.2
PYTHON_VERSION=3.7.7
DRIVERS_VERSION=1.7.0
RSP_VERSION=1.4.1717-3
3 changes: 3 additions & 0 deletions r-session-complete/bionic/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ services:
environment:
# uses .env by default
- RSP_VERSION
- R_VERSION
- PYTHON_VERSION
volumes:
- "./test/run_tests.sh:/run_tests.sh"
- "./test/goss.yaml:/tmp/goss.yaml"
- "./test/goss_vars.yaml:/tmp/goss_vars.yaml"
31 changes: 31 additions & 0 deletions r-session-complete/bionic/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,39 @@ file:
exists: true
/usr/lib/rstudio-server/bin/rsession:
exists: true
/opt/code-server/:
exists: true
filetype: directory
/opt/rstudio-drivers:
exists: true
filetype: directory

command:
"echo '{ \"cells\": [], \"metadata\": {}, \"nbformat\": 4, \"nbformat_minor\": 2}' | /opt/python/3.7.7/bin/jupyter nbconvert --to notebook --stdin --stdout":
title: jupyter_works
exit-status: 0

# Ensure all R Packages are installed
{{ $pkgs := .Vars.RPackages }}
/opt/R/{{ .Env.R_VERSION }}/bin/R --slave -e 'library()' | cut -f 1 -d ' ' | grep -v '^Packages$' | grep -v '^$':
exit-status: 0
stdout:
{{ range $pkg := $pkgs }}
- {{ $pkg }}
{{end}}

# Ensure correct R version
"/opt/R/{{.Env.R_VERSION}}/bin/R --version":
title: r_version_match
exit-status: 0
stdout: [
"/{{.Env.R_VERSION}}/"
]

# Ensure correct python version
"/opt/python/{{.Env.PYTHON_VERSION}}/bin/python --version":
title: python_version_matches
exit-status: 0
stdout: [
"/{{ .Env.PYTHON_VERSION }}/"
]
7 changes: 7 additions & 0 deletions r-session-complete/bionic/test/goss_vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
RPackages:
- "odbc"
- "devtools"
- "shiny"
- "rmarkdown"
- "plumber"

4 changes: 4 additions & 0 deletions r-session-complete/centos7/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
R_VERSION=4.0.2
PYTHON_VERSION=3.7.7
DRIVERS_VERSION=1.7.0
RSP_VERSION=1.4.1717-3
3 changes: 3 additions & 0 deletions r-session-complete/centos7/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ services:
environment:
# uses .env by default
- RSP_VERSION
- R_VERSION
- PYTHON_VERSION
volumes:
- "./test/run_tests.sh:/run_tests.sh"
- "./test/goss.yaml:/tmp/goss.yaml"
- "./test/goss_vars.yaml:/tmp/goss_vars.yaml"
31 changes: 31 additions & 0 deletions r-session-complete/centos7/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,39 @@ file:
exists: true
/usr/lib/rstudio-server/bin/rsession:
exists: true
/opt/code-server/:
exists: true
filetype: directory
/opt/rstudio-drivers:
exists: true
filetype: directory

command:
"echo '{ \"cells\": [], \"metadata\": {}, \"nbformat\": 4, \"nbformat_minor\": 2}' | /opt/python/3.7.7/bin/jupyter nbconvert --to notebook --stdin --stdout":
title: jupyter_works
exit-status: 0

# Ensure all R Packages are installed
{{ $pkgs := .Vars.RPackages }}
/opt/R/{{ .Env.R_VERSION }}/bin/R --slave -e 'library()' | cut -f 1 -d ' ' | grep -v '^Packages$' | grep -v '^$':
exit-status: 0
stdout:
{{ range $pkg := $pkgs }}
- {{ $pkg }}
{{end}}

# Ensure correct R version
"/opt/R/{{.Env.R_VERSION}}/bin/R --version":
title: r_version_match
exit-status: 0
stdout: [
"/{{.Env.R_VERSION}}/"
]

# Ensure correct python version
"/opt/python/{{.Env.PYTHON_VERSION}}/bin/python --version":
title: python_version_matches
exit-status: 0
stdout: [
"/{{ .Env.PYTHON_VERSION }}/"
]
6 changes: 6 additions & 0 deletions r-session-complete/centos7/test/goss_vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
RPackages:
- "odbc"
- "devtools"
- "shiny"
- "rmarkdown"
- "plumber"
5 changes: 5 additions & 0 deletions server-pro/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
RSP_VERSION=1.4.1717-3
RSP_DOWNLOAD_URL=https://download2.rstudio.org/server/bionic/amd64
RSP_NAME=rstudio-workbench
PYTHON_VERSION=3.9.5
PYTHON_VERSION_ALT=3.8.10
JUPYTER_PYTHON_VERSION=3.8.10
R_VERSION_ALT=4.1.0
R_VERSION=3.6.2
10 changes: 5 additions & 5 deletions server-pro/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-4.7.12.1-Linux-x86_64

# Install another Python --------------------------------------------------------------#

ARG ALT_PYTHON_VERSION=3.8.10
ARG PYTHON_VERSION_ALT=3.8.10
RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-4.7.12.1-Linux-x86_64.sh && \
bash Miniconda3-4.7.12.1-Linux-x86_64.sh -bp /opt/python/${ALT_PYTHON_VERSION} && \
/opt/python/${ALT_PYTHON_VERSION}/bin/conda install -y python==${ALT_PYTHON_VERSION} && \
/opt/python/${ALT_PYTHON_VERSION}/bin/pip install \
bash Miniconda3-4.7.12.1-Linux-x86_64.sh -bp /opt/python/${PYTHON_VERSION_ALT} && \
/opt/python/${PYTHON_VERSION_ALT}/bin/conda install -y python==${PYTHON_VERSION_ALT} && \
/opt/python/${PYTHON_VERSION_ALT}/bin/pip install \
ipykernel \
virtualenv \
&& \
rm -rf Miniconda3-*-Linux-x86_64.sh && \
/opt/python/${ALT_PYTHON_VERSION}/bin/python -m ipykernel install --name py${ALT_PYTHON_VERSION} --display-name "Python ${ALT_PYTHON_VERSION}"
/opt/python/${PYTHON_VERSION_ALT}/bin/python -m ipykernel install --name py${PYTHON_VERSION_ALT} --display-name "Python ${PYTHON_VERSION_ALT}"

# Runtime settings ------------------------------------------------------------#
ARG TINI_VERSION=0.18.0
Expand Down
5 changes: 5 additions & 0 deletions server-pro/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ services:
environment:
# uses .env by default
- RSP_VERSION
- R_VERSION
- PYTHON_VERSION
- PYTHON_VERSION_ALT
- JUPYTER_PYTHON_VERSION
- R_VERSION_ALT
volumes:
- "./test/run_tests.sh:/run_tests.sh"
- "./test/goss.yaml:/tmp/goss.yaml"
36 changes: 18 additions & 18 deletions server-pro/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ file:
exists: false
/usr/lib/rstudio-server:
exists: true
/opt/R/3.6.3/bin/R:
/opt/R/{{.Env.R_VERSION_ALT}}/bin/R:
exists: true
filetype: file
/opt/R/4.1.0/bin/R:
exists: true
filetype: file
/opt/python/3.9.5/bin/python:
/opt/python/{{.Env.PYTHON_VERSION}}/bin/python:
exists: true
filetype: symlink
/opt/python/3.8.10/bin/python:
/opt/python/{{.Env.PYTHON_VERSION_ALT}}/bin/python:
exists: true
filetype: symlink
/opt/python/jupyter/bin/python:
Expand All @@ -50,41 +47,44 @@ file:
owner: rstudio-server
group: rstudio-server


command:
"su rstudio-server -c 'touch /var/lib/rstudio-server/monitor/log/rstudio-server.log'":
title: server-pro_monitor_log_file_creates
exit-status: 0
"touch /var/log/rstudio-server.log":
title: server-pro_server_log_creates
exit-status: 0
# check product version
#"rstudio-server version":
# title: server-pro_version_matches
# exit-status: 0
# stdout: [
# "/{{ .Env.RSP_VERSION }}/",
# "/Pro/" # this will switch to Workbench when we release the preview build
# ]
# Check product version
"rstudio-server version":
title: server-pro_version_matches
exit-status: 0
stdout: [
"/{{ .Env.RSP_VERSION }}/",
"/Workbench/"
]
"echo '{ \"cells\": [], \"metadata\": {}, \"nbformat\": 4, \"nbformat_minor\": 2}' | /opt/python/jupyter/bin/jupyter nbconvert --to notebook --stdin --stdout":
title: jupyter_works
exit-status: 0
# Ensure correct python version
"/opt/python/3.8.10/bin/python --version":
title: python_version_matches
title: alternate_python_version_matches
exit-status: 0
stdout: [
"/3.8.10/"
"/{{.Env.PYTHON_VERSION_ALT}}/"
]
# Ensure correct python version
"/opt/python/3.9.5/bin/python --version":
title: python_version_matches
exit-status: 0
stdout: [
"/3.9.5/"
"/{{.Env.PYTHON_VERSION}}/"
]
"/opt/python/jupyter/bin/python --version":
title: jupyter_python_version_matches
exit-status: 0
stdout: [
"/3.8.10/"
"/{{.Env.JUPYTER_PYTHON_VERSION}}/"
]
"which openssl":
title: uses_system_openssl
Expand Down

0 comments on commit 59b5e9d

Please sign in to comment.