Sfoglia il codice sorgente

test(mysql): add tests with mysql

tags/v1.0.0
Benjamin Neff 4 anni fa
parent
commit
ba0e4fafb3
Nessun account collegato all'indirizzo email del committer
4 ha cambiato i file con 61 aggiunte e 0 eliminazioni
  1. +2
    -0
      .travis.yml
  2. +27
    -0
      kitchen.yml
  3. +6
    -0
      test/salt/pillar/mysql.sls
  4. +26
    -0
      test/salt/states/mysql/init.sls

+ 2
- 0
.travis.yml Vedi File

@@ -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'

+ 27
- 0
kitchen.yml Vedi File

@@ -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
- 0
test/salt/pillar/mysql.sls Vedi File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
diaspora:
database:
type: mysql

+ 26
- 0
test/salt/states/mysql/init.sls Vedi File

@@ -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

Loading…
Annulla
Salva