Add kitchen tests + travis ci
- add dependencies, req. for CI (make test)
- spec. mysql version per platform
- keystone client to create endpoints
diff --git a/tests/pillar/apache_wsgi.sls b/tests/pillar/apache_wsgi.sls
new file mode 100644
index 0000000..e518a61
--- /dev/null
+++ b/tests/pillar/apache_wsgi.sls
@@ -0,0 +1,182 @@
+
+keystone:
+# Server state
+  server:
+    enabled: true
+    version: liberty
+    service_name: apache2
+    service_token: RANDOMSTRINGTOKEN
+    service_tenant: service
+    admin_tenant: admin
+    admin_name: admin
+    admin_password: passw0rd
+    admin_email: root@localhost
+    bind:
+      address: 0.0.0.0
+      private_address: 127.0.0.1
+      private_port: 35357
+      public_address: 127.0.0.1
+      public_port: 5000
+    region: RegionOne
+    database:
+      engine: mysql
+      host: localhost
+      name: keystone
+      password: passw0rd
+      user: keystone
+    tokens:
+      engine: cache
+      expiration: 86400
+      location: /etc/keystone/fernet-keys/
+    notification: false
+    notification_format: cadf
+    #message_queue:
+      #engine: rabbitmq
+      #host: 127.0.0.1
+      #port: 5672
+      #user: openstack
+      #password: password
+      #virtual_host: '/openstack'
+      #ha_queues: true
+# Client state
+  client:
+    enabled: false
+    server:
+      identity:
+        admin:
+          host: localhost
+          port: 35357
+          token: RANDOMSTRINGTOKEN
+        roles:
+        - admin
+        - Member
+        project:
+          service:
+            description: "OpenStack Service tenant"
+          admin:
+            description: "OpenStack Admin tenant"
+            user:
+              admin:
+                is_admin: true
+                password: passw0rd
+                email: admin@localhost
+        service:
+          keystone3:
+            type: identity
+            description: OpenStack Identity Service v3
+            endpoints:
+            - region: RegionOne
+              public_address: keystone
+              public_protocol: http
+              public_port: 5000
+              public_path: '/v3'
+              internal_address: keystone
+              internal_port: 5000
+              internal_path: '/v3'
+              admin_address: keystone
+              admin_port: 35357
+              admin_path: '/v3'
+          keystone:
+            type: identity
+            description: OpenStack Identity Service
+            endpoints:
+            - region: RegionOne
+              public_address: keystone
+              public_protocol: http
+              public_port: 5000
+              public_path: '/v2.0'
+              internal_address: keystone
+              internal_port: 5000
+              internal_path: '/v2.0'
+              admin_address: keystone
+              admin_port: 35357
+              admin_path: '/v2.0'
+          #keystone3:
+            #name: keystone3
+            #type: identity
+            #description: OpenStack Identity Service v3
+            #endpoints:
+            #- region: RegionTwo
+              #public_address: keystone
+              #public_protocol: http
+              #public_port: 5000
+              #public_path: '/v3'
+              #internal_address: keystone
+              #internal_port: 5000
+              #internal_path: '/v3'
+              #admin_address: keystone
+              #admin_port: 35357
+              #admin_path: '/v3'
+          #keystone:
+            #name: keystone
+            #type: identity
+            #description: OpenStack Identity Service
+            #endpoints:
+            #- region: RegionTwo
+              #public_address: keystone
+              #public_protocol: http
+              #public_port: 5000
+              #public_path: '/v2.0'
+              #internal_address: keystone
+              #internal_port: 5000
+              #internal_path: '/v2.0'
+              #admin_address: keystone
+              #admin_port: 35357
+              #admin_path: '/v2.0'
+# CI related dependencies
+apache:
+  server:
+    enabled: true
+    default_mpm: event
+    mpm:
+      prefork:
+        enabled: true
+        servers:
+          start: 5
+          spare:
+            min: 2
+            max: 10
+        max_requests: 0
+        max_clients: 20
+        limit: 20
+    site:
+      keystone:
+        enabled: true
+        type: keystone
+        name: wsgi
+        host:
+          name: localhost
+    pkgs:
+      - apache2
+    modules:
+      - wsgi
+mysql:
+  client:
+    enabled: true
+    version: '5.7'
+    admin:
+      host: localhost
+      port: 3306
+      user: admin
+      password: password
+      encoding: utf8
+  server:
+    enabled: true
+    version: "5.7"
+    force_encoding: utf8
+    bind:
+      address: 0.0.0.0
+      port: 3306
+      protocol: tcp
+    database:
+      keystone:
+        encoding: utf8
+        users:
+        - host: '%'
+          name: keystone
+          password: passw0rd
+          rights: all
+        - host: 127.0.0.1
+          name: keystone
+          password: passw0rd
+          rights: all
diff --git a/tests/pillar/cluster.sls b/tests/pillar/cluster.sls
index d3538b9..898b6ae 100644
--- a/tests/pillar/cluster.sls
+++ b/tests/pillar/cluster.sls
@@ -6,10 +6,10 @@
     service_tenant: service
     admin_tenant: admin
     admin_name: admin
-    admin_password: password
-    admin_email: root@domain.com
+    admin_password: passw0rd
+    admin_email: root@localhost
     bind:
-      address: 127.0.0.1
+      address: 0.0.0.0
       private_address: 127.0.0.1
       private_port: 35357
       public_address: 127.0.0.1
@@ -19,20 +19,20 @@
       engine: mysql
       host: 127.0.0.1
       name: keystone
-      password: password
+      password: passw0rd
       user: keystone
     tokens:
       engine: cache
       expiration: 86400
       location: /etc/keystone/fernet-keys/
-    notification: true
+    notification: false
     notification_format: cadf
     message_queue:
       engine: rabbitmq
       host: 127.0.0.1
       port: 5672
       user: openstack
-      password: password
+      password: passw0rd
       virtual_host: '/openstack'
       ha_queues: true
     cache:
diff --git a/tests/pillar/repo_mos9.sls b/tests/pillar/repo_mos9.sls
new file mode 100644
index 0000000..64d75b8
--- /dev/null
+++ b/tests/pillar/repo_mos9.sls
@@ -0,0 +1,8 @@
+linux:
+  system:
+    enabled: true
+    repo:
+      mirantis_openstack:
+        source: "deb [arch=amd64] http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0/ mos9.0 main restricted"
+        architectures: amd64
+        key_url: "http://mirror.fuel-infra.org/mos-repos/ubuntu/9.0/archive-mos9.0.key"
diff --git a/tests/pillar/single.sls b/tests/pillar/single.sls
index 3e7c49d..e2721d3 100644
--- a/tests/pillar/single.sls
+++ b/tests/pillar/single.sls
@@ -1,12 +1,13 @@
 keystone:
+# Server state
   server:
     enabled: true
     version: liberty
-    service_token: token
+    service_token: RANDOMSTRINGTOKEN
     service_tenant: service
     admin_tenant: admin
     admin_name: admin
-    admin_password: password
+    admin_password: passw0rd
     admin_email: root@localhost
     bind:
       address: 0.0.0.0
@@ -17,25 +18,122 @@
     region: RegionOne
     database:
       engine: mysql
-      host: 'localhost'
-      name: 'keystone'
-      password: 'password'
-      user: 'keystone'
-    notification: true
-    message_queue:
-      engine: rabbitmq
-      host: 127.0.0.1
-      port: 5672
-      user: openstack
-      password: password
-      virtual_host: '/openstack'
-      ha_queues: true
+      host: localhost
+      name: keystone
+      password: passw0rd
+      user: keystone
     tokens:
       engine: cache
       expiration: 86400
       location: /etc/keystone/fernet-keys/
-    cache:
-      engine: memcached
-      members:
-      - host: localhost
-        port: 11211
+    notification: false
+    notification_format: cadf
+    #message_queue:
+      #engine: rabbitmq
+      #host: 127.0.0.1
+      #port: 5672
+      #user: openstack
+      #password: password
+      #virtual_host: '/openstack'
+      #ha_queues: true
+# Client state
+  client:
+    enabled: false
+    server:
+      identity:
+        admin:
+          host: localhost
+          port: 35357
+          token: RANDOMSTRINGTOKEN
+        roles:
+        - admin
+        - Member
+        project:
+          service:
+            description: "OpenStack Service tenant"
+          admin:
+            description: "OpenStack Admin tenant"
+            user:
+              admin:
+                is_admin: true
+                password: passw0rd
+                email: admin@localhost
+        service:
+          keystone3:
+            type: identity
+            description: OpenStack Identity Service v3
+            endpoints:
+            - region: RegionOne
+              public_address: keystone
+              public_protocol: http
+              public_port: 5000
+              public_path: '/v3'
+              internal_address: keystone
+              internal_port: 5000
+              internal_path: '/v3'
+              admin_address: keystone
+              admin_port: 35357
+              admin_path: '/v3'
+          keystone:
+            type: identity
+            description: OpenStack Identity Service
+            endpoints:
+            - region: RegionOne
+              public_address: keystone
+              public_protocol: http
+              public_port: 5000
+              public_path: '/v2.0'
+              internal_address: keystone
+              internal_port: 5000
+              internal_path: '/v2.0'
+              admin_address: keystone
+              admin_port: 35357
+              admin_path: '/v2.0'
+          # TODO: enable once salt keystone module/states are fixed
+          #keystoneR2:
+            #service: keystone
+            #type: identity
+            #description: OpenStack Identity Service
+            #endpoints:
+            #- region: RegionTwo
+              #public_address: keystone
+              #public_protocol: http
+              #public_port: 5000
+              #public_path: '/v2.0'
+              #internal_address: keystone
+              #internal_port: 5000
+              #internal_path: '/v2.0'
+              #admin_address: keystone
+              #admin_port: 35357
+              #admin_path: '/v2.0'
+# CI related dependencies
+mysql:
+  client:
+    enabled: true
+    version: '5.7'
+    admin:
+      host: localhost
+      port: 3306
+      user: admin
+      password: password
+      encoding: utf8
+  server:
+    enabled: true
+    version: "5.7"
+    force_encoding: utf8
+    bind:
+      address: 0.0.0.0
+      port: 3306
+      protocol: tcp
+    database:
+      keystone:
+        encoding: utf8
+        users:
+        - host: '%'
+          name: keystone
+          password: passw0rd
+          rights: all
+        - host: 127.0.0.1
+          name: keystone
+          password: passw0rd
+          rights: all
diff --git a/tests/pillar/single_fernet.sls b/tests/pillar/single_fernet.sls
index 7077876..90c0dc1 100644
--- a/tests/pillar/single_fernet.sls
+++ b/tests/pillar/single_fernet.sls
@@ -6,7 +6,7 @@
     service_tenant: service
     admin_tenant: admin
     admin_name: admin
-    admin_password: password
+    admin_password: passw0rd
     admin_email: root@localhost
     bind:
       address: 0.0.0.0
@@ -17,17 +17,45 @@
     region: RegionOne
     database:
       engine: mysql
-      host: 'localhost'
-      name: 'keystone'
-      password: 'password'
-      user: 'keystone'
+      host: localhost
+      name: keystone
+      password: passw0rd
+      user: keystone
     tokens:
       engine: fernet
       expiration: 86400
       location: /etc/keystone/fernet-keys/
       max_active_keys: 4
-    cache:
-      engine: memcached
-      members:
-      - host: localhost
-        port: 11211
+    notification: false
+    notification_format: cadf
+# CI related dependencies
+mysql:
+  client:
+    enabled: false
+    version: '5.7'
+    admin:
+      host: localhost
+      port: 3306
+      user: admin
+      password: password
+      encoding: utf8
+  server:
+    enabled: true
+    version: "5.7"
+    force_encoding: utf8
+    bind:
+      address: 0.0.0.0
+      port: 3306
+      protocol: tcp
+    database:
+      keystone:
+        encoding: utf8
+        users:
+        - host: '%'
+          name: keystone
+          password: passw0rd
+          rights: all
+        - host: 127.0.0.1
+          name: keystone
+          password: passw0rd
+          rights: all
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 8c07e58..f44058c 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -44,6 +44,7 @@
     [ ! -d ${SALT_PILLAR_DIR} ] && mkdir -p ${SALT_PILLAR_DIR}
     echo "base:" > ${SALT_PILLAR_DIR}/top.sls
     for pillar in ${PILLARDIR}/*; do
+        grep ${FORMULA_NAME}: ${pillar} &>/dev/null || continue
         state_name=$(basename ${pillar%.sls})
         echo -e "  ${state_name}:\n    - ${state_name}" >> ${SALT_PILLAR_DIR}/top.sls
     done
@@ -56,6 +57,7 @@
 
     echo "base:" > ${SALT_FILE_DIR}/top.sls
     for pillar in ${PILLARDIR}/*.sls; do
+        grep ${FORMULA_NAME}: ${pillar} &>/dev/null || continue
         state_name=$(basename ${pillar%.sls})
         echo -e "  ${state_name}:\n    - ${FORMULA_NAME}" >> ${SALT_FILE_DIR}/top.sls
     done
@@ -126,6 +128,7 @@
 
 run() {
     for pillar in ${PILLARDIR}/*.sls; do
+        grep ${FORMULA_NAME}: ${pillar} &>/dev/null || continue
         state_name=$(basename ${pillar%.sls})
         salt_run --id=${state_name} state.show_sls ${FORMULA_NAME} || (log_err "Execution of ${FORMULA_NAME}.${state_name} failed"; exit 1)
     done
@@ -144,20 +147,22 @@
 }
 
 ## Main
-trap _atexit INT TERM EXIT
+[[ "$0" != "$BASH_SOURCE"  ]] || {
+  trap _atexit INT TERM EXIT
 
-case $1 in
-    clean)
-        clean
-        ;;
-    prepare)
-        prepare
-        ;;
-    run)
-        run
-        ;;
-    *)
-        prepare
-        run
-        ;;
-esac
+  case $1 in
+      clean)
+          clean
+          ;;
+      prepare)
+          prepare
+          ;;
+      run)
+          run
+          ;;
+      *)
+          prepare
+          run
+          ;;
+  esac
+}