Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 47 lines (40 sloc) 1.361 kb
b03dfd9 Adding two more tests
BuzzTroll authored
1 #!/usr/bin/env python
2
3 import pexpect
4 import sys
5 import os
6 import uuid
7
8 to=90
9 cc_home=os.environ['CLOUD_CLIENT_HOME']
10 nh=os.environ['NIMBUS_HOME']
11 logfile = sys.stdout
12 common_image = str(uuid.uuid1()).replace("-", "")
13
14 cmd = "%s/bin/nimbus-public-image /etc/group %s" % (nh, common_image)
15 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
16 if rc != 0:
17 print "failed create the public image"
18 sys.exit(1)
19
20 for i in range(0, 2):
21 cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, common_image)
22 child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
23 rc = child.expect ('Running:')
24 if rc != 0:
25 print "run failed on try %d" % (i)
26 sys.exit(1)
27 handle = child.readline().strip().replace("'", "")
28 rc = child.expect(pexpect.EOF)
29 if rc != 0:
30 print "run"
31 sys.exit(1)
32
33 cmd = "%s/bin/cloud-client.sh --terminate --handle %s" % (cc_home, handle)
34 print cmd
35 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile, timeout=to)
36 print x
37 if rc != 0:
38 print "failed to terminate %s on try %d" % (handle, i)
39 sys.exit(1)
40
41 cmd = "%s/bin/nimbus-public-image --delete %s" % (nh, common_image)
42 (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
43 if rc != 0:
44 print "failed create the public image"
45 sys.exit(1)
46 sys.exit(0)
Something went wrong with that request. Please try again.