directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject [1/2] directory-fortress-core git commit: Add dockerfile with preconfigured ApacheDS for Fortress tests
Date Sat, 17 Jun 2017 16:47:19 GMT
Repository: directory-fortress-core
Updated Branches:
  refs/heads/master 7c38dccbd -> 5621dcf68


Add dockerfile with preconfigured ApacheDS for Fortress tests


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/2dbe3357
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/2dbe3357
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/2dbe3357

Branch: refs/heads/master
Commit: 2dbe33576e4109be4207f5cbc9aa51d47ee152cf
Parents: 7c38dcc
Author: Stefan Seelmann <mail@stefan-seelmann.de>
Authored: Sat Jun 17 18:46:16 2017 +0200
Committer: Stefan Seelmann <mail@stefan-seelmann.de>
Committed: Sat Jun 17 18:46:16 2017 +0200

----------------------------------------------------------------------
 .../Dockerfile                                  | 50 +++++++++++++++++
 .../README.md                                   | 18 ++++++
 .../run-tests.sh                                | 58 ++++++++++++++++++++
 3 files changed, 126 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/2dbe3357/src/docker/apacheds-for-apache-fortress-tests/Dockerfile
----------------------------------------------------------------------
diff --git a/src/docker/apacheds-for-apache-fortress-tests/Dockerfile b/src/docker/apacheds-for-apache-fortress-tests/Dockerfile
new file mode 100644
index 0000000..253b7b7
--- /dev/null
+++ b/src/docker/apacheds-for-apache-fortress-tests/Dockerfile
@@ -0,0 +1,50 @@
+#
+#   Licensed to the Apache Software Foundation (ASF) under one 
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+#   KIND, either express or implied.  See the License for the 
+#   specific language governing permissions and limitations
+#   under the License.
+#
+
+FROM openjdk:8
+
+# Install LDAP tools
+ENV DEBIAN_FRONTEND=noninteractive
+RUN \
+    apt-get update && \
+    apt-get install -y -qq ldap-utils netcat && \
+    rm -rf /var/lib/apt/lists/*
+
+# Define ApacheDS version
+ENV APACHEDS_VERSION=2.0.0-M24
+ENV APACHEDS_SERVICE_NAME=apacheds-${APACHEDS_VERSION}-default
+
+# Install ApacheDS
+RUN \
+    wget http://www.apache.org/dist//directory/apacheds/dist/${APACHEDS_VERSION}/apacheds-${APACHEDS_VERSION}-amd64.deb
-q -O /tmp/apacheds.deb && \
+    dpkg -i /tmp/apacheds.deb && \
+    rm /tmp/apacheds.deb
+
+# Add fortress schema
+ADD ldap/schema/apacheds-fortress.ldif /tmp/
+RUN \
+    service ${APACHEDS_SERVICE_NAME} start && \
+    timeout 30 sh -c "while ! nc -z localhost 10389; do sleep 1; done" && \
+    service ${APACHEDS_SERVICE_NAME} status && \
+    ldapmodify -v -x -h localhost -p 10389 -D uid=admin,ou=system -w secret -a -f /tmp/apacheds-fortress.ldif
&& \
+    service ${APACHEDS_SERVICE_NAME} stop
+
+EXPOSE 10389
+CMD ["sh", "-c", "service ${APACHEDS_SERVICE_NAME} console"]
+

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/2dbe3357/src/docker/apacheds-for-apache-fortress-tests/README.md
----------------------------------------------------------------------
diff --git a/src/docker/apacheds-for-apache-fortress-tests/README.md b/src/docker/apacheds-for-apache-fortress-tests/README.md
new file mode 100644
index 0000000..82e7470
--- /dev/null
+++ b/src/docker/apacheds-for-apache-fortress-tests/README.md
@@ -0,0 +1,18 @@
+ApacheDS for Apache Fortress tests
+==================================
+
+This directory contains
+
+* a `Dockerfile` for building a Docker image with preconfigured ApacheDS for Apache Fortress
+* a `run-tests.sh` script that start such a Docker container and executes the Fortress tests
against it
+
+
+Build image (run from fortress-core root folder)
+
+    docker build -t apachedirectory/apacheds-for-apache-fortress-tests -f src/docker/apacheds-for-apache-fortress-tests/Dockerfile
.
+
+
+Push image to docker hub:
+
+    docker push apachedirectory/apacheds-for-apache-fortress-tests 
+

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/2dbe3357/src/docker/apacheds-for-apache-fortress-tests/run-tests.sh
----------------------------------------------------------------------
diff --git a/src/docker/apacheds-for-apache-fortress-tests/run-tests.sh b/src/docker/apacheds-for-apache-fortress-tests/run-tests.sh
new file mode 100755
index 0000000..0fae7ab
--- /dev/null
+++ b/src/docker/apacheds-for-apache-fortress-tests/run-tests.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+#   Licensed to the Apache Software Foundation (ASF) under one
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+#
+
+# stop execution if any command fails (i.e. exits with status code > 0)
+set -e
+
+# trace commands
+set -x
+
+# startup docker container
+docker pull apachedirectory/apacheds-for-apache-fortress-tests
+CONTAINER_ID=$(docker run -d -P apachedirectory/apacheds-for-apache-fortress-tests)
+CONTAINER_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "10389/tcp")
0).HostPort}}' $CONTAINER_ID)
+echo $CONTAINER_PORT
+
+# configure build.properties
+cp build.properties.example build.properties
+sed -i 's/^ldap\.server\.type=.*/ldap.server.type=apacheds/' build.properties
+sed -i 's/^ldap\.host=.*/ldap.host=localhost/' build.properties
+sed -i 's/^ldap\.port=.*/ldap.port='${CONTAINER_PORT}'/' build.properties
+sed -i 's/^suffix\.name=.*/suffix.name=example/' build.properties
+sed -i 's/^suffix\.dc=.*/suffix.dc=com/' build.properties
+sed -i 's/^root\.dn=.*/root.dn=uid=admin,ou=system/' build.properties
+sed -i 's/^root\.pw=.*/root.pw={SSHA}pSOV2TpCxj2NMACijkcMko4fGrFopctU/' build.properties
+sed -i 's/^cfg\.root\.pw=.*/cfg.root.pw=secret/' build.properties
+
+# prepare
+mvn clean install
+mvn install -Dload.file=./ldap/setup/refreshLDAPData.xml
+mvn install -Dload.file=./ldap/setup/DelegatedAdminManagerLoad.xml
+
+# run tests
+mvn test -Dtest=FortressJUnitTest
+
+# rerun tests to verify teardown APIs work
+mvn test -Dtest=FortressJUnitTest
+
+# stop and delete docker container
+docker stop $CONTAINER_ID
+docker rm $CONTAINER_ID
+


Mime
View raw message