Esempio n. 1
0
    def test_fetch_with_data(self):
        create(self.SIMPLE_CREATE_ARGS)
        update_start = time_ref + 1
        for ts in range(update_start, update_start + 300, 10):
            update('/tmp/foo', '%i:100:200' % ts)

        ret = fetch(
            '/tmp/foo',
            'AVERAGE',
            '-s %i' % time_ref,
            '-e %i' % (time_ref + 400)
        )

        ref = (
            (1368278970, 1368279380, 10),
            (six.u('a'), six.u('b')),
            [
                (None, None), (100.0, 200.0), (100.0, 200.0), (100.0, 200.0),
                (100.0, 200.0), (100.0, 200.0), (100.0, 200.0), (100.0, 200.0),
                (100.0, 200.0), (100.0, 200.0), (100.0, 200.0), (100.0, 200.0),
                (100.0, 200.0), (100.0, 200.0), (100.0, 200.0), (100.0, 200.0),
                (100.0, 200.0), (100.0, 200.0), (100.0, 200.0), (100.0, 200.0),
                (100.0, 200.0), (100.0, 200.0), (100.0, 200.0), (100.0, 200.0),
                (100.0, 200.0), (100.0, 200.0), (100.0, 200.0), (100.0, 200.0),
                (100.0, 200.0), (100.0, 200.0), (None, None), (None, None),
                (None, None), (None, None), (None, None), (None, None),
                (None, None), (None, None), (None, None), (None, None),
                (None, None)
            ]
        )
        self.assertEqual(ref, ret)
Esempio n. 2
0
    def test_fetch_all_none(self):
        create(self.SIMPLE_CREATE_ARGS)
        ret = fetch(
            '/tmp/foo',
            'AVERAGE',
            '-s %i' % time_ref,
            '-e %i' % (time_ref + 200)
        )

        ref = (
            (1368278970, 1368279180, 10),
            (six.u('a'), six.u('b')),
            [
                (None, None), (None, None), (None, None), (None, None),
                (None, None), (None, None), (None, None), (None, None),
                (None, None), (None, None), (None, None), (None, None),
                (None, None), (None, None), (None, None), (None, None),
                (None, None), (None, None), (None, None), (None, None),
                (None, None)
            ]
        )

        self.assertEqual(ref, ret)