Recipe "How to turn an idea into a certified SMW extension"

From SMW CindyKate by dataspects
Component 947747
Jump to navigation Jump to search
[edit]
Keywords/Contexts

Extensions · Testing · Vagrant

Annotations
{{#compound_query:Component 947747Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.UseCaseMotivation;?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.Recipe "How to turn an idea into a certified SMW extension";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.Recipe "How to turn an idea into a certified SMW extension";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
name=MotivationsDeclaredOnThisPageResultItem|link=none}}
Motivations
Lua error in Module:Motivations at line 23: attempt to concatenate field 'hasReasoning' (a nil value).
[edit]

Content


Notice:

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

<mermaid2> graph TD

rmwsd("Repository #quot;MediaWiki Core Cucumber Step Definitions#quot;<hr> <a href='https://github.com/LinuxCompetenceCenter/MediaWiki-Core-Cucumber-Step-Definitions'>GitHub repository</a> ") --> |"is a submodule to"|mwvf

ynb --> |hosts directory|mwvf>"Directory #quot;~/mediawiki-vagrant/#quot;<hr> git clone https://github.com/LinuxCompetenceCenter/mediawiki-vagrant.git<br> <a href='https://github.com/LinuxCompetenceCenter/mediawiki-vagrant/blob/master/Vagrantfile'>Vagrantfile</a><br> <a href='https://github.com/LinuxCompetenceCenter/mediawiki-vagrant/blob/master/mw-profiles.yml'>mw-profiles.yml</a> "]

mwvf -->|"is shared into /vagrant<br>launches VM by #quot;vagrant up#quot;<br>ssh's into VM by #quot;vagrant ssh#quot;"|mwvvm

aom("Host #quot;Any Other Host#quot;;<hr> serves MediaWiki at port X")

ynb("Physical Machine #quot;Your Workstation#quot;<hr>has IP 192.168.37.12") --> |"hosts VBox VM<br> browses it at localhost:8080<br> serves it at 192.168.37.12:8080"|mwvvm["VBox VM #quot;MediaWiki Vagrant#quot;"] </mermaid2>

Set up VBox VM "MediaWiki Vagrant" on your Ubuntu workstation

Install Git

user@workstation:~$ sudo apt-get install git

Install Virtualbox

https://www.virtualbox.org/wiki/Downloads

Install Vagrant

The following commands install Vagrant 1.8.1 on Ubuntu (note that these commands are conditionally included in deploy_mediawiki-vagrant.sh below):

user@workstation:~/tmp$ wget https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.deb
user@workstation:~/tmp$ sudo dpkg -i vagrant_1.8.1_x86_64.deb

Use Case "Install VBox VM "MediaWiki Vagrant""

user@workstation:~$ ./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
Notice:

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:
    1. user@workstation:~/mediawiki-vagrant$ vagrant destroy
    2. user@workstation:~$ mv .vagrant.d .vagrant.d_BACKUP
    3. user@workstation:~/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:
    1. user@workstation:~/mediawiki-vagrant/mediawiki$ git pull origin master
    2. user@workstation:~/mediawiki-vagrant$ vagrant provision

How to access VBox VM "MediaWiki Vagrant"

Log into the VM (SSH or "shell access")

user@workstation:~/mediawiki-vagrant$ vagrant ssh

Mediawiki vagrant vagrant ssh.png

Browse devwiki from your workstation (host)

http://localhost:8080/wiki/Main_Page

Mediawiki vagrant main page.png

Log into the VM's XFCE desktop

  1. Upon a fresh set up only, run user@workstation:~/mediawiki-vagrant$ vagrant halt && vagrant up.
  2. Doubleclick the running machine in the Oracle VM VirtualBox Manager.
  3. Log in with username vagrant and password vagrant.
  4. For the time being DO NOT UPGRADE FIREFOX! due to https://github.com/SeleniumHQ/selenium/issues/2257.

The desktop environment used is Xfce.

Mediawiki vagrant xfce desktop.png

STEP 2: Add your extension, e.g. SMWCindyKate

Notice:

These instructions are under construction.

user@workstation:
  ~/SMWCindyKate/
    tests/
      phpunit/
        SomeTest.php     # How do these files have to look like?
        SomeMoreTest.php

STEP 3: Run tests

vagrant@mediawiki-vagrant:~$ export MEDIAWIKI_URL=http://127.0.0.1:8080/wiki/

Run unit tests

user@workstation:~/mediawiki-vagrant$ vagrant ssh

Run MediaWiki core unit tests

vagrant@mediawiki-vagrant:~$ ./run-all-mw-core-unit-tests.sh

Run Semantic MediaWiki core unit tests

vagrant@mediawiki-vagrant:~$ ./run-all-SMW-core-unit-tests.sh

Run your extension unit tests, e.g. SMWCindyKate

Notice:

These instructions are under construction.

Run browser tests

user@workstation:~/mediawiki-vagrant$ vagrant ssh

Run MediaWiki core browser tests

vagrant@mediawiki-vagrant:~$ ./run-all-core-acceptance-tests.sh

Run extension browser tests, e.g. SMWCindyKate

Notice:

These instructions are under construction.