Exemplo n.º 1
0
    def test_recurse_timeout_error(self):
        url = self.get_url("/timeout")
        f = self.http_client.fetch(self.get_url("/recurse_timeout"),
                                   self.stop,
                                   body=url,
                                   method="POST",
                                   request_timeout=1.5)
        resp = self.wait()

        #for ctx_id in self.log_ctx:
        #print ctx_id
        #for ctx in self.log_ctx[ctx_id]:
        #pprint.pprint(ctx.to_dict())

        assert_equal(resp.code, 200)
        assert_equal(resp.body, "got it")

        found_timeout = False
        found_request = False
        for ctx_list in self.log_ctx.values():
            for ctx in ctx_list:
                c = ctx.to_dict()
                if c['type'] == 'request.httpclient' and c['body']['response'][
                        'code'] == 599:
                    found_timeout = True

                if c['type'] == 'request' and get_deep(c, 'body.start'):
                    assert get_deep(c, 'body.end')
                    found_request = True

        assert found_timeout
        assert found_request
Exemplo n.º 2
0
    def test_recurse_timeout_error(self):
        url = self.get_url("/timeout")
        f = self.http_client.fetch(self.get_url("/recurse_timeout"), self.stop,
                                   body=url,
                                   method="POST",
                                   request_timeout=1.5)
        resp = self.wait()

        #for ctx_id in self.log_ctx:
            #print ctx_id
            #for ctx in self.log_ctx[ctx_id]:
                #pprint.pprint(ctx.to_dict())

        assert_equal(resp.code, 200)
        assert_equal(resp.body, "got it")

        found_timeout = False
        found_request = False
        for ctx_list in self.log_ctx.values():
            for ctx in ctx_list:
                c = ctx.to_dict()
                if c['type'] == 'request.httpclient' and c['body']['response']['code'] == 599:
                    found_timeout = True

                if c['type'] == 'request' and get_deep(c, 'body.start'):
                    assert get_deep(c, 'body.end')
                    found_request = True

        assert found_timeout
        assert found_request
Exemplo n.º 3
0
    def test_timeout_error(self):
        f = self.http_client.fetch(self.get_url("/timeout"), self.stop, request_timeout=0.5)
        resp = self.wait()

        #for ctx_id in self.log_ctx:
            #print ctx_id
            #for ctx in self.log_ctx[ctx_id]:
                #pprint.pprint(ctx.to_dict())

        assert_equal(len(self.log_ctx), 1)
        ctx = self.log_ctx[self.log_ctx.keys()[0]][0]
        assert_equal(get_deep(ctx.to_dict(), 'body.response.code'), 599)
Exemplo n.º 4
0
    def test(self):
        with self.context:
            self.context.set('foo', True)
            self.context.set('bar.baz', 10.0)

        event_meta, raw_data = self.server.recv_multipart()
        network.check_meta_version(event_meta)
        _, event_time, event_host, event_type = struct.unpack(network.META_STRUCT_FMT, event_meta)
        assert_equal(event_type, 'test')

        data = msgpack.unpackb(raw_data)
        assert_equal(data['id'], 1)
        assert_equal(data['type'], 'test')
        assert_equal(utils.get_deep(data['body'], "bar.baz"), 10.0)
Exemplo n.º 5
0
    def test_timeout_error(self):
        f = self.http_client.fetch(self.get_url("/timeout"),
                                   self.stop,
                                   request_timeout=0.5)
        resp = self.wait()

        #for ctx_id in self.log_ctx:
        #print ctx_id
        #for ctx in self.log_ctx[ctx_id]:
        #pprint.pprint(ctx.to_dict())

        assert_equal(len(self.log_ctx), 1)
        ctx = self.log_ctx[self.log_ctx.keys()[0]][0]
        assert_equal(get_deep(ctx.to_dict(), 'body.response.code'), 599)
Exemplo n.º 6
0
    def test(self):
        with self.context:
            self.context.set('foo', True)
            self.context.set('bar.baz', 10.0)

        event_meta, raw_data = self.server.recv_multipart()
        network.check_meta_version(event_meta)
        _, event_time, event_host, event_type = struct.unpack(
            network.META_STRUCT_FMT, event_meta)
        assert_equal(event_type, 'test')

        data = msgpack.unpackb(raw_data)
        assert_equal(data['id'], 1)
        assert_equal(data['type'], 'test')
        assert_equal(utils.get_deep(data['body'], "bar.baz"), 10.0)
Exemplo n.º 7
0
 def test_found(self):
     """verify we can find an indexed value"""
     assert_equal(utils.get_deep(self.value, 'foo.0.bar'), True)
Exemplo n.º 8
0
 def test_default(self):
     """verify we can handle a missing deep value"""
     assert_equal(utils.get_deep(self.value, 'foo.zoo', 5), 5)
Exemplo n.º 9
0
 def test_default(self):
     """verify we can handle simple miss for a shallow value"""
     assert_equal(utils.get_deep(self.value, 'bar', 5), 5)
Exemplo n.º 10
0
 def test_found(self):
     """verify we can find a shallow value"""
     assert_equal(utils.get_deep(self.value, 'foo'), True)
Exemplo n.º 11
0
 def test_default(self):
     """verify we can handle simple miss for a shallow value"""
     assert_equal(utils.get_deep(self.value, "bar", 5), 5)
Exemplo n.º 12
0
 def test(self):
     """verify we can set a shallow value"""
     assert_equal(utils.get_deep(self.value, "foo"), True)
Exemplo n.º 13
0
 def test_default(self):
     """verify a missing indexed value works"""
     assert_equal(utils.get_deep(self.value, "foo.1.bar", 5), 5)
Exemplo n.º 14
0
 def test_found(self):
     """verify we can find an indexed value"""
     assert_equal(utils.get_deep(self.value, "foo.0.bar"), True)
Exemplo n.º 15
0
 def test_default(self):
     """verify we can handle a missing deep value"""
     assert_equal(utils.get_deep(self.value, "foo.zoo", 5), 5)
Exemplo n.º 16
0
 def test_default(self):
     """verify a missing indexed value works"""
     assert_equal(utils.get_deep(self.value, 'foo.1.bar', 5), 5)
Exemplo n.º 17
0
 def test(self):
     """verify we can set a shallow value"""
     assert_equal(utils.get_deep(self.value, 'foo'), True)
Exemplo n.º 18
0
 def test_found(self):
     """verify we can find a shallow value"""
     assert_equal(utils.get_deep(self.value, "foo"), True)