Commit e8f29c3b by Tomas Dvorak

dockerized tests

parent 42324df2
......@@ -2,4 +2,5 @@
# intellij idea project files
*.iml
*.ipr
\ No newline at end of file
*.ipr
.idea/
\ No newline at end of file
language: java
jdk:
- oraclejdk8
sudo: false
services: mongodb
language: node_js
sudo: required
services: docker
install:
- npm install jshint -g
env:
matrix:
- MONGODB_VERSION=2.4
- MONGODB_VERSION=2.6
- MONGODB_VERSION=2.8
- MONGODB_VERSION=3.0
- MONGODB_VERSION=3.2
script:
- jshint variety.js
- cd test && mvn test
\ No newline at end of file
- ./test.sh
\ No newline at end of file
FROM mongo:{MONGODB_VERSION}
## Java installation
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' | tee /etc/apt/sources.list.d/webupd8team-java-trusty.list
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends oracle-java8-installer && apt-get clean all
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN java -version
## Maven installation
RUN apt-get install -y --force-yes --no-install-recommends curl
RUN apt-get install -y --force-yes --no-install-recommends ca-certificates
ENV MAVEN_VERSION 3.3.9
RUN apt-get install -y --force-yes --no-install-recommends curl
RUN curl -fsSL https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar xzf - -C /usr/share \
&& mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
RUN mvn --version
## Prepare entrypoint script (start MongoDB, switch to test dir, execute maven)
RUN mkdir /opt/variety-test
WORKDIR /opt/variety-test/
RUN echo "#!/bin/sh" > run.sh
RUN echo "mongod --logpath /var/log/mongod.log &" >> run.sh
RUN echo "cd /opt/variety/test" >> run.sh
RUN echo "mvn test" >> run.sh
RUN chmod +x /opt/variety-test/run.sh
ENTRYPOINT ["/opt/variety-test/run.sh"]
\ No newline at end of file
#!/bin/bash
set -e
# location of this script
DIR=$(readlink -f $(dirname $0))
VERSION=${MONGODB_VERSION:=2.6}
echo
echo "****************************************"
echo "* "
echo "* Testing Variety.js with MongoDB $VERSION"
echo "* $(docker --version)"
echo "* "
echo "****************************************"
echo
sed -e "s/{MONGODB_VERSION}/$VERSION/g" Dockerfile.template > Dockerfile_$VERSION
docker build -t variety-$VERSION -f Dockerfile_$VERSION .
docker run -t -v $DIR:/opt/variety variety-$VERSION
rm Dockerfile_$VERSION
\ No newline at end of file
......@@ -16,7 +16,7 @@
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.4</version>
<version>3.2.1</version>
</dependency>
<dependency>
......
......@@ -9,6 +9,7 @@ import com.mongodb.ServerAddress;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
......@@ -18,6 +19,7 @@ import java.util.Arrays;
* Tests, if variety can return results for user with read only access to analyzed database (without permission to list
* all other dbs / collections, without permission to persist results).
*/
@Ignore
public class LimitedAccessTest {
private Variety variety;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment