Merge lp:~dernils/duplicity/DockerfileConvenience into lp:~duplicity-team/duplicity/0.8-series

Proposed by nils
Status: Merged
Merged at revision: 1216
Proposed branch: lp:~dernils/duplicity/DockerfileConvenience
Merge into: lp:~duplicity-team/duplicity/0.8-series
Diff against target: 164 lines (+141/-0)
4 files modified
testing/testinfrastructure/check_docker_container.sh (+64/-0)
testing/testinfrastructure/ftp_server/Dockerfile (+32/-0)
testing/testinfrastructure/ftp_server/pureftpd.passwd (+1/-0)
testing/testinfrastructure/setup.sh (+44/-0)
To merge this branch: bzr merge lp:~dernils/duplicity/DockerfileConvenience
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+323713@code.launchpad.net
To post a comment you must log in.
Revision history for this message
nils (dernils) wrote :

The latest commit added a few files that are the beginning of further infrastructure based on docker. It contains a Dockerfile for a simple ftp server (used for backend testing) and a setup script that can be used to set up the complete test environment.

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

It's merged. I also moved Dockerfile to testinfrastructure/duplicity_test
and added a build.sh. We should keep it all in testing.

On Sat, May 6, 2017 at 2:17 PM, <email address hidden> wrote:

> The proposal to merge lp:~dernils/duplicity/DockerfileConvenience into
> lp:duplicity has been updated.
>
> Status: Needs review => Merged
>
> For more details, see:
> https://code.launchpad.net/~dernils/duplicity/
> DockerfileConvenience/+merge/323713
> --
> Your team duplicity-team is requested to review the proposed merge of
> lp:~dernils/duplicity/DockerfileConvenience into lp:duplicity.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~duplicity-team
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~duplicity-team
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
nils (dernils) wrote :

Great, Thanks!

If you find a minute, I would appreciate if you could throw an eye
on lp:~dernils/duplicity/robust-dropbox-backend, specifically the one test
that I created under testing/backend-testing. What I’m trying to do here
is that I build the tests for the backends in an empty folder by re-using
elements from the other tests. This allows me to keep focussed but (more
important) to completely oversee the codebase and learn from scratch.

Unfortunately, the very simple test case that I created for a ftp backend
stucks in execution. I’m currently only trying to take a very simple test
and use the ftp server that I set up using docker as a backend. I debugged
it so far that the duplicity command seems to get called by the
run_duplicity function but there is no output from the execution of the
function at all.

The tests in the other folders still execute fine.

Nils

Kenneth Loafman <email address hidden> schrieb am Sa., 6. Mai 2017 um
21:54 Uhr:

> It's merged. I also moved Dockerfile to testinfrastructure/duplicity_test
> and added a build.sh. We should keep it all in testing.
>
>
> On Sat, May 6, 2017 at 2:17 PM, <email address hidden> wrote:
>
> > The proposal to merge lp:~dernils/duplicity/DockerfileConvenience into
> > lp:duplicity has been updated.
> >
> > Status: Needs review => Merged
> >
> > For more details, see:
> > https://code.launchpad.net/~dernils/duplicity/
> > DockerfileConvenience/+merge/323713
> > --
> > Your team duplicity-team is requested to review the proposed merge of
> > lp:~dernils/duplicity/DockerfileConvenience into lp:duplicity.
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~duplicity-team
> > Post to : <email address hidden>
> > Unsubscribe : https://launchpad.net/~duplicity-team
> > More help : https://help.launchpad.net/ListHelp
> >
>
> --
>
> https://code.launchpad.net/~dernils/duplicity/DockerfileConvenience/+merge/323713
> You are the owner of lp:~dernils/duplicity/DockerfileConvenience.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'testing/testinfrastructure'
2=== added file 'testing/testinfrastructure/check_docker_container.sh'
3--- testing/testinfrastructure/check_docker_container.sh 1970-01-01 00:00:00 +0000
4+++ testing/testinfrastructure/check_docker_container.sh 2017-05-06 16:14:31 +0000
5@@ -0,0 +1,64 @@
6+#!/bin/bash
7+
8+# Author: Erik Kristensen
9+# Email: erik@erikkristensen.com
10+# License: MIT
11+# Nagios Usage: check_nrpe!check_docker_container!_container_id_
12+# Usage: ./check_docker_container.sh _container_id_
13+#
14+# Depending on your docker configuration, root might be required. If your nrpe user has rights
15+# to talk to the docker daemon, then root is not required. This is why root privileges are not
16+# checked.
17+#
18+# The script checks if a container is running.
19+# OK - running
20+# WARNING - restarting
21+# CRITICAL - stopped
22+# UNKNOWN - does not exist
23+#
24+# CHANGELOG - March 20, 2017
25+# - Removes Ghost State Check, Checks for Restarting State, Properly finds the Networking IP addresses
26+# - Returns unknown (exit code 3) if docker binary is missing, unable to talk to the daemon, or if container id is missing
27+
28+CONTAINER=$1
29+
30+if [ "x${CONTAINER}" == "x" ]; then
31+ echo "UNKNOWN - Container ID or Friendly Name Required"
32+ exit 3
33+fi
34+
35+if [ "x$(which docker)" == "x" ]; then
36+ echo "UNKNOWN - Missing docker binary"
37+ exit 3
38+fi
39+
40+docker info > /dev/null 2>&1
41+if [ $? -ne 0 ]; then
42+ echo "UNKNOWN - Unable to talk to the docker daemon"
43+ exit 3
44+fi
45+
46+RUNNING=$(docker inspect --format="{{.State.Running}}" $CONTAINER 2> /dev/null)
47+
48+if [ $? -eq 1 ]; then
49+ echo "UNKNOWN - $CONTAINER does not exist."
50+ exit 2
51+fi
52+
53+if [ "$RUNNING" == "false" ]; then
54+ echo "CRITICAL - $CONTAINER is not running."
55+ exit 1
56+fi
57+
58+RESTARTING=$(docker inspect --format="{{.State.Restarting}}" $CONTAINER)
59+
60+if [ "$RESTARTING" == "true" ]; then
61+ echo "WARNING - $CONTAINER state is restarting."
62+ exit 3
63+fi
64+
65+STARTED=$(docker inspect --format="{{.State.StartedAt}}" $CONTAINER)
66+NETWORK=$(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $CONTAINER)
67+
68+echo "OK - $CONTAINER is running. IP: $NETWORK, StartedAt: $STARTED"
69+exit 0
70\ No newline at end of file
71
72=== added directory 'testing/testinfrastructure/ftp_server'
73=== added file 'testing/testinfrastructure/ftp_server/Dockerfile'
74--- testing/testinfrastructure/ftp_server/Dockerfile 1970-01-01 00:00:00 +0000
75+++ testing/testinfrastructure/ftp_server/Dockerfile 2017-05-06 16:14:31 +0000
76@@ -0,0 +1,32 @@
77+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
78+#
79+# Copyright 2017 Nils Tekampe <nils@tekampe.org>
80+#
81+# This file is part of duplicity.
82+# It is the Dockerfile of a simple ftp server that is used for backend testing
83+#
84+# Duplicity is free software; you can redistribute it and/or modify it
85+# under the terms of the GNU General Public License as published by the
86+# Free Software Foundation; either version 2 of the License, or (at your
87+# option) any later version.
88+#
89+# Duplicity is distributed in the hope that it will be useful, but
90+# WITHOUT ANY WARRANTY; without even the implied warranty of
91+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
92+# General Public License for more details.
93+#
94+# You should have received a copy of the GNU General Public License
95+# along with duplicity; if not, write to the Free Software Foundation,
96+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
97+
98+FROM stilliard/pure-ftpd
99+
100+# Install some tools for convenience
101+RUN apt-get update \
102+ && apt-get install -y \
103+ nano \
104+ mc \
105+ && rm -rf /var/lib/apt/lists/*
106+
107+# Creating a ftp user account for testing testuser:testuser
108+COPY pureftpd.passwd /etc/pure-ftpd/passwd/pureftpd.passwd
109
110=== added file 'testing/testinfrastructure/ftp_server/pureftpd.passwd'
111--- testing/testinfrastructure/ftp_server/pureftpd.passwd 1970-01-01 00:00:00 +0000
112+++ testing/testinfrastructure/ftp_server/pureftpd.passwd 2017-05-06 16:14:31 +0000
113@@ -0,0 +1,1 @@
114+testuser:$1$36McU8X0$bjd0mfn7qCisOoqrSLFl01:1000:1000::/home/ftpusers/testuser/./::::::::::::
115\ No newline at end of file
116
117=== added file 'testing/testinfrastructure/setup.sh'
118--- testing/testinfrastructure/setup.sh 1970-01-01 00:00:00 +0000
119+++ testing/testinfrastructure/setup.sh 2017-05-06 16:14:31 +0000
120@@ -0,0 +1,44 @@
121+#!/bin/bash
122+#
123+# Copyright 2017 Nils Tekampe <nils@tekampe.org>
124+#
125+# This file is part of duplicity.
126+# This script sets up a test network for the tests of dupclicity
127+# This script takes the assumption that the containers for the testinfrastructure do deither run
128+# or they are removed. It is not intended to have stopped containers.
129+#
130+# Duplicity is free software; you can redistribute it and/or modify it
131+# under the terms of the GNU General Public License as published by the
132+# Free Software Foundation; either version 2 of the License, or (at your
133+# option) any later version.
134+#
135+# Duplicity is distributed in the hope that it will be useful, but
136+# WITHOUT ANY WARRANTY; without even the implied warranty of
137+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
138+# General Public License for more details.
139+#
140+# You should have received a copy of the GNU General Public License
141+# along with duplicity; if not, write to the Free Software Foundation,
142+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
143+#
144+
145+
146+# Check whether a specific docker network for testing is already exisitng. If not, create it.
147+docker network inspect testnetwork &> /dev/null
148+
149+if [ $? -ne 0 ]; then
150+ echo "docker testnetwork not found. Creating network."
151+ docker network create --subnet=10.10.10.0/24 testnetwork
152+
153+fi
154+
155+
156+# Remove all runnging instances of the test system and als remove the containers. This ensure
157+# that the test infrastructure is frehshly started.
158+docker rm $(docker stop $(docker ps -a -q --filter name=ftpd_server --format="{{.ID}}"))
159+docker rm $(docker stop $(docker ps -a -q --filter name=duplicity_test --format="{{.ID}}"))
160+
161+
162+# Start the containers. Docker run will automatically download the image if necessary
163+docker run -d --net testnetwork --ip 10.10.10.3 --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "PUBLICHOST=localhost" dernils/duplicity_testinfrastructure_ftp
164+docker run --name duplicity_test --net testnetwork --ip 10.10.10.2 -it dernils/duplicitytest:latest

Subscribers

People subscribed via source and target branches