~dernils/duplicity/fixedTestSetup

« back to all changes in this revision

Viewing changes to testing/infrastructure/setup.sh

  • Committer: Kenneth Loafman
  • Date: 2017-05-15 19:31:29 UTC
  • mfrom: (1224.1.3 duplicity)
  • Revision ID: kenneth@loafman.com-20170515193129-ju0m4nzxar6v1470
* Merged in lp:~dernils/duplicity/Dockerfile
  - Now have subnet name and IP of the subnet for testing as a variable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
23
#
24
24
 
 
25
# Define the subnet and the name of the testnetwork that should be used for testing 
 
26
subnet=10.10.10.0/24
 
27
testnetwork=testnetwork
 
28
ip_ssh_server=10.10.10.4
 
29
ip_ftp_server=10.10.10.3
 
30
ip_duplicity_test=10.10.10.2
25
31
 
26
32
# Check whether a specific docker network for testing is already exisitng. If not, create it.
27
 
docker network inspect testnetwork &> /dev/null
 
33
docker network inspect $testnetwork &> /dev/null
28
34
 
29
35
if [ $? -ne 0 ]; then
30
36
    echo "docker testnetwork not found. Creating network."
31
 
    docker network create --subnet=10.10.10.0/24 testnetwork
 
37
    docker network create --subnet=$subnet $testnetwork
32
38
fi
33
39
 
34
 
 
35
40
# Remove all running instances of the test system and also remove the containers. This ensure
36
41
# that the test infrastructure is frehshly started.
37
 
docker rm -f $(docker stop $(docker ps -a -q --filter name=d70c0e18-37d5-11e7-a919-92ebcb67fe33-ftpd_server --format="{{.ID}}"))
38
 
docker rm -f $(docker stop $(docker ps -a -q --filter name=ee681ee4-37d5-11e7-a919-92ebcb67fe33-duplicity_ssh_server --format="{{.ID}}"))
39
 
docker rm -f $(docker stop $(docker ps -a -q --filter name=f3c09128-37d5-11e7-a919-92ebcb67fe33-duplicity_test --format="{{.ID}}"))
 
42
# We are using UUIDs as part of the names of the docker container to ensure that we do not accidentially touch other containers
 
43
docker rm -f $(docker stop $(docker ps  -a -q --filter name=d70c0e18-37d5-11e7-a919-92ebcb67fe33-ftpd_server --format="{{.ID}}"))
 
44
docker rm -f $(docker stop $(docker ps  -a -q --filter name=ee681ee4-37d5-11e7-a919-92ebcb67fe33-duplicity_ssh_server --format="{{.ID}}"))
 
45
docker rm -f $(docker stop $(docker ps  -a -q --filter name=f3c09128-37d5-11e7-a919-92ebcb67fe33-duplicity_test --format="{{.ID}}"))
40
46
 
41
47
 
42
48
# Start the containers. Docker run will automatically download the image if necessary
43
 
docker run -d --net testnetwork --ip 10.10.10.3 --name d70c0e18-37d5-11e7-a919-92ebcb67fe33-ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "PUBLICHOST=localhost" dernils/duplicity_testinfrastructure_ftp
44
 
docker run -d --net testnetwork --ip 10.10.10.4 --name ee681ee4-37d5-11e7-a919-92ebcb67fe33-duplicity_ssh_server  -p 22:22 -e "PUBLICHOST=localhost" dernils/duplicity_testinfrastructure_ssh:latest 
45
 
docker run --name f3c09128-37d5-11e7-a919-92ebcb67fe33-duplicity_test --net testnetwork --ip 10.10.10.2 -it  dernils/duplicitytest:latest
 
49
# Hand over the parameters for testing to the main docker container 
 
50
docker run -d --net $testnetwork --ip $ip_ftp_server --name d70c0e18-37d5-11e7-a919-92ebcb67fe33-ftpd_server -p 21:21 -p 30000-30009:30000-30009  dernils/duplicity_testinfrastructure_ftp
 
51
docker run -d --net $testnetwork --ip $ip_ssh_server --name ee681ee4-37d5-11e7-a919-92ebcb67fe33-duplicity_ssh_server  -p 22:22 dernils/duplicity_testinfrastructure_ssh:latest 
 
52
docker run --name f3c09128-37d5-11e7-a919-92ebcb67fe33-duplicity_test --net $testnetwork --ip $ip_duplicity_test -e DUPLICITY_TESTNETWORK=$testnetwork -e DUPLICITY_SUBNET=$subnet -e "PUBLICHOST=localhost" -e DUPLICITY_IP_SSH_SERVER=$ip_ssh_server -e DUPLICITY_IP_FTP_SERVER=$ip_ftp_server -it  dernils/duplicitytest:latest