Permalink
Browse files

Added 3 b&t tests for nimbus-admin and nimbus-nodes

Fixed bug in nimbus-admin
  • Loading branch information...
1 parent 363c957 commit 87c36a5228d33a818a01737baed9c541f0f4002c @rrusnak1 rrusnak1 committed with oldpatricka Jul 19, 2011
View
4 .../source/src/org/globus/workspace/remoting/admin/defaults/DefaultRemoteAdminToolsMgmt.java
@@ -128,6 +128,10 @@ public String getVMsByDN(String userDN) throws RemoteException {
final _Caller caller = this.reprFactory._newCaller();
caller.setIdentity(userDN);
VM[] vms = manager.getAllByCaller(caller);
+
+ if(vms.length == 0)
+ return null;
+
final List<VMTranslation> vmts = new ArrayList<VMTranslation>(vms.length);
for(int i = 0; i < vms.length; i++) {
vmts.add(translateVM(vms[i]));
View
95 tests/cc-nimbusAdminList-test.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+import pexpect
+import sys
+import os
+
+to=90
+cc_home=os.environ['CLOUD_CLIENT_HOME']
+nimbus_home=os.environ['NIMBUS_HOME']
+logfile = sys.stdout
+
+try:
+ os.mkdir("%s/history/vm-999" % (cc_home))
+except:
+ print "The directory already exists"
+ pass
+
+cmd = "%s/bin/cloud-client.sh --transfer --sourcefile /etc/group" % (cc_home)
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+
+cmd = "%s/bin/cloud-client.sh --run --name group --hours .25" % (cc_home)
+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/nimbus-admin --list --user user1" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --list --dn /O=Auto/OU=CA/CN=nimbus@" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --list --host localhost" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --list --gid 1" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --list --gname UNLIMITED" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --list" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --batch --shutdown --all" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --delete --name group" % (cc_home)
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+sys.exit(0)
View
131 tests/cc-nimbusAdminShutdown-test.py
@@ -0,0 +1,131 @@
+#!/usr/bin/env python
+
+import pexpect
+import sys
+import os
+
+to=90
+cc_home=os.environ['CLOUD_CLIENT_HOME']
+nimbus_home=os.environ['NIMBUS_HOME']
+logfile = sys.stdout
+
+try:
+ os.mkdir("%s/history/vm-999" % (cc_home))
+except:
+ print "The directory already exists"
+ pass
+
+cmd = "%s/bin/cloud-client.sh --transfer --sourcefile /etc/group" % (cc_home)
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+
+cmd = "%s/bin/cloud-client.sh --run --name group --hours .25" % (cc_home)
+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/nimbus-admin --shutdown --id 1" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --run --name group --hours .25" % (cc_home)
+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/nimbus-admin --shutdown --dn /O=Auto/OU=CA/CN=nimbus@" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --shutdown --host localhost" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --run --name group --hours .25" % (cc_home)
+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/nimbus-admin --shutdown --gid 1" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --run --name group --hours .25" % (cc_home)
+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/nimbus-admin --shutdown --gname groupname" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --shutdown --user user1 --seconds 35" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --shutdown --all --seconds 30" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --delete --name group" % (cc_home)
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+sys.exit(0)
View
87 tests/cc-nimbusNodesAlloc-test.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+
+import pexpect
+import sys
+import os
+
+to=90
+cc_home=os.environ['CLOUD_CLIENT_HOME']
+nimbus_home=os.environ['NIMBUS_HOME']
+logfile = sys.stdout
+
+try:
+ os.mkdir("%s/history/vm-999" % (cc_home))
+except:
+ print "The directory already exists"
+ pass
+
+cmd = "%s/bin/cloud-client.sh --transfer --sourcefile /etc/group" % (cc_home)
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+
+cmd = "%s/bin/cloud-client.sh --run --name group --hours .25" % (cc_home)
+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/nimbus-nodes --allocation" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-nodes --allocation --pool public" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-nodes --allocation --pool public --free" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-nodes --allocation --pool public --used" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-nodes --allocation --pool private" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/nimbus-admin --batch --shutdown --all" % (nimbus_home)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+print x
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+cmd = "%s/bin/cloud-client.sh --delete --name group" % (cc_home)
+(x, rc)=pexpect.run(cmd, withexitstatus=1)
+if rc != 0:
+ print "error"
+ sys.exit(1)
+
+sys.exit(0)

0 comments on commit 87c36a5

Please sign in to comment.