Skip to content

Commit

Permalink
test(mysql): add tests with mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperTux88 committed Oct 11, 2020
1 parent 49a5a42 commit ba0e4fa
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ jobs:
# - env: INSTANCE=default-arch-base-latest-3000-3-py2
# - env: INSTANCE=upstart-centos-6-2019-2-py2
# - env: INSTANCE=upstart-amazonlinux-1-2019-2-py2
- env: INSTANCE=mysql-debian-10-master-py3
- env: INSTANCE=mysql-ubuntu-2004-master-py3

## Define the release stage that runs `semantic-release`
- stage: 'release'
Expand Down
27 changes: 27 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,30 @@ suites:
inspec_tests:
- path: test/integration/_mapdata
- path: test/integration/default
- name: mysql
includes:
- debian-10-master-py3
- ubuntu-2004-master-py3
provisioner:
state_top:
base:
'*':
- diaspora
- mysql
pillars:
top.sls:
base:
'*':
- diaspora
- tests
- mysql
pillars_from_files:
diaspora.sls: pillar.example
tests.sls: test/salt/pillar/tests.sls
mysql.sls: test/salt/pillar/mysql.sls
dependencies:
- name: mysql
path: test/salt/states
verifier:
inspec_tests:
- path: test/integration/default
6 changes: 6 additions & 0 deletions test/salt/pillar/mysql.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
diaspora:
database:
type: mysql
26 changes: 26 additions & 0 deletions test/salt/states/mysql/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
mysql_package:
pkg.installed:
- pkgs:
- mariadb-server
- python3-mysqldb

mysql_service:
service.running:
- name: mariadb
- require:
- pkg: mysql_package

mysql_user:
mysql_user.present:
- name: {{ salt['pillar.get']('diaspora:database:username') }}
- password: {{ salt['pillar.get']('diaspora:database:password') }}
- require:
- service: mysql_service
mysql_grants.present:
- grant: all privileges
- database: {{ salt['pillar.get']('diaspora:database:database') }}.*
- user: {{ salt['pillar.get']('diaspora:database:username') }}
- require:
- mysql_user: mysql_user
- require_in:
- cmd: diaspora_create_database

0 comments on commit ba0e4fa

Please sign in to comment.