New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add integration tests using smoker #1005
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
forklift_name: "pipeline-{{ pipeline_type }}-{{ pipeline_version }}-{{ pipeline_os }}" | ||
forklift_server_name: "pipeline-{{ pipeline_type }}-server-{{ pipeline_version }}-{{ pipeline_os }}" | ||
forklift_proxy_name: "pipeline-{{ pipeline_type }}-proxy-{{ pipeline_version }}-{{ pipeline_os }}" | ||
forklift_smoker_name: "pipeline-{{ pipeline_type }}-smoker-{{ pipeline_version }}-{{ pipeline_os }}" | ||
smoker_box: | ||
box: centos7 | ||
memory: 2048 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
forklift_name: "pipeline-upgrade-{{ pipeline_type }}-{{ pipeline_version}}-{{ pipeline_os }}" | ||
forklift_server_name: "pipeline-upgrade-{{ pipeline_type }}-{{ pipeline_version}}-{{ pipeline_os }}" | ||
forklift_proxy_name: "pipeline-upgrade-{{ pipeline_type }}-proxy-{{ pipeline_version}}-{{ pipeline_os }}" | ||
forklift_boxes: "{{ {forklift_server_name: server_box} }}" | ||
forklift_smoker_name: "pipeline-{{ pipeline_type }}-smoker-{{ pipeline_version }}-{{ pipeline_os }}" | ||
forklift_boxes: "{{ {forklift_server_name: server_box, forklift_smoker_name: smoker_box} }}" | ||
smoker_box: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as in install_base.yml |
||
box: centos7 | ||
memory: 2048 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
# Shared | ||
pytest_project_directory: /tmp/pytest_project | ||
pytest_project_virtualenv_path: "{{ pytest_project_directory }}/venv" | ||
|
||
# Install | ||
pytest_project_packages: | ||
- git | ||
- python3 | ||
# This should match the ansible_python_interpreter rather than the pytest's python | ||
- python-setuptools | ||
pytest_project_url: | ||
pytest_project_requirements: requirements.txt | ||
pytest_project_virtualenv_command: /usr/bin/python3 -m venv | ||
pytest_project_version: master | ||
|
||
# Run | ||
pytest_project_junit_output: junit.xml | ||
pytest_project_markers: | ||
pytest_project_command_args: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Install packages | ||
become: true | ||
package: | ||
name: "{{ pytest_project_packages }}" | ||
state: present | ||
|
||
- name: Clone project | ||
git: | ||
repo: "{{ pytest_project_url }}" | ||
dest: "{{ pytest_project_directory }}" | ||
version: "{{ pytest_project_version }}" | ||
update: yes | ||
force: yes | ||
|
||
- name: Install requirements | ||
pip: | ||
requirements: "{{ pytest_project_directory }}/{{ pytest_project_requirements }}" | ||
virtualenv: "{{ pytest_project_virtualenv_path }}" | ||
virtualenv_command: "{{ pytest_project_virtualenv_command }}" | ||
chdir: "{{ pytest_project_directory }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- name: 'Build command' | ||
set_fact: | ||
pytest_project_command: "{{ pytest_project_virtualenv_path }}/bin/py.test --junit-xml={{ pytest_project_junit_output }} {{ pytest_project_command_args }}" | ||
|
||
- name: 'Limit to markers' | ||
set_fact: | ||
pytest_project_command: "{{ pytest_project_command }} -m '{{ pytest_project_markers }}'" | ||
when: pytest_project_markers|bool | ||
|
||
- name: 'Run tests' | ||
command: "{{ pytest_project_command }}" | ||
args: | ||
chdir: "{{ pytest_project_directory }}" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
smoker_url: https://github.com/theforeman/smoker | ||
smoker_version: master | ||
smoker_directory: "{{ ansible_env.HOME }}/smoker" | ||
smoker_variables: {} | ||
smoker_variables_path: "{{ smoker_directory }}/variables.json" | ||
smoker_base_url: | ||
smoker_command_args: "--driver chrome --variables '{{ smoker_variables_path }}' --base-url '{{ smoker_base_url }}'" | ||
smoker_markers: | ||
smoker_browser_packages: | ||
- chromium | ||
- chromedriver |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
- name: 'Install browser' | ||
become: true | ||
package: | ||
name: '{{ smoker_browser_packages }}' | ||
|
||
- name: 'Install Smoker via pytest_project' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reasoning behind importing separate task files from the role instead of the whole role? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both Robottelo and smoker need to do additional configuration. Technically smoker could drop its variables.json anywhere since it's an absolute path but Robottelo modifies files in the cloned repo. Since I started with Robottelo, I continued this way. And do sort of a callback where I provided a role/task with setup was even worse IMHO. If you know a clean way to do this in Ansible, I'd love to hear it. |
||
include_role: | ||
name: pytest_project | ||
tasks_from: install | ||
vars: | ||
pytest_project_url: "{{ smoker_url }}" | ||
pytest_project_version: "{{ smoker_version }}" | ||
pytest_project_directory: "{{ smoker_directory }}" | ||
|
||
- name: "Show variables" | ||
debug: | ||
var: smoker_variables | ||
|
||
- name: 'Write variables.json' | ||
copy: | ||
dest: "{{ smoker_variables_path }}" | ||
content: "{{ smoker_variables|to_json }}" | ||
|
||
- name: 'Run Smoker via pytest_project' | ||
include_role: | ||
name: pytest_project | ||
tasks_from: run | ||
vars: | ||
pytest_project_directory: "{{ smoker_directory }}" | ||
pytest_project_markers: "{{ smoker_markers }}" | ||
pytest_project_command_args: "{{ smoker_command_args }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be defined in
base.yml
, no? or do we need different smoker boxes for install and upgrade?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a
base.yml
. Are you suggesting to introduce one?