Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments from WSU CS 401 #16

Merged
merged 9 commits into from Apr 9, 2012
46 changes: 21 additions & 25 deletions eutester/eulogger.py
Expand Up @@ -31,6 +31,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#
# author: clarkmatthew
# modified by: Trevor Hodde

'''
Example:
Expand All @@ -47,19 +48,27 @@
import logging
import time


#This class basically sets up a debugger for testing purposes. It allows the user to set up a new logger object and pass different debug arguments to create "breakpoints" in the code.
class Eulogger(object):

def __init__ (self,
identifier="eulogger",
log_level= "debug",
fdebug ='%(message)s',
ferr = '%(funcName)s():%(lineno)d: %(message)',
logfile = "",
clear = False
):

# setup the logging This should eventually be done in it's own method probably...
#constructor for the Eulogger
def __init__(self,identifier="eulogger",log_level="debug",fdebug='%(message)s',ferr='%(funcName)s():%(lineno)d: %(message)',logfile = "",clear = False):
setupLogging(identifier, log_level, fdebug, ferr, logfile, clear)

#now add the locations will log to by adding handlers to our logger...
self.log.addHandler(self.outhdlr)

if (self.logfile != ""):
#to log to a file as well add another handler to the logger...
if (self.clear):
os.remove(self.logfile)
filehdlr = logging.FileHandler(self.logfile)
filehdlr.setFormatter(str(self.ferr))
self.log.addHandler(filehdlr)


#This function sets up all of the logger properties
def setupLogging(identifier, log_level, fdebug, ferr, logfile, clear):
self.log_level = logging.__dict__.get(log_level.upper(),logging.DEBUG)
self.logfile = os.path.join(logfile)
self.ferr = ferr
Expand All @@ -79,17 +88,4 @@ def __init__ (self,
for handler in self.log.handlers:
if handler is self.outhdlr:
return


#now add the locations will log to by adding handlers to our logger...

self.log.addHandler(self.outhdlr)

if (self.logfile != ""):
#to log to a file as well add another handler to the logger...
if (self.clear):
os.remove(self.logfile)
filehdlr = logging.FileHandler(self.logfile)
filehdlr.setFormatter(str(self.ferr))
self.log.addHandler(filehdlr)


10 changes: 10 additions & 0 deletions testcases/unstable/bfebs/create_bfebs_img_test.py
@@ -1,4 +1,14 @@
#! ../share/python_lib/devel/bin/python
#
# Description: Creates an image instance based on the image argument passed in. Then
# attempts to download a remote image and store it on an attached volume.
# A snapshot is then created from the splatted volume that the remote image
# was written to. Lastly the emi of the snapshot is registered. Upon completion,
# the volume is deleted and the instance is terminated.
#
# bfebs = Amazon Elastic Block Store (http://aws.amazon.com/ebs/)
#

from eucaops import Eucaops
from optparse import OptionParser
import os, re
Expand Down
5 changes: 5 additions & 0 deletions testcases/unstable/eustore/test.py
@@ -1,3 +1,8 @@
#
# Description: Looks for a set of six images, if found attempts to install the images on the clc.
# If image is not found error is displayed.
#

import time
from eucaops import Eucaops
if __name__ == '__main__':
Expand Down
9 changes: 6 additions & 3 deletions testcases/unstable/image_attribute.py
@@ -1,8 +1,11 @@
#!/usr/bin/python
#
# Author: Vic and Graziano
# Description: Eutester test case to reproduce bug 737335
# (https://bugs.launchpad.net/eucalyptus/+bug/737335)
# Author: Vic and Graziano
# Description: Eutester test case to reproduce bug 737335
# Creates an instance of an image, and removes all permissions from the instance.
# If there are still permissions after the command to remove all of them has executed,
# the test fails; otherwise, tries to run the image.
# (https://bugs.launchpad.net/eucalyptus/+bug/737335)
#

from eutester import Eutester
Expand Down
6 changes: 6 additions & 0 deletions testcases/unstable/instancetest.py
@@ -1,4 +1,10 @@
#! ../share/python_lib/vic-dev-27/bin/python
#
# Description: Runs a series of tests on an eutester instance. The tests include stopping logging, checking IP's,
# running the smallest and largest instances available, checking metadata, and rebooting an instance
# to make sure that connectivity is maintained and volumes stay attached.
#

import unittest
import time
from eucaops import Eucaops
Expand Down
7 changes: 7 additions & 0 deletions testcases/unstable/load_test.py
@@ -1,4 +1,11 @@
#!/usr/bin/python
#
# Description: Creates instance(s) according to the number passed in via args.
# SSH into each instance, and attaches a volume to each. Creates
# a file system on the volume. Unmounts the volume and terminates the
# instance once done. Displays Success/Fail count for all instances
# after all instances have been terminated.
#

from eucaops import Eucaops
import argparse
Expand Down
6 changes: 6 additions & 0 deletions testcases/unstable/test.py
@@ -1,3 +1,9 @@
#
# Description: Creates an image instance and runs it. Next takes input
# from the terminal to perform tasks on the instance.
# The instance is terminated once completed.
#

from eucaops import Eucaops
if __name__ == '__main__':
tester = Eucaops( hostname="clc",password="foobar")
Expand Down