瀏覽代碼

test(mysql): add tests with mysql

tags/v1.0.0
Benjamin Neff 4 年之前
父節點
當前提交
ba0e4fafb3
No account linked to committer's email address
共有 4 個文件被更改,包括 61 次插入0 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

+ 26
- 0
test/salt/states/mysql/init.sls 查看文件

@@ -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…
取消
儲存