Fixed firewalld-related code in test script
[openstack-build/ceilometer-build.git] / tests / runtests.sh
index 4604350e0a453c8cb61fa61572c1703a83cdf7b6..163281e1223f5c76c3e6e3f8b76d7679f80d082c 100755 (executable)
@@ -58,7 +58,8 @@ if [[ `cat /etc/*-release | head -n 1 | awk '{print $1}'` =~ Ubuntu ]]; then
      policy.json
    )
 else
-   setenforce 0 && service firewalld stop
+   setenforce 0 || :
+   service firewalld stop || :
    os="centos"
    packages_list="python-pip curl"
    command_to_install="yum install -y"
@@ -162,8 +163,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 +252,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 +345,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' \