Skip to content

Commit

Permalink
Add mongodb 4.4 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nervo committed Jul 12, 2023
1 parent 81f34d7 commit 5c76779
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/molecule.mongodb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Molecule - MongoDB

on:
pull_request:
paths:
- .manala.yaml
- .github/workflows/molecule.mongodb.yml
- .config/molecule/config.yml
- molecule/Dockerfile.*
- molecule/mongodb.*/**
- roles/mongodb/**
# Plugins
- plugins/filter/staten.py
workflow_dispatch:
inputs:
debug:
type: boolean
description: Run with tmate debugging
required: false
default: false

jobs:
mongodb:
uses: ./.github/workflows/molecule.yaml
with:
debug: ${{ inputs.debug == true }}
scenario: mongodb
versions: '[4.4]'
71 changes: 71 additions & 0 deletions molecule/mongodb.4.4/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---

###########
# Default #
###########

- name: Default
tags: [default]
hosts:
- debian.buster
tasks:
- block: # noqa name[missing]
- name: Role
ansible.builtin.import_role:
name: manala.roles.mongodb
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/default.yml.j2') }}"
changed_when: false

##########
# Config #
##########

- name: Config
tags: [config]
hosts:
- debian.buster
vars:
tests_dir: /molecule/mongodb/config
tasks:
- name: Clean tests dir # noqa risky-file-permissions args[module]
ansible.builtin.file:
path: "{{ tests_dir }}"
state: "{{ item }}"
loop: [absent, directory]
- block: # noqa name[missing]
- name: Role - Dict
ansible.builtin.import_role:
# Play role fully on first run, so that handlers don't breaks
name: manala.roles.mongodb
vars:
manala_mongodb_config_file: "{{ tests_dir }}/dict"
manala_mongodb_config_template: ~
manala_mongodb_config:
foo:
bar: baz
- name: Role - Content
ansible.builtin.import_role:
name: manala.roles.mongodb
tasks_from: config
vars:
manala_mongodb_config_file: "{{ tests_dir }}/content"
manala_mongodb_config_template: ~
manala_mongodb_config: |
Content
- name: Role - Template
ansible.builtin.import_role:
name: manala.roles.mongodb
tasks_from: config
vars:
manala_mongodb_config_file: "{{ tests_dir }}/template"
manala_mongodb_config_template: fixtures/template.j2
manala_mongodb_config: ~
always:
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/config.yml.j2') }}"
changed_when: false
1 change: 1 addition & 0 deletions molecule/mongodb.4.4/fixtures/template.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Template
1 change: 1 addition & 0 deletions molecule/mongodb.4.4/fixtures/template_file.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Template file
28 changes: 28 additions & 0 deletions molecule/mongodb.4.4/goss/config.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---

file:
{{ tests_dir }}/dict:
exists: true
filetype: file
owner: root
group: root
mode: "0644"
contains:
- "foo"
- " bar: baz"
{{ tests_dir }}/content:
exists: true
filetype: file
owner: root
group: root
mode: "0644"
contains:
- "/^Content$/"
{{ tests_dir }}/template:
exists: true
filetype: file
owner: root
group: root
mode: "0644"
contains:
- "/^Template$/"
22 changes: 22 additions & 0 deletions molecule/mongodb.4.4/goss/default.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

package:
mongodb-org:
installed: true
mongodb-org-server:
installed: true
mongodb-org-shell:
installed: true
mongodb-org-tools:
installed: true

command:
mongod --version:
exit-status: 0
stdout:
- "/db version v4.4.(.){1,2}/"

service:
mongod:
enabled: true
running: true
Empty file.
14 changes: 14 additions & 0 deletions molecule/mongodb.4.4/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

- name: Prepare
tags: [always]
hosts:
- debian.buster
- debian.bullseye
tasks:
- name: Apt
ansible.builtin.import_role:
name: manala.roles.apt
vars:
manala_apt_preferences:
- mariadb@mongodb_4_4

0 comments on commit 5c76779

Please sign in to comment.