Skip to content
Browse files

Adding two more tests

  • Loading branch information...
1 parent dacb0f1 commit b03dfd9e766e90511280befd2bc0be24758bdc81 BuzzTroll committed
Showing with 112 additions and 0 deletions.
  1. +66 −0 tests/cc-submit-common-save-submit-own.py
  2. +46 −0 tests/cc-submit-common-twice-test.py
View
66 tests/cc-submit-common-save-submit-own.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+import pexpect
+import sys
+import os
+import uuid
+
+to=90
+cc_home=os.environ['CLOUD_CLIENT_HOME']
+nh=os.environ['NIMBUS_HOME']
+logfile = sys.stdout
+common_image = str(uuid.uuid1()).replace("-", "")
+
+cmd = "%s/bin/nimbus-public-image /etc/group %s" % (nh, common_image)
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+if rc != 0:
+ print "failed create the public image"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, common_image)
+child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
+rc = child.expect ('Running:')
+if rc != 0:
+ print "group not found in the list"
+ sys.exit(1)
+handle = child.readline().strip().replace("'", "")
+rc = child.expect(pexpect.EOF)
+if rc != 0:
+ print "run"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --handle %s --save" % (cc_home, handle)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+print x
+if rc != 0:
+ print "failed to save"
+ sys.exit(1)
+
+
+cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, common_image)
+child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
+rc = child.expect ('Running:')
+if rc != 0:
+ print "group not found in the list"
+ sys.exit(1)
+handle = child.readline().strip().replace("'", "")
+rc = child.expect(pexpect.EOF)
+if rc != 0:
+ print "run"
+ sys.exit(1)
+cmd = "%s/bin/cloud-client.sh --terminate --handle %s" % (cc_home, handle)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1, timeout=to, logfile=logfile)
+print x
+if rc != 0:
+ print "failed to terminate"
+ sys.exit(1)
+
+
+cmd = "%s/bin/nimbus-public-image --delete %s" % (nh, common_image)
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+if rc != 0:
+ print "failed create the public image"
+ sys.exit(1)
+sys.exit(0)
View
46 tests/cc-submit-common-twice-test.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+import pexpect
+import sys
+import os
+import uuid
+
+to=90
+cc_home=os.environ['CLOUD_CLIENT_HOME']
+nh=os.environ['NIMBUS_HOME']
+logfile = sys.stdout
+common_image = str(uuid.uuid1()).replace("-", "")
+
+cmd = "%s/bin/nimbus-public-image /etc/group %s" % (nh, common_image)
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+if rc != 0:
+ print "failed create the public image"
+ sys.exit(1)
+
+for i in range(0, 2):
+ cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, common_image)
+ child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
+ rc = child.expect ('Running:')
+ if rc != 0:
+ print "run failed on try %d" % (i)
+ sys.exit(1)
+ handle = child.readline().strip().replace("'", "")
+ rc = child.expect(pexpect.EOF)
+ if rc != 0:
+ print "run"
+ sys.exit(1)
+
+ cmd = "%s/bin/cloud-client.sh --terminate --handle %s" % (cc_home, handle)
+ print cmd
+ (x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile, timeout=to)
+ print x
+ if rc != 0:
+ print "failed to terminate %s on try %d" % (handle, i)
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-public-image --delete %s" % (nh, common_image)
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+if rc != 0:
+ print "failed create the public image"
+ sys.exit(1)
+sys.exit(0)

0 comments on commit b03dfd9

Please sign in to comment.
Something went wrong with that request. Please try again.