Commit c6a899d9 by Bruno Bzeznik

Ready for CI !

parent 8e27811d
......@@ -11,8 +11,10 @@ There are 3 parts:
The result is a running nixos-container with a devel/test phyloalps application running inside.
Usage:
------
There's another container (phylotest) for running the tests (see bellow).
Installing and building the phylodb container:
----------------------------------------------
* Into the file `/etc/nixos/configuration.nix` of your NixOS host (as root), add the container configuration as an imported file:
```
......@@ -36,8 +38,13 @@ Usage:
```
cp phylodb-container.nix /etc/nixos/
```
* Rebuild your NixOS for the container creation:
```
nixos-rebuid switch
```
```
* Clone phylodb and phylodump (for example into `~/git/phylodb` and `~/git/phylodump`)
* Check that you don't have any local http server running on your host (or it will conflict with the phylodev one)
......@@ -61,3 +68,50 @@ Usage:
sudo nixos-container stop phylodb
sudo rm -rf /var/lib/containers/phylodb
```
Tests
-----
* Into the file `/etc/nixos/configuration.nix` of your NixOS host (as root), add an include of the file for the phylotest container:
```
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# Include containers configurations
./phylodb-container.nix
./phylotest-container.nix
];
* Copy the container configuration file (as root):
```
cp phylotest-container.nix /etc/nixos/
```
* Rebuild your NixOS for the container creation:
```
nixos-rebuid switch
```
* Start and finalize the tests container
```
sudo ./init-phylotest-container.sh
```
Running the tests
-----------------
The `run-tests.sh` script may be used to start the tests. It will create the phylodb and phylotest containers if they are not already running; so if your only goal is to run the tests, you can directly start this script after the installation of the containers into your system (ie copy `phylodb-container.nix` and `phylotest-container.nix` files into /etc/nixos and rebuild).
The tests are written in python, with the *webtest* module into the `store/phylo-webtests.py` file.
Example:
```
sudo ./run-tests.sh ~/git/phylodb ~/git/phylodump
```
And if you need to rebuild the phylodb container with changes you've made into your local copy, just stop the container and re-run the script:
```
sudo nixos-container stop phylodb
sudo ./run-tests.sh ~/git/phylodb ~/git/phylodump
```
#!/usr/bin/env bash
source_dir=$1
phylodump_dir=$2
if [ "$source_dir" = "" ]
then
echo "usage: $0 <phylodb_source_directory> [phylodump_directory]"
exit 1
fi
container=phylotest
run() {
nixos-container run $container -- $*
}
nixos-container status phylodb |grep up 2>&1 >/dev/null
if [ "$?" \!= "0" ]
then
echo
echo "*******************************************************"
echo "BUILDING PHYLODB CONTAINER..."
echo "*******************************************************"
echo
./init-phylodb-container.sh $source_dir $phylodump_dir
fi
nixos-container status phylotest |grep up 2>&1 >/dev/null
if [ "$?" \!= "0" ]
then
echo
echo "*******************************************************"
echo "BUILDING PHYLOTEST CONTAINER..."
echo "*******************************************************"
echo
./init-phylotest-container.sh
fi
echo
echo "*******************************************************"
echo "RUNNING TESTS..."
echo "*******************************************************"
echo
run_script=`nix-store --add store/run.sh`
run bash $run_script
RC=$?
if [ "$RC" \!= "0" ]
then
echo -e "\e[101mTESTS FAILED!!\e[0m"
exit $RC
else
echo -e "\e[1mTESTS OK\e[0m"
fi
#!/usr/bin/env bash
cd /var/lib/phylotest
source django-webtest/bin/activate
python phylo-webtests.py
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment