Merge "Ensure the test data sample has correct signature"
This commit is contained in:
commit
c4f0ce7163
@ -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,
|
||||
)
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user