예제 #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)
예제 #2
0
    def test_last(self):
        create(self.SIMPLE_CREATE_ARGS)
        self.assertEqual(time_ref, last('/tmp/foo'))

        update_start = time_ref + 1
        for ts in range(update_start, update_start + 300, 10):
            update('/tmp/foo', '%i:100:200' % ts)

        self.assertEqual(ts, last('/tmp/foo'))
예제 #3
0
 def test_update(self):
     create(self.SIMPLE_CREATE_ARGS)
     for i in range(1, 100):
         update('/tmp/foo', '%i:%i:%i' % (time_ref + i, i, i))