-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for custom environment file
- Loading branch information
1 parent
4265f62
commit 7c0f178
Showing
7 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Cleanup test resources | ||
hosts: localhost | ||
tasks: | ||
- name: Stop zookeeper container | ||
docker_container: | ||
name: zookeeper | ||
image: confluentinc/cp-zookeeper:5.5.0 | ||
state: stopped | ||
purge_networks: yes | ||
delegate_to: localhost | ||
run_once: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Configure hosts | ||
hosts: all | ||
become: yes | ||
roles: | ||
- role: ansible-role-kafka | ||
vars: | ||
kafka_environment_file: /etc/kafka/molecule.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
driver: | ||
name: docker | ||
lint: | | ||
set -e | ||
yamllint . | ||
platforms: | ||
- name: ubuntu18 | ||
image: ubuntu:18.04 | ||
dockerfile: ../resources/Dockerfile.j2 | ||
networks: | ||
- name: kafka-network | ||
provisioner: | ||
name: ansible | ||
lint: | | ||
set -e | ||
ansible-lint | ||
inventory: | ||
group_vars: | ||
all: | ||
kafka_version: 2.5.0 | ||
host_vars: | ||
ubuntu18: | ||
kafka_zookeeper_connection_hosts: | ||
- zookeeper:2181 | ||
verifier: | ||
name: ansible | ||
lint: | | ||
set -e | ||
ansible-lint | ||
dependency: | ||
name: galaxy | ||
options: | ||
role-file: molecule/resources/requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
- name: Install required roles | ||
hosts: all | ||
roles: | ||
- nl2go.openjdk | ||
tasks: | ||
- name: Prepare docker systemctl replacement script | ||
get_url: | ||
url: https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py | ||
dest: /usr/bin/systemctl | ||
mode: '0775' | ||
- name: Start zookeeper container | ||
docker_container: | ||
name: zookeeper | ||
image: confluentinc/cp-zookeeper:5.5.0 | ||
env: | ||
ZOOKEEPER_CLIENT_PORT: "2181" | ||
ZOOKEEPER_TICK_TIME: "2000" | ||
networks: | ||
- name: kafka-network | ||
delegate_to: localhost | ||
run_once: true | ||
- name: Install additional packages needed for testing | ||
apt: | ||
name: | ||
- net-tools | ||
- procps | ||
- name: Set JMX_PORT environment variable | ||
lineinfile: | ||
path: /etc/kafka/molecule.env | ||
regexp: '^JMX_PORT=' | ||
line: JMX_PORT=1099 | ||
create: yes | ||
- name: Set KAFKA_JMX_OPTS environment variable | ||
lineinfile: | ||
path: /etc/kafka/molecule.env | ||
regexp: '^KAFKA_JMX_OPTS=' | ||
line: 'KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"' | ||
create: yes | ||
- name: Set KAFKA_HEAP_OPTS environment variable | ||
lineinfile: | ||
path: /etc/kafka/molecule.env | ||
regexp: '^KAFKA_HEAP_OPTS=' | ||
line: 'KAFKA_HEAP_OPTS="-Xmx192M"' | ||
create: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Verify kafka installation | ||
hosts: all | ||
tasks: | ||
- name: Gather facts on listening ports | ||
listen_ports_facts: | ||
- name: Create list of listening ports | ||
set_fact: | ||
tcp_ports: "{{ ansible_facts.tcp_listen | map(attribute='port') | sort | list }}" | ||
- name: Verify kafka port is in listening ports | ||
assert: | ||
that: | ||
- 9092 in tcp_ports | ||
- name: Verify JMX port is in listening ports | ||
assert: | ||
that: | ||
- 1099 in tcp_ports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters