Meza/Emulate the Travis CI test setup

From mediawiki.org
Jump to navigation Jump to search

Initial setup[edit]

Do initial setup of a Meza Vagrant box:

  1. Get VirtualBox, Vagrant, and Git
  2. Git-clone Meza and cd into the Meza directory
  3. vagrant up
  4. So it's easy to revert, take a snapshot called "vagrantup": vagrant snapshot save vagrantup
  5. vagrant ssh
  6. sudo meza setup docker

Running tests[edit]

To run the same tests as are run on Travis CI for each Meza commit, do the following:

TEST_TYPE="insert test type from below"
sudo /opt/meza/tests/docker/run-tests.sh "$TEST_TYPE"

Replace insert test type from below with one of the test types below:

  1. monolith-from-scratch: Installs meza on a single server
  2. monolith-from-import: Installs meza on a single server from backup files
  3. import-from-remote: Installs meza on a single server, pulling data from a remote meza server
  4. backup-to-remote: Runs backup to a remote server
  5. import-from-alt-remote: Installs meza on a single server, pulling data from a non-standard setup

SSH into the Docker container[edit]

To SSH into the Docker container (which may be frowned upon by the Docker community):

  1. Figure out the container ID using sudo docker ps
  2. For convenience, set container_id=<whatever your container id is>
  3. Set the root password for the container to 1234 (this is just for dev purposes): sudo docker exec "$container_id" bash -c "echo root:1234 | chpasswd"
  4. Figure out your containers IP address: sudo docker inspect -f 'Template:Range .NetworkSettings.NetworksTemplate:.IPAddressTemplate:End' $container_id
  5. Login: ssh root@IP_ADDRESS_FROM_PREVIOUS_STEP.

After figuring out what your container ID is (via sudo docker ps), do the rest in one copy-paste:

container_id=ctrl
sudo docker exec "$container_id" bash -c "echo root:1234 | chpasswd"
ip_addr=$(sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container_id)
echo $ip_addr
ssh root@$ip_addr

Running a new test[edit]

Unfortunately at this point the best way to start a new test is to exit your Vagrant machine (just type exit) then restore the snapshot you created with vagrant snapshot restore vagrantup and rerun the steps.