Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 60 lines (49 sloc) 1.361 kb
9fd7575 adding new tests for cloud client list reporting
BuzzTroll authored
1 #!/usr/bin/env python
2
3 import pexpect
4 import sys
5 import os
6
b354f65 changing timeouts in cloud-client tests. NMI is exceeding
BuzzTroll authored
7 to=90
9fd7575 adding new tests for cloud client list reporting
BuzzTroll authored
8 cc_home=os.environ['CLOUD_CLIENT_HOME']
9 logfile = sys.stdout
10
11 src_file = "/etc/group"
12 sfa = src_file.split("/")
13 image_name = sfa[len(sfa) - 1]
14 size = os.path.getsize(src_file)
15 cmd = "%s/bin/cloud-client.sh --transfer --sourcefile %s" % (cc_home, src_file)
16 (x, rc)=pexpect.run(cmd, withexitstatus=1)
17
18 cmd = "%s/bin/cloud-client.sh --list" % (cc_home)
b354f65 changing timeouts in cloud-client tests. NMI is exceeding
BuzzTroll authored
19 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
9fd7575 adding new tests for cloud client list reporting
BuzzTroll authored
20 rc = child.expect (image_name)
21 if rc != 0:
22 print "%s not found in the list" % (image_name)
23 sys.exit(1)
24
25 line = child.readline()
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
26 line = child.readline()
9fd7575 adding new tests for cloud client list reporting
BuzzTroll authored
27 token = "Size: "
28 ndx = line.find(token)
29 if ndx < 0:
30 print "%s not found in line %s" % (token, line)
31 sys.exit(1)
32 line = line[ndx + len(token):]
33 ndx = line.find(" ")
34 if ndx < 0:
35 print "%s not found in line %s" % (token, line)
36 sys.exit(1)
37 line = line[0:ndx].strip()
38
39 show_size = int(line)
40
41 if show_size != size:
42 print "%s not found in line %s" % (token, line)
43 sys.exit(1)
44
45 print "sizes match! %d" % (show_size)
46
47 rc = child.expect(pexpect.EOF)
48 if rc != 0:
49 print "run"
50 sys.exit(1)
51
52 cmd = "%s/bin/cloud-client.sh --delete --name %s" % (cc_home, image_name)
53 print cmd
54 (x, rc)=pexpect.run(cmd, withexitstatus=1)
55 print x
56 if rc != 0:
57 print "failed to delete"
58 sys.exit(1)
59 sys.exit(0)
Something went wrong with that request. Please try again.