1 # Copyright 2013 GRNET S.A. All rights reserved.
3 # Redistribution and use in source and binary forms, with or
4 # without modification, are permitted provided that the following
7 # 1. Redistributions of source code must retain the above
8 # copyright notice, this list of conditions and the following
11 # 2. Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following
13 # disclaimer in the documentation and/or other materials
14 # provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
29 # The views and conclusions contained in the software and
30 # documentation are those of the authors and should not be
31 # interpreted as representing official policies, either expressed
32 # or implied, of GRNET S.A.
36 from shutil import copy2 as copy
39 class TestCluster(Cluster):
40 def execute_test(self, ci_dir, packages_dir):
41 tests = os.path.join(ci_dir, '../xseg/tools/qa')
42 self.inject_file(tests, '/root')
43 self.execute_command('mkdir -p /etc/ceph/')
44 ceph_conf = os.path.join(ci_dir, 'ceph.conf')
45 self.inject_file(ceph_conf, '/etc/ceph/ceph.conf')
46 ceph_apt = os.path.join(ci_dir, 'ceph.list')
47 self.inject_file(ceph_apt, '/etc/apt/sources.list.d/')
48 self.install_packages(['ceph-common', 'librados2'])
49 self.inject_file(packages_dir, '/root')
51 libxseg0_*_amd64.deb \
52 libxseg0-dbg_*_amd64.deb \
53 python-xseg_*_amd64.deb \
54 python-archipelago_*_amd64.deb \
55 archipelago-modules-dkms_*_amd64.deb \
56 archipelago_*_amd64.deb \
57 archipelago-dbg_*_amd64.deb \
58 archipelago-rados_*_amd64.deb \
59 archipelago-rados-dbg_*_amd64.deb \
60 archipelago-ganeti_*_amd64.deb"""
61 remote_folder = os.path.normpath(packages_dir)
62 remote_folder = os.path.basename(remote_folder)
63 self.execute_command('cd /root/' + remote_folder + ' ; ' + cmd)
64 self.execute_command('python /root/qa/tests.py -v', verbose=True)
65 # self.execute_command('python /root/qa/tests.py -v FiledTest', verbose=True)
66 # self.execute_command('python /root/qa/tests.py -v MapperdTest', verbose=True)
67 # self.execute_command('python /root/qa/tests.py -v VlmcdTest', verbose=True)
68 self.execute_command('mkdir -p /srv/archip/blocks')
69 self.execute_command('mkdir -p /srv/archip/maps')
70 self.execute_command('mkdir -p /mnt/mountpoint')
71 self.execute_command('archipelago start')
72 self.execute_command('python /root/qa/basictest.py', verbose=True)
74 if __name__ == '__main__':
75 now = datetime.datetime.now().strftime('%b-%d-%I%M%p-%G')
76 node = 'archipelago-test ' + now
77 token = os.environ['TOKEN']
78 token = open(token).read().strip()
79 packages_dir = os.environ['PACKAGES_DIR']
80 image_id = os.environ['IMAGE_ID']
81 image_id = open(image_id).read().strip()
82 ci_dir = os.path.dirname(os.path.abspath(__file__))
83 conffile = os.path.join(ci_dir, 'config')
84 tmpfile = '/tmp/tmpconfig_' + now
85 copy(conffile, tmpfile)
88 tc = TestCluster(conffile=conffile, token=token, servers=node, image_id=image_id)
90 tc.execute_test(ci_dir, packages_dir)