Recipe "How to turn an idea into a certified SMW extension"
Contents
|
[edit]
|
Content
The following instructions have been tested on Ubuntu 16.04 64bit.
Instructions for other platforms are under construction.
Goal
The goal is to minimize the effort of turning your great new idea for SMW functionality into a certified extension.
STEP 1: Set up local test environment
For your understanding: local test environment ontology
Set up VBox VM "MediaWiki Vagrant" on your Ubuntu workstation
Install Git
[email protected]:~$ sudo apt-get install git
Install Virtualbox
https://www.virtualbox.org/wiki/Downloads
Install Vagrant
- IMPORTANT: Vagrant's version must match https://github.com/LinuxCompetenceCenter/mediawiki-vagrant/blob/master/Gemfile.lock.
- Here's the list of Vagrant release downloads.
The following commands install Vagrant 1.8.1 on Ubuntu (note that these commands are conditionally included in deploy_mediawiki-vagrant.sh
below):
[email protected]:~/tmp$ wget https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.deb [email protected]:~/tmp$ sudo dpkg -i vagrant_1.8.1_x86_64.deb
Use Case "Install VBox VM "MediaWiki Vagrant""
[email protected]:~$ ./deploy_mediawiki-vagrant.sh
#!/bin/bash
# This the content of deploy_mediawiki-vagrant.sh
# Ensure that Vagrant's apt version is installed
if [[ "$(vagrant --version)" == "Vagrant 1.8.1"* ]]; then
echo "Vagrant 1.8.1 is installed"
else
wget https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.deb
sudo dpkg -i vagrant_1.8.1_x86_64.deb
fi
# Create the core mediawiki-vagrant VM
git clone https://github.com/LinuxCompetenceCenter/mediawiki-vagrant.git
cd mediawiki-vagrant
git submodule update --init --recursive
./setup.sh
vagrant hiera mediawiki::branch REL1_26
vagrant config nfs_shares off # Note: This is only necessary if you have an encrypted home directory. See https://help.ubuntu.com/community/EncryptedHome
time vagrant up
# Add functionality by enabling roles
vagrant roles enable semanticmediawiki
vagrant roles enable semantictitle
vagrant provision --provision-with puppet
At the end of this process your VBox VM "MediaWiki Vagrant" is ready for the next steps. If you want to log into the VM's XFCE desktop, see below Log into the VM's XFCE desktop.
Troubleshooting
The following observations and seemingly working solutions are based on my own experiences.
- If you get a Failed to execute command `vagrant plugin list` (pid 30351 exit 1), then try this:
-
[email protected]:~/mediawiki-vagrant$ vagrant destroy
-
[email protected]:~$ mv .vagrant.d .vagrant.d_BACKUP
-
[email protected]:~/mediawiki-vagrant$ time vagrant up
-
- If you get a port forwarding collision, then either:
- reconfigure port forwarding in the Vagrantfile to some unused host port, or
- close any other VM using forwarding to host port 8080, or
- remove VBox VM "MediaWiki Vagrant" and close and then reopen Virtualbox.
- If
vagrant up
- fails saying The SSH command responded with a non-zero exit status. or
- hangs at
/Stage[main]/Mediawiki/Git::Clone[mediawiki/core]/File[/vagrant/mediawiki]/ensure: created
, then try this:
-
[email protected]:~/mediawiki-vagrant/mediawiki$ git pull origin master
-
[email protected]:~/mediawiki-vagrant$ vagrant provision
How to access VBox VM "MediaWiki Vagrant"
Log into the VM (SSH or "shell access")
[email protected]:~/mediawiki-vagrant$ vagrant ssh
Browse devwiki from your workstation (host)
http://localhost:8080/wiki/Main_Page
Log into the VM's XFCE desktop
- Upon a fresh set up only, run
[email protected]:~/mediawiki-vagrant$ vagrant halt && vagrant up
. - Doubleclick the running machine in the Oracle VM VirtualBox Manager.
- Log in with username
vagrant
and passwordvagrant
. - For the time being DO NOT UPGRADE FIREFOX! due to https://github.com/SeleniumHQ/selenium/issues/2257.
The desktop environment used is Xfce.
STEP 2: Add your extension, e.g. SMWCindyKate
These instructions are under construction.
[email protected]: ~/SMWCindyKate/ tests/ phpunit/ SomeTest.php # How do these files have to look like? SomeMoreTest.php
STEP 3: Run tests
- These instructions are based on Setup_instructions#Environment_variables.
- See all predesigned test runs.
[email protected]:~$ export MEDIAWIKI_URL=http://127.0.0.1:8080/wiki/
Run unit tests
- These instructions are based on MediaWiki-Vagrant#Running_and_debugging_unit_tests.
- See MediaWiki core unit tests
- See PHPUnit command line options
[email protected]:~/mediawiki-vagrant$ vagrant ssh
Run MediaWiki core unit tests
[email protected]:~$ ./run-all-mw-core-unit-tests.sh
Run Semantic MediaWiki core unit tests
[email protected]:~$ ./run-all-SMW-core-unit-tests.sh
Run your extension unit tests, e.g. SMWCindyKate
These instructions are under construction.
Run browser tests
- Also known as acceptance, integration or Cucumber tests.
- These instructions are based on Quality_Assurance/Browser_testing.
- See MediaWiki core browser tests
- UseCase "Ensure that the correct combination of versions of Firefox and of selenium-webdriver is installed" Use Case
[email protected]:~/mediawiki-vagrant$ vagrant ssh
Run MediaWiki core browser tests
[email protected]:~$ ./run-all-core-acceptance-tests.sh
Run extension browser tests, e.g. SMWCindyKate
These instructions are under construction.