Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added a new test for md5 check

  • Loading branch information...
commit f57bf2a56314b132ba2545f73f152d02e3530038 1 parent fc0b3cc
BuzzTroll authored
Showing with 85 additions and 1 deletion.
  1. +81 −0 tests/cc-unprop-md5test.py
  2. +4 −1 tests/make-test-env.sh
View
81 tests/cc-unprop-md5test.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+
+import pexpect
+import sys
+import os
+import filecmp
+import uuid
+import datetime
+
+to=90
+cc_home=os.environ['CLOUD_CLIENT_HOME']
+logfile = sys.stdout
+newname=str(uuid.uuid1()).replace("-", "")
+
+src_file = "/etc/group"
+sfa = src_file.split("/")
+image_name = sfa[len(sfa) - 1]
+size=os.path.getsize(src_file)
+
+cmd = "%s/bin/cloud-client.sh --transfer --sourcefile %s" % (cc_home, src_file)
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+
+cmd = "%s/bin/cloud-client.sh --run --name %s --hours .25" % (cc_home, image_name)
+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 --newname %s" % (cc_home, handle, newname)
+print cmd
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+print x
+if rc != 0:
+ print "failed to save"
+ sys.exit(1)
+
+cmd="s3cmd info s3://Repo/VMS/%s/%s" % (os.environ['NIMBUS_TEST_USER_CAN_ID'], newname)
+print cmd
+child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
+rc = child.expect ('MD5 sum:')
+if rc != 0:
+ print "group not found in the list"
+ sys.exit(1)
+sum1 = child.readline().strip()
+rc = child.expect(pexpect.EOF)
+if rc != 0:
+ print "s3 info failed"
+ sys.exit(1)
+
+cmd="s3cmd info s3://Repo/VMS/%s/%s" % (os.environ['NIMBUS_TEST_USER_CAN_ID'], image_name)
+print cmd
+child = pexpect.spawn (cmd, timeout=to, maxread=20000, logfile=logfile)
+rc = child.expect ('MD5 sum:')
+if rc != 0:
+ print "group not found in the list"
+ sys.exit(1)
+sum2 = child.readline().strip()
+rc = child.expect(pexpect.EOF)
+if rc != 0:
+ print "s3 info failed"
+ sys.exit(1)
+
+if sum1 != sum2:
+ print "sums not the same %s %s" % (sum1, sum2)
+ sys,exit(1)
+
+cmd = "%s/bin/cloud-client.sh --delete --name %s" % (cc_home, newname)
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+cmd = "%s/bin/cloud-client.sh --delete --name %s" % (cc_home, image_name)
+(x, rc)=pexpect.run(cmd, withexitstatus=1, logfile=logfile)
+
+
+sys.exit(0)
+
+
View
5 tests/make-test-env.sh
@@ -126,7 +126,7 @@ echo "Making a new user"
echo "========================================="
user_name="nimbus@$RANDOM"
-user_stuff=`$install_dir/bin/nimbus-new-user --group 04 --batch -r cloud_properties,cert,key,access_id,access_secret $user_name`
+user_stuff=`$install_dir/bin/nimbus-new-user --group 04 --batch -r cloud_properties,cert,key,access_id,access_secret,canonical_id $user_name`
echo $user_stuff
cp=`echo $user_stuff | awk -F , '{ print $1 }'`
@@ -134,6 +134,7 @@ cert=`echo $user_stuff | awk -F , '{ print $2 }'`
key=`echo $user_stuff | awk -F , '{ print $3 }'`
aid=`echo $user_stuff | awk -F , '{ print $4 }'`
apw=`echo $user_stuff | awk -F , '{ print $5 }'`
+can_id=`echo $user_stuff | awk -F , '{ print $6 }'`
cat $HOME/.s3cfg
@@ -189,10 +190,12 @@ echo "NIMBUS_HOME: $NIMBUS_HOME"
echo "NIMBUS_TEST_USER: $NIMBUS_TEST_USER"
echo "CLOUD_CLIENT_HOME: $CLOUD_CLIENT_HOME"
echo "NIMBUS_WORKSPACE_CONTROL_HOME: $NIMBUS_WORKSPACE_CONTROL_HOME"
+echo "NIMBUS_TEST_USER_CAN_ID: $can_id"
echo "export NIMBUS_HOME=$NIMBUS_HOME" > $src_dir/env.sh
echo "export NIMBUS_TEST_USER=$NIMBUS_TEST_USER" >> $src_dir/env.sh
echo "export CLOUD_CLIENT_HOME=$CLOUD_CLIENT_HOME" >> $src_dir/env.sh
echo "export NIMBUS_WORKSPACE_CONTROL_HOME=$NIMBUS_WORKSPACE_CONTROL_HOME" >> $src_dir/env.sh
+echo "export NIMBUS_TEST_USER_CAN_ID=$can_id" >> $src_dir/env.sh
Please sign in to comment.
Something went wrong with that request. Please try again.