Skip to content
Snippets Groups Projects
Commit b6095b54 authored by Daniele Belfiore's avatar Daniele Belfiore
Browse files

Added mock server response for the tests

parent b0bfc8a5
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import json
import math
import os
import sys
import random
def main():
with open('response-mock.json') as response:
res_json = json.load(response)
res_json[0]['counter_volume'] = random.uniform(0, 100)
print res_json[0]['counter_volume']
if __name__ == "__main__":
main()
#!/bin/bash
python ceilometer-mock $1 $2
[{"counter_name": "cpu_util", "user_id": "b1e70ae6566f4f389facfb8b814b3946", "resource_id": "b052fb50-9af3-4685-91c1-d9bf7df9952c", "timestamp": "2015-10-16T12:33:44", "counter_volume": 1.0616666666666665, "resource_metadata": {"ramdisk_id": "None", "flavor.vcpus": "1", "OS-EXT-AZ.availability_zone": "nova", "display_name": "monitoring-pillar", "flavor.id": "fdcb55b1-a13b-4d19-a558-1602a503c144", "status": "active", "ephemeral_gb": "0", "flavor.name": "m1.small", "disk_gb": "10", "kernel_id": "None", "image.id": "50cf7aca-873a-4ef2-8679-24b2ff07c016", "flavor.ram": "2048", "host": "71d50feed4b57198642288ea3cc64a4a4dfd884088ceb01744e1efb1", "flavor.ephemeral": "0", "image.name": "ubuntu_basic_setup_pg_cloud", "image_ref_url": "http://192.168.10.22:8774/4e51f2818dda4e549345de79f421eb32/images/50cf7aca-873a-4ef2-8679-24b2ff07c016", "image.links": "[{'href': 'http://192.168.10.22:8774/4e51f2818dda4e549345de79f421eb32/images/50cf7aca-873a-4ef2-8679-24b2ff07c016', 'rel': 'bookmark'}]", "cpu_number": "1", "flavor.disk": "10", "root_gb": "10", "name": "instance-00000050", "memory_mb": "2048", "instance_type": "fdcb55b1-a13b-4d19-a558-1602a503c144", "vcpus": "1", "image_ref": "50cf7aca-873a-4ef2-8679-24b2ff07c016", "flavor.links": "[{'href': 'http://192.168.10.22:8774/4e51f2818dda4e549345de79f421eb32/flavors/fdcb55b1-a13b-4d19-a558-1602a503c144', 'rel': 'bookmark'}]"}, "source": "openstack", "counter_unit": "%", "recorded_at": "2015-10-16T12:33:44.056000", "project_id": "ea26dfda4a1c43a79c94a0720510c308", "message_id": "2392214e-7402-11e5-9e9e-00215af526d6", "counter_type": "gauge"}]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment