IRC-SPHERE / HyperStream

HyperStream
https://irc-sphere.github.io/HyperStream/
MIT License
13 stars 5 forks source link

Add runtest script with all the dependencies #4

Open perellonieto opened 7 years ago

perellonieto commented 7 years ago

Should we create a script with a contained runtest maybe using Docker containers? Something like this runtest.sh

#!/bin/bash

echo "Activating virtual environment"
. ./venv/bin/activate

echo "Starting MongoDB server"
sudo service mongodb start
#
#MONGODB_CONTAINER=`docker run --name hs_mongodb -p 27017:27017 -d library/mongo`
## Wait for the MONGODB port to be available
#until nc -z $(docker inspect --format='{{.NetworkSettings.IPAddress}}' $MONGODB_CONTAINER) 27017
#do
#    echo "waiting for docker MongoDB container..."
#    sleep 0.5
#done

echo "Starting docker MQTT container"
MQTT_CONTAINER=`docker run --name hs_mqtt -d -ti -p 1883:1883 -p 9001:9001 toke/mosquitto`
# Wait for the MQTT port to be available
until nc -z $(docker inspect --format='{{.NetworkSettings.IPAddress}}' $MQTT_CONTAINER) 9001
do
    echo "waiting for docker MQTT container..."
    sleep 0.5
done
nosetests --with-coverage

echo "Stopping docker MQTT container"
docker stop hs_mqtt
echo "Removing docker MQTT container"
docker rm hs_mqtt
echo "Stopping MongoDB server"
sudo service mongodb stop

I had to comment the MongoDB container and run my own version of MongoDB because I don't have enough space in my root.

tdiethe commented 7 years ago

Looks like a good idea - although do the new dockerfiles mean this is no longer needed?

perellonieto commented 7 years ago

You are right about the new docker bundle. I tried it and at this moment it runs the test. However, in my understanding, it pulls the master branch and runs the test of the last version in GitHub. I finished one version of the script that runs it locally in the pull request #6 . The script needs to be improved as there are some problems if the script does not finish properly.

tdiethe commented 7 years ago

Ok sounds good

tdiethe commented 7 years ago

Can this one be closed?

perellonieto commented 7 years ago

The commit 6271d2d73e6edefe6fae166d09f9af2a11797b88 solves partially this issue. However, it could be improved. At this moment it assumes the following

Do you think this is enough, or should we extend this script for cases where only MongoDB server is running or other possible permutations?