Merge "Correct the timestamp type when make test samples data"
This commit is contained in:
commit
9e65978154
@ -84,7 +84,9 @@ def make_test_data(name, meter_type, unit, volume, random_min,
|
|||||||
)
|
)
|
||||||
data = utils.meter_message_from_counter(
|
data = utils.meter_message_from_counter(
|
||||||
c, cfg.CONF.publisher.telemetry_secret)
|
c, cfg.CONF.publisher.telemetry_secret)
|
||||||
|
# timestamp should be string when calculating signature, but should be
|
||||||
|
# datetime object when calling record_metering_data.
|
||||||
|
data['timestamp'] = timestamp
|
||||||
yield data
|
yield data
|
||||||
n += 1
|
n += 1
|
||||||
timestamp = timestamp + increment
|
timestamp = timestamp + increment
|
||||||
|
@ -83,6 +83,10 @@ def generate_data(send_batch, make_data_args, samples_count,
|
|||||||
resource = resources_list[random.randint(0, len(resources_list) - 1)]
|
resource = resources_list[random.randint(0, len(resources_list) - 1)]
|
||||||
resource_samples[resource] += 1
|
resource_samples[resource] += 1
|
||||||
sample['resource_id'] = resource
|
sample['resource_id'] = resource
|
||||||
|
# need to change the timestamp from datetime.datetime type to iso
|
||||||
|
# format (unicode type), because collector will change iso format
|
||||||
|
# timestamp to datetime.datetime type before recording to db.
|
||||||
|
sample['timestamp'] = sample['timestamp'].isoformat()
|
||||||
# need to recalculate signature because of the resource_id change
|
# need to recalculate signature because of the resource_id change
|
||||||
sig = utils.compute_signature(sample,
|
sig = utils.compute_signature(sample,
|
||||||
cfg.CONF.publisher.telemetry_secret)
|
cfg.CONF.publisher.telemetry_secret)
|
||||||
|
Loading…
Reference in New Issue
Block a user