From cf98169520b6848d521fb0951e412c41757df9f5 Mon Sep 17 00:00:00 2001 From: Dan Reid Date: Sat, 5 Mar 2016 10:54:46 +0000 Subject: [PATCH] Tests exploring #25. RForge version is now default for tests --- client_test.go | 6 +++++ test/{Dockerfile-R => Dockerfile-RServe-Cran} | 5 ++-- test/Dockerfile-RServe-RForge | 26 +++++++++++++++++++ test/docker-compose.yml | 11 ++++++-- 4 files changed, 44 insertions(+), 4 deletions(-) rename test/{Dockerfile-R => Dockerfile-RServe-Cran} (86%) create mode 100644 test/Dockerfile-RServe-RForge diff --git a/client_test.go b/client_test.go index 360f03a..a9d0dd9 100644 --- a/client_test.go +++ b/client_test.go @@ -6,6 +6,9 @@ func TestConnection(t *testing.T) { if _, err := NewRClient("localhost", 6311); err != nil { t.Error("Failed to connect to RServe: " + err.Error()) } + if _, err := NewRClient("localhost", 6313); err != nil { + t.Error("Failed to connect to RServe from CRAN: " + err.Error()) + } } func TestConnectionFailure(t *testing.T) { @@ -21,6 +24,9 @@ func TestSecureConnection(t *testing.T) { if _, err := NewRClientWithAuth("localhost", 6312, "roger", "testpassword"); err != nil { t.Error("Failed to connect to secure RServe: " + err.Error()) } + if _, err := NewRClientWithAuth("localhost", 6314, "roger", "testpassword"); err != nil { + t.Error("Failed to connect to secure RServe from CRAN: " + err.Error()) + } } func TestSecureConnectionFailure(t *testing.T) { diff --git a/test/Dockerfile-R b/test/Dockerfile-RServe-Cran similarity index 86% rename from test/Dockerfile-R rename to test/Dockerfile-RServe-Cran index 4cc9e3e..595da77 100644 --- a/test/Dockerfile-R +++ b/test/Dockerfile-RServe-Cran @@ -9,9 +9,10 @@ RUN apt-get install -y --no-install-recommends \ RUN R -e 'options(repos = c(CRAN = "http://cran.rstudio.com/")); install.packages(c("Rserve"))' +RUN echo "port 6313" >> /etc/Rserv.conf RUN echo "remote enable" >> /etc/Rserv.conf -RUN echo "port 6312" >> /etc/Rserv-secure.conf +RUN echo "port 6314" >> /etc/Rserv-secure.conf RUN echo "remote enable" >> /etc/Rserv-secure.conf RUN echo "auth required" >> /etc/Rserv-secure.conf RUN echo "pwdfile /etc/Rserve.pwd" >> /etc/Rserv-secure.conf @@ -22,4 +23,4 @@ WORKDIR /usr/local/src/senseyeio CMD nohup R < test.r --no-save & nohup R < test-secure.r --no-save -EXPOSE 6311 6312 +EXPOSE 6313 6314 diff --git a/test/Dockerfile-RServe-RForge b/test/Dockerfile-RServe-RForge new file mode 100644 index 0000000..23d8678 --- /dev/null +++ b/test/Dockerfile-RServe-RForge @@ -0,0 +1,26 @@ +FROM r-base:3.2.1 + +RUN apt-get update + +RUN apt-get install -y --no-install-recommends \ + libxml2-dev \ + libcurl4-gnutls-dev \ + libssl-dev + +RUN R -e 'install.packages("Rserve",,"http://rforge.net/")' + +RUN echo "port 6311" >> /etc/Rserv.conf +RUN echo "remote enable" >> /etc/Rserv.conf + +RUN echo "port 6312" >> /etc/Rserv-secure.conf +RUN echo "remote enable" >> /etc/Rserv-secure.conf +RUN echo "auth required" >> /etc/Rserv-secure.conf +RUN echo "pwdfile /etc/Rserve.pwd" >> /etc/Rserv-secure.conf +RUN echo "roger testpassword" >> /etc/Rserve.pwd + +COPY . /usr/local/src/senseyeio +WORKDIR /usr/local/src/senseyeio + +CMD nohup R < test.r --no-save & nohup R < test-secure.r --no-save + +EXPOSE 6311 6312 diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 050acb5..ce7d618 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -1,6 +1,13 @@ -rserve: +rserve-cran: build: . - dockerfile: Dockerfile-R + dockerfile: Dockerfile-RServe-Cran ports: + - "6313:6313" + - "6314:6314" + +rserve-rforge: + build: . + dockerfile: Dockerfile-RServe-RForge + ports: - "6311:6311" - "6312:6312"