summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-10-22 10:33:54 +0000
committerGerrit Code Review <review@openstack.org>2015-10-22 10:33:54 +0000
commit9e65978154e85d19248640c3ca7aaa32443ca489 (patch)
tree57a87eca2a9d13f42f55c81699cefdaf163b3d1e /tools
parentd76aef533cc933c9d2e0beba3048a496e69b9051 (diff)
parent2c1227e09d7cedd9f10b21d0c8f18b2ebd03432f (diff)
downloadceilometer-9e65978154e85d19248640c3ca7aaa32443ca489.tar.gz
Merge "Correct the timestamp type when make test samples data"
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make_test_data.py4
-rwxr-xr-xtools/send_test_data.py4
2 files changed, 7 insertions, 1 deletions
diff --git a/tools/make_test_data.py b/tools/make_test_data.py
index d99650c1..fd2a5995 100755
--- a/tools/make_test_data.py
+++ b/tools/make_test_data.py
@@ -84,7 +84,9 @@ def make_test_data(name, meter_type, unit, volume, random_min,
)
data = utils.meter_message_from_counter(
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
n += 1
timestamp = timestamp + increment
diff --git a/tools/send_test_data.py b/tools/send_test_data.py
index d401f80c..ed9b9f59 100755
--- a/tools/send_test_data.py
+++ b/tools/send_test_data.py
@@ -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_samples[resource] += 1
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
sig = utils.compute_signature(sample,
cfg.CONF.publisher.telemetry_secret)