Esempio n. 1
0
    def testQueryLastEmittedNonMetricSequence(self, collectorsdbMock):
        collectorsdbMock.engineFactory.return_value = Mock(
            spec_set=sqlalchemy.engine.Engine)

        metric_utils.queryLastEmittedNonMetricSequence("twitter-tweets-volume")

        args, _ = (collectorsdbMock.engineFactory.return_value.execute.
                   call_args_list[0])
        self.assertTrue(args)
        self.assertIsInstance(args[0], sqlalchemy.sql.Select)
Esempio n. 2
0
  def testQueryLastEmittedNonMetricSequence(self, collectorsdbMock):
    collectorsdbMock.engineFactory.return_value = Mock(
      spec_set=sqlalchemy.engine.Engine)

    metric_utils.queryLastEmittedNonMetricSequence("twitter-tweets-volume")

    args, _ = (collectorsdbMock
               .engineFactory
               .return_value
               .execute
               .call_args_list[0])
    self.assertTrue(args)
    self.assertIsInstance(args[0], sqlalchemy.sql.Select)
Esempio n. 3
0
    def testEmittedNonMetricSequence(self):
        key = "bogus-test-key"

        metric_utils.updateLastEmittedNonMetricSequence(key, 1)

        # Cleanup
        self.addCleanup(
            collectorsdb.engineFactory().execute,
            schema.emittedNonMetricTracker.delete().where(
                (schema.emittedNonMetricTracker.c.key == key)))

        lastEmittedSample = metric_utils.queryLastEmittedNonMetricSequence(key)

        self.assertEqual(1, lastEmittedSample)
  def testEmittedNonMetricSequence(self):
    key = "bogus-test-key"

    metric_utils.updateLastEmittedNonMetricSequence(key, 1)

    # Cleanup
    self.addCleanup(collectorsdb.engineFactory().execute,
      schema.emittedNonMetricTracker.delete().where(
        (schema.emittedNonMetricTracker.c.key == key)
      )
    )

    lastEmittedSample = metric_utils.queryLastEmittedNonMetricSequence(key)

    self.assertEqual(1, lastEmittedSample)