Skip to content
Newer
Older
100755 70 lines (61 sloc) 2.06 KB
ce10d3a another test that tickles the area where the 0 length file was found
BuzzTroll authored
1 #!/usr/bin/env python
2
3 import pexpect
4 import sys
5 import os
6 import uuid
7
f3cd495 @buzztroll breaking out the image name from the image location
buzztroll authored
8 tst_image_name = os.environ['NIMBUS_TEST_IMAGE']
9 tst_image_src = os.environ['NIMBUS_SOURCE_TEST_IMAGE']
899db05 @buzztroll this time remembering to quote the env
buzztroll authored
10 to=int(os.environ["NIMBUS_TEST_TIMEOUT"])
ce10d3a another test that tickles the area where the 0 length file was found
BuzzTroll authored
11 cc_home=os.environ['CLOUD_CLIENT_HOME']
12 nh=os.environ['NIMBUS_HOME']
13 logfile = sys.stdout
14 common_image = str(uuid.uuid1()).replace("-", "")
15 newname = str(uuid.uuid1()).replace("-", "")
16
f3cd495 @buzztroll breaking out the image name from the image location
buzztroll authored
17 cmd = "%s/bin/nimbus-public-image %s %s" % (nh, tst_image_src, common_image)
3586fd0 @buzztroll upping timeouts for real tests
buzztroll authored
18 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile, timeout=to)
ce10d3a another test that tickles the area where the 0 length file was found
BuzzTroll authored
19 if rc != 0:
20 print "failed create the public image"
21 sys.exit(1)
22
888af83 @buzztroll increasing the submission time for real tests
buzztroll authored
23 cmd = "%s/bin/cloud-client.sh --run --name %s --hours .5 --newname %s" % (cc_home, common_image, newname)
ce10d3a another test that tickles the area where the 0 length file was found
BuzzTroll authored
24 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
25 rc = child.expect ('Running:')
26 if rc != 0:
d771635 @buzztroll removing harded references to group
buzztroll authored
27 print "Running not found in the list"
ce10d3a another test that tickles the area where the 0 length file was found
BuzzTroll authored
28 sys.exit(1)
29 handle = child.readline().strip().replace("'", "")
30 rc = child.expect(pexpect.EOF)
31 if rc != 0:
32 print "run"
33 sys.exit(1)
34
35 cmd = "%s/bin/cloud-client.sh --list" % (cc_home)
36 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
37 line = child.readline()
38 while line:
39 if line.find(newname) >= 0:
40 print "image name is in list before hte image terminated"
41 sys.exit(1)
42 line = child.readline()
43
44 cmd = "%s/bin/cloud-client.sh --save --handle %s" % (cc_home, handle)
45 print cmd
3586fd0 @buzztroll upping timeouts for real tests
buzztroll authored
46 (x, rc)=pexpect.run(cmd, withexitstatus=1, timeout=to)
ce10d3a another test that tickles the area where the 0 length file was found
BuzzTroll authored
47 print x
48 if rc != 0:
49 print "failed to terminate"
50 sys.exit(1)
51
52 found = False
53 cmd = "%s/bin/cloud-client.sh --list" % (cc_home)
54 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
55 line = child.readline()
56 while line:
57 if line.find(newname) >= 0:
58 found = True
59 line = child.readline()
60 if not found:
61 print "new name not found after the images was saved"
62 sys.exit(1)
63
64 cmd = "%s/bin/nimbus-public-image --delete %s" % (nh, common_image)
3586fd0 @buzztroll upping timeouts for real tests
buzztroll authored
65 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile, timeout=to)
ce10d3a another test that tickles the area where the 0 length file was found
BuzzTroll authored
66 if rc != 0:
67 print "failed create the public image"
68 sys.exit(1)
69 sys.exit(0)
Something went wrong with that request. Please try again.