Files
MaxScale/system-test/Documentation/LOCAL_DEPLOYMENT.md
Esa Korhonen 08f5174915 MXS-2900 Rename maxscale-system-test directory to system-test
A link with the old directory name is provided.
2020-07-28 15:24:27 +03:00

3.9 KiB

Local deployment

Prepare MDBCI environment

Libvirt, Docker and Vagrant, with a set of plugins, are needed for MDBCI.

Please follow the instructions here.

Creating VMs for local tests

test/create_local_config.sh script creates a set of virtual machines (1 maxscale VM, 4 Master/Slave and 4 Galera).

Direct execution of create_local_config.sh requires manuall paramters setting. It is easiler to ese create_local_config_libvirt.sh and create_local_config_docker.sh

Script usage:

. ~/build-scripts/test/create_local_config.sh <target> <name>

where

target - Maxscale binary repository name

name - name of virtual machines set

Note: '.' before command allows script to load all environmental variables (needed for 'maxscale-system-test').

All other parameters have to be defined as environmental variables before executing the script.

Examples of parameters definition can be found in the following scripts:

test/create_local_config_libvirt.sh

test/create_local_config_docker.sh

. ~/build-scripts/test/create_local_config_libvirt.sh <target> <name>
. ~/build-scripts/test/create_local_config_docker.sh <target> <name>

Execute test

Clone and compile https://github.com/mariadb-corporation/MaxScale

Build tests:

cd Maxscale/maxscale-system-test
cmake .
make

if environmental variables are not set:

. ~/build-scripts/test/set_env_vagrant.sh <name>

Execute single test by starting test binary or use ctest to run all or selected tests (see https://cmake.org/cmake/help/v3.8/manual/ctest.1.html)

To see test output:

ctest -VV

Destroying VMs

cd ~/mdbci/scripts
./clean_vms.sh <name>

Reverting default snapshot

create_local_config.sh script takes one snapshot of recently created set of VMs. Snapshot name is 'clean'

If VMs are damaged during testing process it is easy to restore them:

~/mdbci/mdbci snapshot  revert --path-to-nodes <name> --snapshot-name clean

If needed, more snapshots can be created:

cd ~/mdbci
./mdbci snapshot  take --path-to-nodes <name> --snapshot-name <snapshot_name>

Accessing VMs

cd ~/mdbci/<name>
vagrant ssh <vm_name>

where <vm_name> can be 'maxscale', 'node_XXX' or 'galera_XXX'.

. ~/build-scripts/test/set_env_vagrant.sh <name>
ssh -i $<vm_name>_keyfile $<vm_name>_whoami@$<vm_name>_network

examples:

ssh -i $node_002_keyfile $node_002_whoami@$node_002_network

ssh -i $maxscale_keyfile $maxscale_whoami@$maxscale_network

Own VM configuration template

By default scripts use ~/build-scripts/test/template.libvirt.json and ~/build-scripts/test/template.docker.json

These templates can be used as examples to create your own templates.

To use own template:

put your template file to ~/build-scripts/test/templates/

and define 'template_name' variable

export template_name=<your_template_filename>
. ~/build-scripts/test/create_local_config_libvirt.sh <target> <name>

Troubleshooting

More info about libvirt and vagrant-libvirt plugin

https://help.ubuntu.com/lts/serverguide/libvirt.html

https://github.com/vagrant-libvirt/vagrant-libvirt#installation

Random VM creation failures

Plese check the amount of free memory and amount of running VMs

virsh list
docker ps

and remove all VMs and containers you do not need

Wrong time on host server

If server time is wrong it can cause random problems. Please do time sync: use ntp or

sudo date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')" 

Info from OSLL wiki

Libvirt DNS resolving problem quick fix

https://dev.osll.ru/projects/mdbci/wiki/Libvirt_DNS_resolving_problem_quick_fix