You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2015/04/25 11:37:06 UTC

svn commit: r1676003 - in /directory/apacheds/trunk/resources/docker: bin.test deb.sh deb.test rpm.test

Author: seelmann
Date: Sat Apr 25 09:37:05 2015
New Revision: 1676003

URL: http://svn.apache.org/r1676003
Log:
Added test scripts for rpm and bin installer, refactored and renamed deb installer test

Added:
    directory/apacheds/trunk/resources/docker/bin.test
    directory/apacheds/trunk/resources/docker/deb.test
      - copied, changed from r1675966, directory/apacheds/trunk/resources/docker/deb.sh
    directory/apacheds/trunk/resources/docker/rpm.test
Removed:
    directory/apacheds/trunk/resources/docker/deb.sh

Added: directory/apacheds/trunk/resources/docker/bin.test
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/resources/docker/bin.test?rev=1676003&view=auto
==============================================================================
--- directory/apacheds/trunk/resources/docker/bin.test (added)
+++ directory/apacheds/trunk/resources/docker/bin.test Sat Apr 25 09:37:05 2015
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# 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. 
+
+# 
+# Script to test binary installer within Docker container.
+#
+#
+# Run with official Java image (Debian 8, OpenJDK 8):
+#
+#     cat bin.test | docker run -i --rm -e URL="<URL to .bin>" -e VERSION="<ApacheDS version>" java:8
+#
+
+
+NAME="apacheds-${VERSION}"
+DIRNAME="${NAME}"
+SERVICE_NAME="${NAME}-default"
+
+wait_for_apacheds() {
+    timeout 15  sh -c "while ! nc -z localhost 10389; do sleep 1; done"
+}
+
+# stop execution if any command fails (i.e. exits with status code > 0)
+set -e
+
+# trace commands
+set -x
+
+# install ldapsearch and tools
+apt-get -qq update && apt-get -qq -y install ldap-utils netcat
+
+# download
+wget -q -O apacheds.bin ${URL}
+
+# install
+chmod +x apacheds.bin
+# skip license text
+export MORE="\+10000"
+# agreee to license terms and accept default install options
+./apacheds.bin << END_OF_RESPONSES
+yes
+
+
+
+
+
+
+END_OF_RESPONSES
+
+# assert files and directories exist
+test -f /opt/${DIRNAME}/LICENSE
+test -f /opt/${DIRNAME}/NOTICE
+test -d /var/lib/${DIRNAME}/default
+
+# assert not running
+service ${SERVICE_NAME} status | grep "ApacheDS - default is not running"
+
+# start
+service ${SERVICE_NAME} start 
+wait_for_apacheds
+
+# assert running
+service ${SERVICE_NAME} status | grep "ApacheDS - default is running"
+
+# search
+ldapsearch -h localhost -p 10389 -x -D "uid=admin,ou=system" -w secret -s base -b "dc=example,dc=com"
+
+# restart and search a few times
+for i in 1 2 3
+do
+    service ${SERVICE_NAME} restart 
+    wait_for_apacheds
+    ldapsearch -h localhost -p 10389 -x -D "uid=admin,ou=system" -w secret -s base -b "dc=example,dc=com"
+done
+
+# stop
+service ${SERVICE_NAME} stop
+
+# assert not running
+service ${SERVICE_NAME} status | grep "ApacheDS - default is not running"
+
+# assert password warning in log
+grep ".*WARN.*admin password.*security breach.*" /var/lib/${DIRNAME}/default/log/apacheds.log
+# assert no error in log
+! grep ".*ERROR.*" /var/lib/${DIRNAME}/default/log/apacheds.log
+
+# SUCCESS
+echo "SUCCESS"
+

Copied: directory/apacheds/trunk/resources/docker/deb.test (from r1675966, directory/apacheds/trunk/resources/docker/deb.sh)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/resources/docker/deb.test?p2=directory/apacheds/trunk/resources/docker/deb.test&p1=directory/apacheds/trunk/resources/docker/deb.sh&r1=1675966&r2=1676003&rev=1676003&view=diff
==============================================================================
--- directory/apacheds/trunk/resources/docker/deb.sh (original)
+++ directory/apacheds/trunk/resources/docker/deb.test Sat Apr 25 09:37:05 2015
@@ -20,13 +20,20 @@
 # 
 # Script to test Debian installer within Docker container.
 #
-# Run with official Java image (Debian 8, OpenJDK 8)
 #
-#     cat deb.sh | docker run -i --rm -e URL="<URL to .deb>" -e VERSION="<ApacheDS version>" java:8
+# Run with official Java image (Debian 8, OpenJDK 8):
 #
-# Run with 'dockerfile' Java image (Ubuntu 14.04, Oracle Java 7)
+#     cat deb.test | docker run -i --rm -e URL="<URL to .deb>" -e VERSION="<ApacheDS version>" java:8
 #
-#     cat deb.sh | docker run -i --rm -e URL="<URL to .deb>" -e VERSION="<ApacheDS version>" dockerfile/java:oracle-java7
+#
+# Run with 'dockerfile' Java image (Ubuntu 14.04, Oracle Java 7):
+#
+#     cat deb.test | docker run -i --rm -e URL="<URL to .deb>" -e VERSION="<ApacheDS version>" dockerfile/java:oracle-java7
+#
+#
+# Run with 32-bit Java image (Ubuntu 14.04 i386, OpenJDK 7):
+#
+#     cat deb.test | docker run -i --rm -e URL="<URL to .deb>" -e VERSION="<ApacheDS version>" cato1971/java-32bit:7-jre 
 #
 
 
@@ -34,6 +41,9 @@ NAME="apacheds-${VERSION}"
 DIRNAME="${NAME}"
 SERVICE_NAME="${NAME}-default"
 
+wait_for_apacheds() {
+    timeout 15  sh -c "while ! nc -z localhost 10389; do sleep 1; done"
+}
 
 # stop execution if any command fails (i.e. exits with status code > 0)
 set -e
@@ -41,8 +51,11 @@ set -e
 # trace commands
 set -x
 
+# install ldapsearch and tools
+apt-get -qq update && apt-get -qq -y install ldap-utils netcat
+
 # download
-wget -O apacheds.deb ${URL}
+wget -q -O apacheds.deb ${URL}
 
 # install
 dpkg -i apacheds.deb
@@ -53,30 +66,28 @@ dpkg -l | grep apacheds
 # assert files and directories exist
 test -f /opt/${DIRNAME}/LICENSE
 test -f /opt/${DIRNAME}/NOTICE
-test -d/var/lib/${DIRNAME}/default
+test -d /var/lib/${DIRNAME}/default
 
 # assert not running
 service ${SERVICE_NAME} status | grep "ApacheDS - default is not running"
 
 # start
 service ${SERVICE_NAME} start 
-sleep 5
+wait_for_apacheds
 
 # assert running
 service ${SERVICE_NAME} status | grep "ApacheDS - default is running"
 
-# install ldapsearch
-apt-get update && apt-get install -y ldap-utils
-
 # search
 ldapsearch -h localhost -p 10389 -x -D "uid=admin,ou=system" -w secret -s base -b "dc=example,dc=com"
 
-# restart
-service ${SERVICE_NAME} restart 
-sleep 5
-
-# search after restart
-ldapsearch -h localhost -p 10389 -x -D "uid=admin,ou=system" -w secret -s base -b "dc=example,dc=com"
+# restart and search a few times
+for i in 1 2 3
+do
+    service ${SERVICE_NAME} restart 
+    wait_for_apacheds
+    ldapsearch -h localhost -p 10389 -x -D "uid=admin,ou=system" -w secret -s base -b "dc=example,dc=com"
+done
 
 # stop
 service ${SERVICE_NAME} stop
@@ -84,6 +95,11 @@ service ${SERVICE_NAME} stop
 # assert not running
 service ${SERVICE_NAME} status | grep "ApacheDS - default is not running"
 
+# assert password warning in log
+grep ".*WARN.*admin password.*security breach.*" /var/lib/${DIRNAME}/default/log/apacheds.log
+# assert no error in log
+! grep ".*ERROR.*" /var/lib/${DIRNAME}/default/log/apacheds.log
+
 # uninstall
 dpkg -P apacheds
 

Added: directory/apacheds/trunk/resources/docker/rpm.test
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/resources/docker/rpm.test?rev=1676003&view=auto
==============================================================================
--- directory/apacheds/trunk/resources/docker/rpm.test (added)
+++ directory/apacheds/trunk/resources/docker/rpm.test Sat Apr 25 09:37:05 2015
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+# 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. 
+
+# 
+# Script to test RPM installer within Docker container.
+#
+# Run with Java image (CentOS 7, OpenJDK 8)
+#
+#     cat rpm.test | docker run -i --rm -e URL="<URL to .deb>" -e VERSION="<ApacheDS version>" centos:7
+#
+# Please note to replace dashes '-' by underscores '_' in VERSION.
+#
+
+
+NAME="apacheds-${VERSION}"
+DIRNAME="${NAME}"
+SERVICE_NAME="${NAME}-default"
+
+wait_for_apacheds() {
+    timeout 15  sh -c "while ! nmap -Pn -p 10389 localhost | grep "10389.*open"; do sleep 1; done"
+}
+
+# stop execution if any command fails (i.e. exits with status code > 0)
+set -e
+
+# trace commands
+set -x
+
+# install packages
+yum -y -q update
+yum -y -q install wget java-1.8.0-openjdk openldap-clients nmap
+
+# download
+wget -q -O apacheds.rpm ${URL}
+
+# install
+rpm -Uvh apacheds.rpm
+
+# assert installed
+rpm -q apacheds | grep apacheds
+
+# assert files and directories exist
+test -f /opt/${DIRNAME}/LICENSE
+test -f /opt/${DIRNAME}/NOTICE
+test -d /var/lib/${DIRNAME}/default
+
+# assert not running
+/etc/init.d/${SERVICE_NAME} status | grep "ApacheDS - default is not running"
+
+# start
+/etc/init.d/${SERVICE_NAME} start 
+wait_for_apacheds
+
+# assert running
+/etc/init.d/${SERVICE_NAME} status | grep "ApacheDS - default is running"
+
+# search
+ldapsearch -h localhost -p 10389 -x -D "uid=admin,ou=system" -w secret -s base -b "dc=example,dc=com"
+
+# restart and search a few times
+for i in 1 2 3
+do
+    /etc/init.d/${SERVICE_NAME} restart 
+    wait_for_apacheds
+    ldapsearch -h localhost -p 10389 -x -D "uid=admin,ou=system" -w secret -s base -b "dc=example,dc=com"
+done
+
+# stop
+/etc/init.d/${SERVICE_NAME} stop
+
+# assert not running
+/etc/init.d/${SERVICE_NAME} status | grep "ApacheDS - default is not running"
+
+# assert password warning in log
+grep ".*WARN.*admin password.*security breach.*" /var/lib/${DIRNAME}/default/log/apacheds.log
+# assert no error in log
+! grep ".*ERROR.*" /var/lib/${DIRNAME}/default/log/apacheds.log
+
+# uninstall
+rpm -e apacheds
+
+# assert files and directory no more exist
+test ! -e /opt/${DIRNAME}
+ 
+# SUCCESS
+echo "SUCCESS"
+