~chris.macnaughton/openstack-mojo-specs/nova-compute-migration

« back to all changes in this revision

Viewing changes to helper/tests/test_ceph_store.py

[muitiple] Merging 17.08 testing changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
 
1
#!/usr/bin/env python
2
2
 
3
3
import sys
4
4
 
5
5
import utils.mojo_utils as mojo_utils
 
6
import argparse
6
7
 
7
8
 
8
9
def main(argv):
9
 
    # Check
10
 
    mojo_utils.remote_run('ceph-mon/0', 'echo 123456789 > /tmp/input.txt')
11
 
    mojo_utils.remote_run(
12
 
        'ceph-mon/0', 'rados put -p rbd test_input /tmp/input.txt')
13
 
 
14
 
    # Check
15
 
    mojo_utils.remote_run(
16
 
        'ceph-mon/1', 'rados get -p rbd test_input /tmp/input.txt')
17
 
    output = mojo_utils.remote_run('ceph-mon/1', 'cat /tmp/input.txt')
 
10
    parser = argparse.ArgumentParser()
 
11
    parser.add_argument("application",  default="ceph-mon", nargs="*")
 
12
    parser.add_argument("units", default=[0, 1], nargs="*")
 
13
    options = parser.parse_args()
 
14
    application = mojo_utils.parse_mojo_arg(options,
 
15
                                            'application', multiargs=False)
 
16
    units = mojo_utils.parse_mojo_arg(options, 'units', multiargs=True)
 
17
 
 
18
    mojo_utils.remote_run(
 
19
        '{}/{}'.format(application, units[0]), 'ceph osd pool create rbd 128')
 
20
    # Check
 
21
    mojo_utils.remote_run(
 
22
        '{}/{}'.format(application, units[0]),
 
23
        'echo 123456789 > /tmp/input.txt')
 
24
    mojo_utils.remote_run(
 
25
        '{}/{}'.format(application, units[0]),
 
26
        'rados put -p rbd test_input /tmp/input.txt')
 
27
 
 
28
    # Check
 
29
    mojo_utils.remote_run(
 
30
        '{}/{}'.format(application, units[-1]),
 
31
        'rados get -p rbd test_input /tmp/input.txt')
 
32
    output = mojo_utils.remote_run(
 
33
        '{}/{}'.format(application, units[-1]),
 
34
        'cat /tmp/input.txt')
18
35
 
19
36
    # Cleanup
20
 
    mojo_utils.remote_run('ceph-mon/2', 'rados rm -p rbd test_input')
 
37
    mojo_utils.remote_run(
 
38
        '{}/{}'.format(application, units[-1]),
 
39
        'rados rm -p rbd test_input')
21
40
    if output[0].strip() != "123456789":
22
41
        sys.exit(1)
23
42