Fix tests broken by API change with Counter class

A previous change moved the "source" field from the
Counter to the function that creates meter messages.
These tests are not run in the CI environment because
they depend on having spidermonkey installed, and it
is not available on that server.

Change-Id: I1e34ce087ae56bc18875ebe28b9cdf48ce8f493c
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
Doug Hellmann 2012-10-26 12:43:01 -04:00
parent acf8fb88d5
commit d72d3a9e17
5 changed files with 26 additions and 16 deletions

View File

@ -37,7 +37,6 @@ class TestMaxProjectVolume(tests_api.TestBase):
self.counters = []
for i in range(3):
c = counter.Counter(
'source1',
'volume.size',
'gauge',
5 + i,
@ -50,7 +49,10 @@ class TestMaxProjectVolume(tests_api.TestBase):
}
)
self.counters.append(c)
msg = meter.meter_message_from_counter(c, cfg.CONF.metering_secret)
msg = meter.meter_message_from_counter(c,
cfg.CONF.metering_secret,
'source1',
)
self.conn.record_metering_data(msg)
def test_no_time_bounds(self):

View File

@ -37,7 +37,6 @@ class TestMaxResourceVolume(tests_api.TestBase):
self.counters = []
for i in range(3):
c = counter.Counter(
'source1',
'volume.size',
'gauge',
5 + i,
@ -50,7 +49,10 @@ class TestMaxResourceVolume(tests_api.TestBase):
}
)
self.counters.append(c)
msg = meter.meter_message_from_counter(c, cfg.CONF.metering_secret)
msg = meter.meter_message_from_counter(c,
cfg.CONF.metering_secret,
'source1',
)
self.conn.record_metering_data(msg)
def test_no_time_bounds(self):

View File

@ -37,7 +37,6 @@ class TestSumProjectVolume(tests_api.TestBase):
self.counters = []
for i in range(3):
c = counter.Counter(
'source1',
'volume.size',
'gauge',
5 + i,
@ -50,7 +49,10 @@ class TestSumProjectVolume(tests_api.TestBase):
}
)
self.counters.append(c)
msg = meter.meter_message_from_counter(c, cfg.CONF.metering_secret)
msg = meter.meter_message_from_counter(c,
cfg.CONF.metering_secret,
'source1',
)
self.conn.record_metering_data(msg)
def test_no_time_bounds(self):

View File

@ -37,7 +37,6 @@ class TestSumResourceVolume(tests_api.TestBase):
self.counters = []
for i in range(3):
c = counter.Counter(
'source1',
'volume.size',
'gauge',
5 + i,
@ -50,7 +49,10 @@ class TestSumResourceVolume(tests_api.TestBase):
}
)
self.counters.append(c)
msg = meter.meter_message_from_counter(c, cfg.CONF.metering_secret)
msg = meter.meter_message_from_counter(c,
cfg.CONF.metering_secret,
'source1',
)
self.conn.record_metering_data(msg)
def test_no_time_bounds(self):

View File

@ -430,18 +430,20 @@ class TestGetEventInterval(MongoDBEngineTestBase):
def _make_events(self, *timestamps):
for t in timestamps:
c = counter.Counter(
'test',
'instance',
counter.TYPE_CUMULATIVE,
1,
'user-id',
'project-id',
'resource-id',
name='instance',
type=counter.TYPE_CUMULATIVE,
volume=1,
user_id='user-id',
project_id='project-id',
resource_id='resource-id',
timestamp=t,
resource_metadata={'display_name': 'test-server',
}
)
msg = meter.meter_message_from_counter(c, 'not-so-secret')
msg = meter.meter_message_from_counter(counter=c,
secret='not-so-secret',
source='test',
)
self.conn.record_metering_data(msg)
def test_before_range(self):