예제 #1
0
    def test_process_prevents_infinite_loops(self):
        c = Configuration()
        c._aggregates = mock()
        c._schemas = [mock()]

        expect(c._aggregates.match).args('stat_1').returns(['stat_2']).times(1)
        expect(c._aggregates.match).args('stat_2').returns(['stat_1']).times(1)
        expect(c._schemas[0].store).times(2)

        c.process('stat_1', 'value', 'now')
예제 #2
0
  'join_rows' : lambda rows: sum(rows),
  'collapse' : True,
}

# insert some test data, 2 hours in 30 second intervals
for schema in config._schemas:
  schema.timeseries.delete( 'foo' )
  schema.timeseries.delete( 'foo.bar' )
  schema.timeseries.delete( 'foo.bor' )
  schema.timeseries.delete( 'foo.bar.cat' )
  schema.timeseries.delete( 'foo.bor.cat' )
  schema.timeseries.delete( 'foo.bar.dog' )

t = time.time() - 7200
for x in xrange(0,7200,30):
  config.process( 'foo.bar.cat', x/15, t+x )
  config.process( 'foo.bor.cat', x/15, t+x )
  config.process( 'foo.bar.dog', x/15, t+x )

web = Web(configuration=config)

# It would be nice to spin up the web server here and make requests against it

class WebTest(Chai):

  def setUp(self):
    super(WebTest,self).setUp()

  def _request(self, request):
    '''
    Helper to make a request and confirm that it can be encoded. Needed
예제 #3
0
    'join_rows': lambda rows: sum(rows),
    'collapse': True,
}

# insert some test data, 2 hours in 30 second intervals
for schema in config._schemas:
    schema.timeseries.delete('foo')
    schema.timeseries.delete('foo.bar')
    schema.timeseries.delete('foo.bor')
    schema.timeseries.delete('foo.bar.cat')
    schema.timeseries.delete('foo.bor.cat')
    schema.timeseries.delete('foo.bar.dog')

t = time.time() - 7200
for x in xrange(0, 7200, 30):
    config.process('foo.bar.cat', x / 15, t + x)
    config.process('foo.bor.cat', x / 15, t + x)
    config.process('foo.bar.dog', x / 15, t + x)

web = Web(configuration=config)

# It would be nice to spin up the web server here and make requests against it


class WebTest(Chai):
    def setUp(self):
        super(WebTest, self).setUp()

    def _request(self, request):
        '''
    Helper to make a request and confirm that it can be encoded. Needed