Add kitchen tests

- add .kitchen.yml
- add .gitignore

Related PROD-27780 (PROD:27780)

Change-Id: I9b026d21f71d302783068e4275f83af7401bdc77
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..aa8e42a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.kitchen
+tests/build/
+*.swp
+*.pyc
+.ropeproject
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..cc102a7
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,73 @@
+---
+driver:
+  name: docker
+  hostname: xtrabackup.ci.local
+  use_sudo: false
+
+provisioner:
+  name: salt_solo
+  salt_install: bootstrap
+  salt_bootstrap_url: https://bootstrap.saltstack.com
+  salt_version: latest
+  require_chef: false
+  log_level: error
+  formula: xtrabackup
+  grains:
+    noservices: True
+  state_top:
+    base:
+      "*":
+        - xtrabackup
+  pillars:
+    top.sls:
+      base:
+        "*":
+          - xtrabackup
+
+verifier:
+  name: inspec
+  sudo: true
+
+docker_images:
+  - &xenial-20177 <%=ENV['IMAGE_XENIAL_20177'] || 'docker-dev-local.docker.mirantis.net/epcim/salt/saltstack-ubuntu-xenial-salt-2017.7/salt:2018_11_19'%>
+  - &xenial-stable <%=ENV['IMAGE_XENIAL_STABLE'] || 'docker-dev-local.docker.mirantis.net/epcim/salt/saltstack-ubuntu-xenial-salt-stable/salt:2018_11_19'%>
+
+platforms:
+  - name: xenial-2017.7
+    driver_config:
+      image: *xenial-20177
+      platform: ubuntu
+
+  - name: xenial-stable
+    driver_config:
+      image: *xenial-stable
+      platform: ubuntu
+
+
+
+suites:
+
+  - name: client_backup_times
+    provisioner:
+      pillars-from-files:
+        xtrabackup.sls: tests/pillar/client_backup_times.sls
+
+  - name: client
+    provisioner:
+      pillars-from-files:
+        xtrabackup.sls: tests/pillar/client.sls
+
+  - name: client_using_tcp
+    provisioner:
+      pillars-from-files:
+        xtrabackup.sls: tests/pillar/client_using_tcp.sls
+
+  - name: server_backup_times
+    provisioner:
+      pillars-from-files:
+        xtrabackup.sls: tests/pillar/server_backup_times.sls
+
+  - name: server
+    provisioner:
+      pillars-from-files:
+        xtrabackup.sls: tests/pillar/server.sls
diff --git a/Makefile b/Makefile
index fb69046..5bc4dc4 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,7 @@
 	@echo "make release-major  - Generate new major release"
 	@echo "make release-minor  - Generate new minor release"
 	@echo "make changelog      - Show changes since last release"
+	@echo "make test-model-validate      - Run salt jsonschema validation"
 
 install:
 	# Formula
@@ -45,6 +46,7 @@
 	cp -a $(FORMULANAME) $(DESTDIR)/$(SALTENVDIR)/
 	[ ! -d _modules ] || cp -a _modules $(DESTDIR)/$(SALTENVDIR)/
 	[ ! -d _states ] || cp -a _states $(DESTDIR)/$(SALTENVDIR)/ || true
+	[ ! -d _engines ] || cp -a _engines $(DESTDIR)/$(SALTENVDIR)/ || true
 	[ ! -d _grains ] || cp -a _grains $(DESTDIR)/$(SALTENVDIR)/ || true
 	# Metadata
 	[ -d $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) ] || mkdir -p $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
@@ -56,6 +58,10 @@
 test:
 	[ ! -d tests ] || (cd tests; ./run_tests.sh)
 
+test-model-validate:
+	# TODO make it actually fail
+	[ ! -d $(FORMULANAME)/schemas/ ] || (cd tests; ./run_tests.sh model-validate)
+
 release-major: check-changes
 	@echo "Current version is $(VERSION), new version is $(NEW_MAJOR_VERSION)"
 	@[ $(VERSION_MAJOR) != $(NEW_MAJOR_VERSION) ] || (echo "Major version $(NEW_MAJOR_VERSION) already released, nothing to do. Do you want release-minor?" && exit 1)
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index ad30dd9..461fd8b 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -1,10 +1,11 @@
 #!/usr/bin/env bash
 
 ###
+# Script source: https://gerrit.mcp.mirantis.com/#/admin/projects/salt-formulas/cookiecutter-salt-formula
 # Script requirments:
 #apt-get install -y python-yaml virtualenv git
 
-__ScriptVersion="2018.08.16"
+__ScriptVersion="2018.11.21"
 __ScriptName="run_tests.sh"
 __ScriptFullName="$0"
 __ScriptArgs="$*"