Skip to content

Commit

Permalink
#769 Merged changes from v4.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
j3nsch committed Oct 23, 2023
2 parents 929af06 + 31e906a commit 864e364
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 50 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ jobs:

strategy:
matrix:
php-versions: ['7.1','8.1']
versions: [{php: '7.1', solr: '7.7.3'}, {php: '8.1', solr: '9.3.0'}]
fail-fast: false

name: PHP ${{ matrix.php-versions }} Test
name: PHP ${{ matrix.versions.php }} Test

steps:
- uses: actions/checkout@v3

- name: Setup PHP ${{ matrix.php-versions }}
- name: Setup PHP ${{ matrix.versions.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
php-version: ${{ matrix.versions.php }}

- name: Install Composer and Dependencies
run: sudo apt-get update && curl -s http://getcomposer.org/installer | php && php composer.phar self-update && php composer.phar install
Expand All @@ -38,8 +38,8 @@ jobs:
- name: Install additional Software
run: sudo apt-get install libxml2-utils

- name: Solr
run: sudo bash bin/install_solr_docker.sh
- name: Install Solr ${{ matrix.versions.solr }}
run: sudo bash tests/bin/install_solr_docker.sh --version ${{ matrix.versions.solr }}

- name: Start MySQL
run: sudo systemctl start mysql.service
Expand All @@ -54,7 +54,7 @@ jobs:
run: ant prepare-workspace prepare-test-workspace

- name: Setup config
run: ant prepare-config lint -DdbUserPassword=root -DdbAdminPassword=root -DphpVersion=${{ matrix.php-versions }}
run: ant prepare-config lint -DdbUserPassword=root -DdbAdminPassword=root -DphpVersion=${{ matrix.versions.php }}

- name: Setup testdata
run: ant reset-testdata
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ pipeline {

stage('Install Solr') {
steps {
sh 'sudo bash bin/install_solr_docker.sh'
sh 'sudo bash tests/bin/install_solr_docker.sh'
}
}

stage('Install MySQL') {
steps {
sh 'sudo bash bin/install_mysql_docker.sh'
sh 'sudo bash tests/bin/install_mysql_docker.sh'
}
}

Expand Down
17 changes: 11 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ $solr = <<SCRIPT
cd /home/vagrant
mkdir -p "downloads"
cd downloads
SOLR_TAR="solr-7.7.2.tgz"
SOLR_TAR="solr-$SOLR_VERSION.tgz"
if test ! -f "$SOLR_TAR"; then
wget "https://archive.apache.org/dist/lucene/solr/7.7.2/$SOLR_TAR"
SOLR_URL="https://archive.apache.org/dist/solr/solr/$SOLR_VERSION/$SOLR_TAR"
echo "Getting: $SOLR_URL"
wget -q --show-progress --progress=bar:force $SOLR_URL
fi
tar xfz "$SOLR_TAR" -C /home/vagrant
cd /home/vagrant/solr-7.7.2
cd /home/vagrant/solr-$SOLR_VERSION
mkdir -p server/solr/opus4/conf
echo name=opus4 > server/solr/opus4/core.properties
cd server/solr/opus4/conf/
Expand Down Expand Up @@ -122,6 +124,7 @@ fi
if ! grep "PATH=/vagrant/bin" /home/vagrant/.bashrc > /dev/null; then
echo "export PATH=/vagrant/bin:$PATH" >> /home/vagrant/.bashrc
fi
# Increase limits for Apache Solr
if ! grep "vagrant hard" /etc/security/limits.conf > /dev/null; then
echo "vagrant hard nofile 65535" >> /etc/security/limits.conf
echo "vagrant soft nofile 65535" >> /etc/security/limits.conf
Expand All @@ -132,7 +135,7 @@ SCRIPT

$start = <<SCRIPT
sudo service apache2 reload
cd /home/vagrant/solr-7.7.2
cd /home/vagrant/solr-$SOLR_VERSION
./bin/solr start
SCRIPT

Expand All @@ -152,17 +155,19 @@ Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
config.vm.network "forwarded_port", guest: 8983, host: 9983, host_ip: "127.0.0.1"

ENV['SOLR_VERSION']="9.3.0"

config.vm.provision "Install required software...", type: "shell", inline: $software
config.vm.provision "Install pandoc...", type: "shell", inline: $pandoc
config.vm.provision "Install fonts...", type: "shell", inline: $fonts
config.vm.provision "Install Composer dependencies...", type: "shell", privileged: false, inline: $composer
config.vm.provision "Install Apache Solr...", type: "shell", privileged: false, inline: $solr
config.vm.provision "Install Apache Solr...", type: "shell", privileged: false, inline: $solr, env: {"SOLR_VERSION" => ENV['SOLR_VERSION']}
config.vm.provision "Create database...", type: "shell", inline: $database
config.vm.provision "Configure OPUS 4...", type: "shell", privileged: false, inline: $opus
config.vm.provision "Setup site in Apache2...", type: "shell", inline: $apache
config.vm.provision "Fix permissions...", type: "shell", inline: $fix
config.vm.provision "Setup environment...", type: "shell", inline: $environment
config.vm.provision "Start services...", type: "shell", privileged: false, run: "always", inline: $start
config.vm.provision "Start services...", type: "shell", privileged: false, run: "always", inline: $start, env: {"SOLR_VERSION" => ENV['SOLR_VERSION']}
config.vm.provision "Initialize test data...", type: "shell", privileged: false, inline: $testdata
config.vm.provision "Information", type: "shell", privileged: false, run: "always", inline: $help
end
13 changes: 0 additions & 13 deletions bin/install_solr_docker.sh

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"jpgraph/jpgraph": "dev-master",
"opus4-repo/opus4-common": "dev-master as 4.8.1",
"opus4-repo/framework": "dev-master as 4.8.1",
"opus4-repo/search": ">4.7.2",
"opus4-repo/search": "4.7.3.x-dev || 4.8.1.x-dev",
"opus4-repo/opus4-bibtex": "^4.8",
"opus4-repo/opus4-import": "^4.8",
"opus4-repo/opus4-pdf": "^4.8",
Expand Down
File renamed without changes.
54 changes: 54 additions & 0 deletions tests/bin/install_solr_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

#
# Script to install Solr. By default, version 9.3.0 will be installed.
# Another Solr version can be specified using the `--version` option.

script_name="$(basename "$0")"

# Define variables and their default values
version="9.3.0"

# Parse command line options
while [ $# -gt 0 ]; do
if [[ $1 == "--"* ]]; then # only deal with long options
if [[ -n "$2" && $2 != "-"* ]]; then # ignore options without a value
# Create variable name from option name
v="${1/--/}" # uses parameter expansion removing '--'

# Read option value into variable
declare "$v"="$2"

# Process next option
shift
fi
fi
shift
done

# Download Solr version
if [[ "$version" =~ ^[1-8]\.[0-9]+\.[0-9]+$ ]]; then
SOLR_VERSION="$version"
ant download-solr -DsolrVersion=$SOLR_VERSION -DdownloadDir=./downloads
elif [[ "$version" =~ ^(9|[1-9][0-9]+)\.[0-9]+\.[0-9]+$ ]]; then # new archive URL for versions >9.0.0
SOLR_VERSION="$version"
SOLR_URL="https://archive.apache.org/dist/solr/solr/$SOLR_VERSION/solr-$SOLR_VERSION.tgz"
echo "Getting: $SOLR_URL"
wget -q $SOLR_URL -O - | tar -xz
else
echo "Unrecognized version number"
echo -e "The --version option requires a 3-digit version number, e.g.: 9.3.0"
exit 1
fi

# Configure & start Solr
cd solr-$SOLR_VERSION
./bin/solr start -force
./bin/solr create -c opus4 -force
cd server/solr/opus4/conf/
rm -f managed-schema schema.xml solrconfig.xml
ln -s ../../../../../vendor/opus4-repo/search/conf/schema.xml schema.xml
ln -s ../../../../../vendor/opus4-repo/search/conf/solrconfig.xml solrconfig.xml
cd ../../../../
./bin/solr restart -force
cd ..
15 changes: 7 additions & 8 deletions tests/library/Application/Console/Task/InfoCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,22 @@ class Application_Console_Task_InfoCommandTest extends ControllerTestCase
public function setUp(): void
{
parent::setUp();
$this->makeConfigurationModifiable();

if (! class_exists(TaskManager::class)) {
$this->markTestSkipped('TaskManager class not installed - Skipping tests');
}

$this->adjustConfiguration(
[
'cron' => [
'configFile' => 'tests/resources/task/commandtest-task-info.ini',
'configFile' => APPLICATION_PATH . '/tests/resources/task/commandtest-task-info.ini',
],
]
);
}

public function testTaskInfoOutput()
{
if (! class_exists(TaskManager::class)) {
$this->markTestSkipped('No tests to be done due to lack of crunz support.');
}

$app = new Application();

$command = new Application_Console_Task_InfoCommand();
Expand Down Expand Up @@ -85,8 +84,8 @@ public function testTaskInfoOutput()
$this->assertEquals($expected, $displayed);
}

public function testMoreTestsMayNeeded()
public function testUnknownTaskName()
{
$this->markTestIncomplete('We may need more tests for the info command.');
$this->markTestIncomplete('not tested yet');
}
}
16 changes: 5 additions & 11 deletions tests/library/Application/Console/Task/ListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,22 @@ class Application_Console_Task_ListCommandTest extends ControllerTestCase
public function setUp(): void
{
parent::setUp();
$this->makeConfigurationModifiable();

if (! class_exists(TaskManager::class)) {
$this->markTestSkipped('TaskManager class not present');
}

$this->adjustConfiguration(
[
'cron' => [
'configFile' => 'tests/resources/task/commandtest-tasks.ini',
'configFile' => APPLICATION_PATH . '/tests/resources/task/commandtest-tasks.ini',
],
]
);
}

public function testListTaskOutput()
{
if (! class_exists(TaskManager::class)) {
$this->markTestSkipped('No tests to be done due to lack of crunz support.');
}

$app = new Application();

$command = new Application_Console_Task_ListCommand();
Expand All @@ -80,9 +79,4 @@ public function testListTaskOutput()

$this->assertEquals($expected, $displayed);
}

public function testMoreTestsMayNeeded()
{
$this->markTestIncomplete('We may need more tests for the list command.');
}
}
4 changes: 2 additions & 2 deletions tests/library/Application/Console/Task/RunCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

class Application_Console_Task_RunCommandTest extends ControllerTestCase
{
public function testMoreTestsMayNeeded()
public function testMoreTests()
{
$this->markTestIncomplete('We may need more tests for the run command.');
$this->markTestIncomplete('TODO unit testing');
}
}

0 comments on commit 864e364

Please sign in to comment.