def test_get_application_state_eph1(self):
        foobar = "/foo/bar"
        foobarhead = "/foo/bar/head"

        cache = self._create_app_state_cache()

        stat = StatMock()
        stat.ephemeralOwner = 1
        stat.last_modified = 0
        stat.created = 1

        self.zoo_keeper.get(foobarhead,
                            watch=mox.IgnoreArg()).InAnyOrder().AndReturn(
                                ("{}", stat))
        self.zoo_keeper.get(foobar,
                            watch=mox.IgnoreArg()).InAnyOrder().AndReturn(
                                ("{}", stat))
        self.zoo_keeper.get_children(foobar,
                                     watch=mox.IgnoreArg()).InAnyOrder()
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(
            ('{}', None))
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(
            ('{}', None))
        self.time_estimate_cache.get_graphite_data('/foo/bar').AndReturn({})

        self.mox.ReplayAll()

        cache._get_application_state(foobarhead)

        self.mox.VerifyAll()
    def test_get_application_state_eph0(self):

        path = "/foo/bar/head"
        test_unknown = '/test/Unknown'

        cache = self._create_app_state_cache()

        stat = StatMock()
        stat.ephemeralOwner = 0
        stat.last_modified = 0

        self.zoo_keeper.get(path,
                            watch=mox.IgnoreArg()).InAnyOrder().AndReturn(
                                ("{}", stat))
        self.zoo_keeper.get_children(
            path, watch=mox.IgnoreArg()).InAnyOrder().AndReturn([])
        self.zoo_keeper.exists(test_unknown,
                               watch=mox.IgnoreArg()).InAnyOrder()
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(
            ('{}', None))
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(
            ('{}', None))
        self.time_estimate_cache.get_graphite_data('/foo/bar/head').AndReturn(
            {})

        self.mox.ReplayAll()

        cache._get_application_state(path)

        self.mox.VerifyAll()
예제 #3
0
    def test_get_application_state_eph1(self):
        foobar = "/foo/bar"
        foobarhead = "/foo/bar/head"

        cache = self._create_app_state_cache()

        stat = StatMock()
        stat.ephemeralOwner = 1
        stat.last_modified = 0
        stat.created = 1

        self.zoo_keeper.get(foobarhead, watch=mox.IgnoreArg()).InAnyOrder().AndReturn(("{}", stat))
        self.zoo_keeper.get(foobar, watch=mox.IgnoreArg()).InAnyOrder().AndReturn(("{}", stat))
        self.zoo_keeper.get_children(foobar, watch=mox.IgnoreArg()).InAnyOrder()

        self.mox.ReplayAll()
         
        cache._get_application_state(foobarhead)

        self.mox.VerifyAll()
예제 #4
0
    def test_get_application_state_eph0(self):

        path = "/foo/bar/head"
        test_unknown = '/test/Unknown'

        cache = self._create_app_state_cache()

        stat = StatMock()
        stat.ephemeralOwner = 0
        stat.last_modified = 0
        
        self.zoo_keeper.get(path, watch=mox.IgnoreArg()).AndReturn(("{}", stat))
        self.zoo_keeper.get_children(path, watch=mox.IgnoreArg()).AndReturn([])
        self.zoo_keeper.exists(test_unknown, watch=mox.IgnoreArg())

        self.mox.ReplayAll()
         
        cache._get_application_state(path)

        self.mox.VerifyAll()
    def test_get_application_state_eph1(self):

        path = "/foo/bar/head"

        self.agent_cache.add_callback(mox.IgnoreArg())
        self.agent_cache.get_app_data_by_path("/foo/bar").AndReturn({})
        mox.Replay(self.agent_cache)

        cache = ApplicationStateCache(self.configuration, self.zoo_keeper, self.web_socket_clients, self.agent_cache)

        stat = StatMock()
        stat.ephemeralOwner = 1
        stat.created = 1
        
        self.zoo_keeper.get(path).AndReturn((None, stat))
        self.zoo_keeper.get_children("/foo/bar", watch=mox.IgnoreArg())

        self.mox.ReplayAll()
         
        cache._get_application_state(path)

        self.mox.VerifyAll()
    def test_get_application_state_eph1(self):
        foobar = "/foo/bar"
        foobarhead = "/foo/bar/head"

        cache = self._create_app_state_cache()

        stat = StatMock()
        stat.ephemeralOwner = 1
        stat.last_modified = 0
        stat.created = 1

        self.zoo_keeper.get(foobarhead, watch=mox.IgnoreArg()).InAnyOrder().AndReturn(("{}", stat))
        self.zoo_keeper.get(foobar, watch=mox.IgnoreArg()).InAnyOrder().AndReturn(("{}", stat))
        self.zoo_keeper.get_children(foobar, watch=mox.IgnoreArg()).InAnyOrder()
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(('{}', None))
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(('{}', None))
        self.time_estimate_cache.get_graphite_data('/foo/bar').AndReturn({})

        self.mox.ReplayAll()

        cache._get_application_state(foobarhead)

        self.mox.VerifyAll()
    def test_get_application_state_eph0(self):

        path = "/foo/bar/head"
        test_unknown = '/test/Unknown'

        cache = self._create_app_state_cache()

        stat = StatMock()
        stat.ephemeralOwner = 0
        stat.last_modified = 0

        self.zoo_keeper.get(path, watch=mox.IgnoreArg()).InAnyOrder().AndReturn(("{}", stat))
        self.zoo_keeper.get_children(path, watch=mox.IgnoreArg()).InAnyOrder().AndReturn([])
        self.zoo_keeper.exists(test_unknown, watch=mox.IgnoreArg()).InAnyOrder()
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(('{}', None))
        self.zoo_keeper.get(self.configuration.override_node).AndReturn(('{}', None))
        self.time_estimate_cache.get_graphite_data('/foo/bar/head').AndReturn({})

        self.mox.ReplayAll()

        cache._get_application_state(path)

        self.mox.VerifyAll()