Skip to content

Commit

Permalink
Reorder test and verification to create the znode before deleting it.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleighzy committed Oct 22, 2023
1 parent 4bf5ee4 commit d7c981d
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,6 @@
- ansible_facts.services['zookeeper.service'].state == 'running'
- ansible_facts.services['zookeeper.service'].status == 'enabled'

- name: Delete Znode if it already exists
when: ansible_hostname == "zookeeper-1"
block:
- name: Get Znode
ansible.builtin.command: /usr/share/zookeeper/bin/zkCli.sh get /TestZnode1
when: ansible_hostname == "zookeeper-1"
register: command_result
failed_when: command_result.rc != 0
changed_when: false

- name: Delete Znode if it already exists
ansible.builtin.command: /usr/share/zookeeper/bin/zkCli.sh delete /TestZnode1
register: command_result
failed_when: command_result.rc != 0
when:
- ansible_hostname == "zookeeper-1"
- '"test-node-1" in command_result.stdout'
changed_when: false

- name: Create Znode and assert visible by all servers
block:
- name: Create a Znode entry in ZooKeeper
Expand Down Expand Up @@ -111,3 +92,22 @@
ansible.builtin.assert:
that:
- '"test-node-1" in command_result.stdout'

- name: Delete Znode
when: ansible_hostname == "zookeeper-1"
block:
- name: Get Znode
ansible.builtin.command: /usr/share/zookeeper/bin/zkCli.sh get /TestZnode1
when: ansible_hostname == "zookeeper-1"
register: command_result
failed_when: command_result.rc != 0
changed_when: false

- name: Delete Znode if it already exists
ansible.builtin.command: /usr/share/zookeeper/bin/zkCli.sh delete /TestZnode1
register: command_result
failed_when: command_result.rc != 0
when:
- ansible_hostname == "zookeeper-1"
- '"test-node-1" in command_result.stdout'
changed_when: false

0 comments on commit d7c981d

Please sign in to comment.