diff --git a/xos/tosca/tests/observerComputeTest.py b/xos/tosca/tests/observerComputeTest.py
new file mode 100644
index 0000000..c2ca42c
--- /dev/null
+++ b/xos/tosca/tests/observerComputeTest.py
@@ -0,0 +1,45 @@
+from observertest import BaseObserverToscaTest
+
+from core.models import Instance, Site
+
+class ObserverComputeTest(BaseObserverToscaTest):
+    tests = ["create_instance"]
+    # hide_observer_output = False # uncomment to display lots of stuff to screen
+
+    def cleanup(self):
+        self.try_to_delete(Instance, purge=False, name="test_compute1")
+        self.try_to_delete(Site, purge=False, name="testsite")
+        self.run_observer()
+        self.try_to_delete(Site, purge=True, name="testsite")   # make it go away
+
+    def get_base_templates(self):
+        return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
+               self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")])
+
+    def create_instance(self):
+        self.assert_noobj(Instance, "test_compute1")
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", disk_size="1 GB", mem_size="513 MB"))
+        instance = self.assert_obj(Instance, "test_compute1")
+        assert(instance.flavor.name == "m1.small")
+
+        self.run_model_policy()
+
+        # this should make the ports
+        self.run_observer()
+
+        # reset the exponential backoff
+        instance = self.assert_obj(Instance, "test_compute1")
+        instance.backend_register="{}"
+
+        # this should instantiate the instance
+        self.run_observer()
+
+        instance = self.assert_obj(Instance, "test_compute1")
+
+        assert(instance.instance_id is not None)
+        assert(instance.instance_name is not None)
+
+if __name__ == "__main__":
+    ObserverComputeTest()
+
diff --git a/xos/tosca/tests/observertest.py b/xos/tosca/tests/observertest.py
new file mode 100644
index 0000000..32dcf24
--- /dev/null
+++ b/xos/tosca/tests/observertest.py
@@ -0,0 +1,64 @@
+from basetest import *
+
+import logging
+import StringIO
+import subprocess
+import sys
+
+from observer.event_loop import XOSObserver
+from model_policy import run_policy_once
+from xos.config import set_override
+from util.logger import Logger, observer_logger
+
+class BaseObserverToscaTest(BaseToscaTest):
+    hide_observer_output = True
+
+    def __init__(self):
+        super(BaseObserverToscaTest, self).__init__()
+
+    def ensure_observer_not_running(self):
+        ps_output = subprocess.Popen("ps -elfy", shell=True, stdout=subprocess.PIPE).stdout.read()
+        if "/opt/xos/xos-observer.py" in ps_output:
+            print >> sys.stderr, "an observer is still running"
+            print >> sys.stderr, "please stop it, for example 'supervisorctl stop observer'"
+            sys.exit(-1)
+
+    def log_to_memory(self):
+        set_override("observer_console_print", False)
+
+        if self.hide_observer_output:
+            logStream = StringIO.StringIO()
+            handler = logging.StreamHandler(stream=logStream)
+            handler.setLevel(logging.DEBUG)
+            handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(message)s"))
+
+            loggername = Logger().loggername
+            log = logging.getLogger(loggername)
+            for hdlr in log.handlers[:]:
+                log.removeHandler(hdlr)
+            log.addHandler(handler)
+            log.propagate = False
+
+            log = observer_logger.logger
+            for hdlr in log.handlers[:]:
+                log.removeHandler(hdlr)
+            log.addHandler(handler)
+            log.propagate = False
+
+    def run_model_policy(self):
+        self.ensure_observer_not_running()
+        self.log_to_memory()
+
+        #print ">>>>> run model_policies"
+        run_policy_once()
+        #print ">>>>> done model_policies"
+
+    def run_observer(self):
+        self.ensure_observer_not_running()
+        self.log_to_memory()
+
+        observer = XOSObserver()
+        #print ">>>>> run observer"
+        observer.run_once()
+        #print ">>>>> done observer"
+
