Merge "Ensure the test data sample has correct signature"

This commit is contained in:
Jenkins 2015-09-29 07:48:47 +00:00 committed by Gerrit Code Review
commit c4f0ce7163
2 changed files with 7 additions and 1 deletions

View File

@ -78,7 +78,7 @@ def make_test_data(name, meter_type, unit, volume, random_min,
user_id=user_id,
project_id=project_id,
resource_id=resource_id,
timestamp=timestamp,
timestamp=timestamp.isoformat(),
resource_metadata=resource_metadata,
source=source,
)

View File

@ -27,11 +27,13 @@ import random
import uuid
import make_test_data
from oslo_config import cfg
from oslo_context import context
import oslo_messaging
from six import moves
from ceilometer import messaging
from ceilometer.publisher import utils
from ceilometer import service
@ -79,6 +81,10 @@ def generate_data(send_batch, make_data_args, samples_count,
resource = resources_list[random.randint(0, len(resources_list) - 1)]
resource_samples[resource] += 1
sample['resource_id'] = resource
# need to recalculate signature because of the resource_id change
sig = utils.compute_signature(sample,
cfg.CONF.publisher.telemetry_secret)
sample['message_signature'] = sig
batch.append(sample)
if len(batch) == batch_size:
send_batch(topic, batch)