A little refactor and fix for fake notification
[openstack-build/ceilometer-build.git] / tests / runtests.sh
index 4604350e0a453c8cb61fa61572c1703a83cdf7b6..6c3cb7ba4c36c2add3903eab5908a83416624a54 100755 (executable)
@@ -162,8 +162,6 @@ install_and_setup_mysql() {
      ${command_to_install} mysql-client mysql-server mysql-libs MySQL-python
      MYSQL_PASSWORD=$(cat /root/.mysql_secret | head -1 | awk -F': ' '{print $2}')
    fi
-   mycnf=$(find /etc/ -name my.cnf)
-   cat $mycnf
    service mysql restart
    sleep 10
    if [ ! -z "${MYSQL_PASSWORD}" ]; then
@@ -253,10 +251,11 @@ send_fake_instance_notification() {
    pip install pika==0.9.8
    echo '#!/usr/bin/env python
 import pika
+import uuid
 connection = pika.BlockingConnection(pika.ConnectionParameters(host="127.0.0.1"))
 channel = connection.channel()
 channel.queue_declare(queue="notifications.info")
-test=r'"'"'{"event_type": "compute.instance.update", "_unique_id": "fake", "payload": {"ephemeral_gb": 0, "instance_id": "fake", "user_id": "fake", "root_gb": 0, "tenant_id": "fake", "memory_mb": 64, "vcpus": 1}, "priority": "INFO"}'"'"'
+test='"'"'{"event_type": "compute.instance.create", "payload": {"instance_id": "fake", "memory_mb": 512, "disk_gb": 20, "root_gb": 20, "ephemeral_gb": 0, "vcpus": 1, "instance_type_id": 1, "state": "fake"}, "publisher_id": "fake", "priority":"INFO", "message_id": "%s"}'"'"' % uuid.uuid4()
 channel.basic_publish(exchange="nova", routing_key="notifications.info",
                       properties=pika.BasicProperties(priority=0, delivery_mode=2, headers="", content_encoding="utf-8", content_type="application/json"),
                       body=test)
@@ -345,9 +344,9 @@ case ${package_to_test} in
       fi
 
       # Events
-      #if [ -z "$(ceilometer ${ceilometer_auth_string} event-list | grep fake)" ]; then
-      #   exit_on_error 1 "Events wasn't created"
-      #fi
+      if [ -z "$(ceilometer ${ceilometer_auth_string} event-list | grep fake)" ]; then
+         exit_on_error 1 "Events wasn't created"
+      fi
 
       # Alarming
       ceilometer -dv ${ceilometer_auth_string} alarm-threshold-create --name cpu_high --description 'instance running hot' \