add contents

This commit is contained in:
Trevor Batley
2025-10-09 15:04:29 +11:00
parent 170362eec1
commit bce7dd054a
2537 changed files with 301282 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
FROM debian:$DOCKER_DEBIAN_TAG
RUN apt-get update && apt-get install -y apache2 libapache2-mod-php5
RUN apt-get install -y wget
COPY nspages.tgz installTestEnvironment.sh testEnvironment dw_dl_cache source.sh /home/
RUN cd /home \
&& mkdir nspages \
&& cd nspages \
&& mv ../nspages.tgz . \
&& tar xf nspages.tgz \
&& rm nspages.tgz \
&& mkdir _tests \
&& cd _tests \
&& mv /home/installTestEnvironment.sh .\
&& mv /home/source.sh .\
&& mkdir testEnvironment \
&& mv /home/data testEnvironment \
&& mkdir dw_dl_cache \
&& mv /home/dokuwiki-*.tgz dw_dl_cache \
&& chmod u+x installTestEnvironment.sh \
&& /etc/init.d/apache2 start \
&& SERVER_FS_ROOT=$SERVER_FS_ROOT ./installTestEnvironment.sh
CMD /etc/init.d/apache2 start && tail -F /var/log/apache2/access.log

View File

@@ -0,0 +1,30 @@
#!/bin/bash -e
./internal/dl_dw.sh
function createImage {
set -e
export DOCKER_DEBIAN_TAG=$(echo $1 | cut -d ' ' -f 1)
export SERVER_FS_ROOT=$(echo $1 | cut -d ' ' -f 2)
cat internal/Dockerfile.template | envsubst > docker/Dockerfile
pushd docker >/dev/null
docker build -t nspages-test-$DOCKER_DEBIAN_TAG .
popd >/dev/null
}
export -f createImage
pushd .. >/dev/null
STASH_NAME=$(git stash create)
git archive -o nspages.tgz ${STASH_NAME:-HEAD}
mkdir _tests/docker 2>/dev/null || true
mv nspages.tgz _tests/docker
popd >/dev/null
cp -r internal/installTestEnvironment.sh testEnvironment source.sh docker
mkdir docker/dw_dl_cache 2>/dev/null || true
cp dw_dl_cache/dokuwiki-*.tgz docker/dw_dl_cache
. source.sh
echo Going to build the docker images. Parallel arg: $PARALLEL_JOB_ARG
parallel $PARALLEL_JOB_ARG -a dockerFiles.dat createImage;

View File

@@ -0,0 +1,17 @@
#!/bin/bash
. source.sh
mkdir -p $DW_DL_CACHE
cd $DW_DL_CACHE
echo "Going to download $DW_VERSION"
#Avoid downloading the tarball again if we already have it
if [ ! -e $DW_VERSION.tgz ]; then
echo " Starting to download $DW_VERSION.tgz"
wget http://download.dokuwiki.org/src/dokuwiki/$DW_VERSION.tgz
chmod a+r $DW_VERSION.tgz
else
echo " $DW_VERSION.tgz found. No need to download it again."
fi

View File

@@ -0,0 +1,21 @@
#!/bin/bash -e
if [ -L "$0" ] && [ -x $(which readlink) ]; then
thisFile="$(readlink -mn "$0")"
else
thisFile="$0"
fi
thisDir="$(dirname "$thisFile")"
RESOURCE_DIR=$thisDir/../src/test/resources
if [ ! -e $RESOURCE_DIR/geckodriver ]; then
echo Downloading geckodriver
VERSION=v0.29.1
ARCHIVE=geckodriver-$VERSION-linux64.tar.gz
rm -f $ARCHIVE
wget https://github.com/mozilla/geckodriver/releases/download/$VERSION/$ARCHIVE
tar xf $ARCHIVE
mkdir -p $RESOURCE_DIR
mv geckodriver $RESOURCE_DIR
rm $ARCHIVE
else
echo Geckodriver already present
fi

View File

@@ -0,0 +1,59 @@
#!/bin/bash -e
#directory where Dokuwiki should be installed in order to be reachable at http://localhost
SERVER_FS_ROOT=${SERVER_FS_ROOT:-/var/www/html}
echo Using server fs root at: $SERVER_FS_ROOT
#Owner of the files (to make sure the instance of dokuwiki can edit its pages)
serverFileSystemOwner=www-data
#Shouldn't be changed since itests try to connect to this url
baseUrl=http://localhost
dirNamePrefix=dokuwikiITestsForNsPages
. source.sh
relativeTestFileDir=testEnvironment
pushd $DW_DL_CACHE >/dev/null
echo "Going to install $DW_VERSION"
tar -xzf $DW_VERSION.tgz
echo " Copying files to the server"
dirName=${dirNamePrefix}${DW_VERSION}
destDir=$SERVER_FS_ROOT/$dirName
rm -rf $destDir
cp -r $DW_VERSION $destDir
echo " Configuring the wiki"
cp -r ../$relativeTestFileDir/data/* $destDir/data
echo " Installing the plugin"
pluginDir=$destDir/lib/plugins/nspages
mkdir $pluginDir
for item in $(find ../.. -maxdepth 1 -mindepth 1 | grep -v _test | grep -v .git); do
cp -r $item $pluginDir
done
echo " Reseting some mtimes"
touch -t201504010020.00 $destDir/data/pages/ns1/a.txt
touch -t201504011020.00 $destDir/data/pages/ns1/b2.txt
touch -t201504012020.00 $destDir/data/pages/ns1/c.txt
touch -t201504012320.00 $destDir/data/pages/ns1/b1.txt
touch -t201504022220.00 $destDir/data/pages/simpleline/p1.txt
touch -t201504032220.00 $destDir/data/pages/simpleline/p2.txt
chown -R $serverFileSystemOwner $destDir
echo " Running the indexer"
cd ../testEnvironment/data/pages
for f in $(find . -name "*txt"); do
f=$(echo $f | cut -d '.' -f 2 | tr / :)
wget -O /dev/null -q $baseUrl/$dirName/lib/exe/taskrunner.php?id=$f
done
echo " Installed $DW_VERSION"
popd >/dev/null
echo Done.