Commit 917c04ed authored by Simon Cornet's avatar Simon Cornet
Browse files

feat: added molecule testing

parent c3fc60e3
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
---

# renovate: datasource=github-releases depName=atuinsh/atuin versioning=pep440
atuin_version: "18.7.1"

# atuin db creds
atuin_db_host: "localhost"
atuin_db_name: "atuin"
atuin_db_user: "atuin"
atuin_db_pass: "atuin"
+1 −7
Original line number Diff line number Diff line
@@ -7,10 +7,4 @@
    state: "restarted"
    daemon_reload: true
    enabled: true

# sysusers
- name: "restart sysusers"
  ansible.builtin.systemd:
    name: "systemd-sysusers.service"
    state: "restarted"
    enabled: true
  when: "not lookup('env', 'MOLECULE_TESTING') | bool"
+8 −0
Original line number Diff line number Diff line
---

- name: "converge"
  hosts: "all"
  become: true
  gather_facts: true
  roles:
    - role: "siempie.atuin"
+44 −0
Original line number Diff line number Diff line
---

dependency:
  name: "galaxy"

driver:
  name: "docker"

provisioner:
  name: "ansible"
  env:
    MOLECULE_TESTING: "true"

verifier:
  name: "ansible"

platforms:

  # debian 12
  - name: "debian-12"
    image: "geerlingguy/docker-debian12-ansible:latest"
    pre_build_image: true
    privileged: true
    volumes:
      - "/sys/fs/cgroup:/sys/fs/cgroup:rw"
    command: "/lib/systemd/systemd"

  # ubuntu 22
  - name: "ubuntu-22"
    image: "geerlingguy/docker-ubuntu2204-ansible:latest"
    pre_build_image: true
    privileged: true
    volumes:
      - "/sys/fs/cgroup:/sys/fs/cgroup:rw"
    command: "/lib/systemd/systemd"

  # ubuntu 24
  - name: "ubuntu-24"
    image: "geerlingguy/docker-ubuntu2404-ansible:latest"
    pre_build_image: true
    privileged: true
    volumes:
      - "/sys/fs/cgroup:/sys/fs/cgroup:rw"
    command: "/lib/systemd/systemd"
+37 −0
Original line number Diff line number Diff line
---

# verify
- name: "verify"
  hosts: "all"
  become: true
  gather_facts: true
  vars:
    # renovate: datasource=github-releases depName=atuinsh/atuin versioning=pep440
    atuin_version: "18.7.1"
    atuin_binary_path: "/usr/local/bin/atuin"

  tasks:

    # check if atuin binary is installed
    - name: "check if atuin binary exists"
      ansible.builtin.stat:
        path: "{{ atuin_binary_path }}"
      register: "atuin_binary_stat"

    - name: "fail if atuin binary does not exist"
      ansible.builtin.fail:
        msg: "Atuin binary not found at {{ atuin_binary_path }}"
      when: "not atuin_binary_stat.stat.exists"

    # check atuin version
    - name: "check current atuin version"
      ansible.builtin.command: "{{ atuin_binary_path }} -V"
      register: "atuin_version_check"
      changed_when: false
      failed_when: "atuin_version_check.rc != 0"

    - name: "assert atuin version matches expected"
      ansible.builtin.assert:
        that: "'{{ atuin_version }}' in atuin_version_check.stdout"
        fail_msg: "Atuin version ({{ atuin_version_check.stdout }}) does not match ({{ atuin_version }})"
        success_msg: "Atuin version matches expected ({{ atuin_version }})"