Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 85 lines (66 sloc) 2.273 kb
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
1 #!/usr/bin/env python
2
3 import pexpect
4 import sys
5 import os
6 import uuid
7 import datetime
8
f3cd495 @buzztroll breaking out the image name from the image location
buzztroll authored
9 tst_image_name = os.environ['NIMBUS_TEST_IMAGE']
10 tst_image_src = os.environ['NIMBUS_SOURCE_TEST_IMAGE']
899db05 @buzztroll this time remembering to quote the env
buzztroll authored
11 to=int(os.environ["NIMBUS_TEST_TIMEOUT"])
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
12 cc_home=os.environ['CLOUD_CLIENT_HOME']
13 logfile = sys.stdout
14 newname=str(uuid.uuid1()).replace("-", "")
15
f3cd495 @buzztroll breaking out the image name from the image location
buzztroll authored
16 src_file = tst_image_src
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
17 sfa = src_file.split("/")
18 image_name = sfa[len(sfa) - 1]
19 size=os.path.getsize(src_file)
20
21 cmd = "%s/bin/cloud-client.sh --transfer --sourcefile %s" % (cc_home, src_file)
3586fd0 @buzztroll upping timeouts for real tests
buzztroll authored
22 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile, timeout=to)
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
23
24 cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, image_name)
b354f65 changing timeouts in cloud-client tests. NMI is exceeding
BuzzTroll authored
25 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
26 rc = child.expect ('Running:')
27 if rc != 0:
d771635 @buzztroll removing harded references to group
buzztroll authored
28 print "Running not found in the list"
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
29 sys.exit(1)
30 handle = child.readline().strip().replace("'", "")
31 rc = child.expect(pexpect.EOF)
32 if rc != 0:
33 print "run"
34 sys.exit(1)
35
36 cmd = "%s/bin/cloud-client.sh --handle %s --save --newname %s" % (cc_home, handle, newname)
37 print cmd
3586fd0 @buzztroll upping timeouts for real tests
buzztroll authored
38 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile, timeout=to)
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
39 print x
40 if rc != 0:
41 print "failed to save"
42 sys.exit(1)
43
44 # check the various params
45 cmd = "%s/bin/cloud-client.sh --list" % (cc_home)
b354f65 changing timeouts in cloud-client tests. NMI is exceeding
BuzzTroll authored
46 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
77b77d6 problems with unprop test
BuzzTroll authored
47 rc = child.expect (newname)
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
48 if rc != 0:
77b77d6 problems with unprop test
BuzzTroll authored
49 print "%s not found in the list" % (newname)
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
50 sys.exit(1)
51
52 line = child.readline()
53 line = child.readline()
54 token = "Size: "
55 ndx = line.find(token)
56 if ndx < 0:
57 print "%s not found in line %s" % (token, line)
58 sys.exit(1)
59 line = line[ndx + len(token):]
60 ndx = line.find(" ")
61 if ndx < 0:
62 print "%s not found in line %s" % (token, line)
63 sys.exit(1)
64 line = line[0:ndx].strip()
65
66 show_size = int(line)
67
68 if show_size != size:
69 print "%s not found in line %s" % (token, line)
70 sys.exit(1)
71
77b77d6 problems with unprop test
BuzzTroll authored
72 print "sizes match! %d %s %s" % (show_size, newname, image_name)
1be52db adding test to check the unpropagated files reported values
BuzzTroll authored
73
74
75
76 cmd = "%s/bin/cloud-client.sh --delete --name %s" % (cc_home, newname)
77 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
78 cmd = "%s/bin/cloud-client.sh --delete --name %s" % (cc_home, image_name)
79 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
80
81
82 sys.exit(0)
83
84
Something went wrong with that request. Please try again.