-
Notifications
You must be signed in to change notification settings - Fork 116
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
Integrate FAM pipeline into robottelo #14028
Conversation
trigger: test-robottelo |
Not a terrible start (30/86 failed). You can see though that the failure output is not very helpful since it doesn't give you the full ansible play logs. I'm gonna research if there's a way to force Jenkins or pytest to show everything. |
tests/foreman/sys/test_fam.py
Outdated
# Edit config file | ||
config_file = f'{FAM_ROOT_DIR}/tests/test_playbooks/vars/server.yml' | ||
module_target_sat.execute( | ||
f'cp {FAM_ROOT_DIR}/tests/test_playbooks/vars/server.yml.example {config_file}' | ||
) | ||
module_target_sat.execute( | ||
f'sed -i "s/foreman.example.com/{module_target_sat.hostname}/g" {config_file}' | ||
) | ||
module_target_sat.execute( | ||
f'sed -i "s/rhsm_pool_id:.*/rhsm_pool_id: {settings.subscription.rhn_poolid}/g" {config_file}' | ||
) | ||
module_target_sat.execute( | ||
f'''sed -i 's/rhsm_username:.*/rhsm_username: "{settings.subscription.rhn_username}"/g' {config_file}''' | ||
) | ||
module_target_sat.execute( | ||
f'''sed -i 's|subscription_manifest_path:.*|subscription_manifest_path: "data/{module_sca_manifest.name}.zip"|g' {config_file}''' | ||
) | ||
module_target_sat.execute( | ||
f'''sed -i 's/rhsm_password:.*/rhsm_password: "{settings.subscription.rhn_password}"/g' {config_file}''' | ||
) |
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.
given the amount of changes we need to perform here, would it be easier/cleaner if we'd deploy this file (server.yml
) from a template and completely ignore the example we ship in the package?
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.
What would the process of deploying the file from a template look like?
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.
No idea ;)
I was hoping there is just a way in robotello?
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've found
Lines 881 to 892 in 97d9117
def put(self, local_path, remote_path=None): | |
"""Put a local file to the broker virtual machine. | |
If local_path is a manifest object, write its contents to a temporary file | |
then continue with the upload. | |
""" | |
if 'utils.manifest' in str(local_path): | |
with NamedTemporaryFile(dir=robottelo_tmp_dir) as content_file: | |
content_file.write(local_path.content.read()) | |
content_file.flush() | |
self.session.sftp_write(source=content_file.name, destination=remote_path) | |
else: | |
self.session.sftp_write(source=local_path, destination=remote_path) |
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.
or
Lines 1003 to 1018 in 97d9117
puppet_conf = ( | |
'[main]\n' | |
'vardir = /opt/puppetlabs/puppet/cache\n' | |
'logdir = /var/log/puppetlabs/puppet\n' | |
'rundir = /var/run/puppetlabs\n' | |
'ssldir = /etc/puppetlabs/puppet/ssl\n' | |
'[agent]\n' | |
'pluginsync = true\n' | |
'report = true\n' | |
'ignoreschedules = true\n' | |
f'ca_server = {proxy_hostname}\n' | |
f'certname = {cert_name}\n' | |
'environment = production\n' | |
f'server = {proxy_hostname}\n' | |
) | |
self.execute(f'echo "{puppet_conf}" >> /etc/puppetlabs/puppet/puppet.conf') |
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.
We would still have to replace the hostname and manifest name during the test setup. For now I'd leave this as is even though it's ugly and we can change in the future.
tests/foreman/sys/test_fam.py
Outdated
) | ||
|
||
# Handle color output formatting | ||
module_target_sat.execute('export ANSIBLE_NOCOLOR=True && export PY_COLORS=0') |
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.
does .execute()
always start a new ssh/shell process? if so, those export
s won't do anything
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'm actually not sure. Good question for @JacobCallahan
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.
Looking at https://github.com/SatelliteQE/broker/blob/master/broker/hosts.py, it seems the ssh session is kept alive (if possible).
I'd probably still move that to the actual test invocation below.
b7f1d3d
to
2602e4e
Compare
trigger: test-robottelo |
Reran cause I realized I needed to add some more test_playbooks to run. This is now running the right amount of tests. |
tests/foreman/sys/test_fam.py
Outdated
# Handle color output formatting | ||
module_target_sat.execute('export ANSIBLE_NOCOLOR=True && export PY_COLORS=0') | ||
module_target_sat.execute( | ||
f"sed -i 's/pytest -vv/pytest -v --color=no /g' {FAM_ROOT_DIR}/Makefile" |
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.
you want -vv
here, which will make it output all ansible output (as you wanted)
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.
Seems like that didn't change the output for how Jenkins parsed the logs.
2602e4e
to
4e94038
Compare
trigger: test-robottelo |
PRT Result
|
tests/foreman/sys/test_fam.py
Outdated
|
||
# Handle color output formatting | ||
module_target_sat.execute( | ||
f"sed -i 's/pytest -vv/pytest -vv --color=no /g' {FAM_ROOT_DIR}/Makefile" |
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.
setting PY_COLORS=0
below should be sufficient to force colors off. Sure this is required?
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.
ok and I'm not sure. I never made those changes originally
tests/foreman/sys/test_fam.py
Outdated
""" | ||
# Execute test_playbook | ||
result = module_target_sat.execute( | ||
'export ANSIBLE_NOCOLOR=True && export PY_COLORS=0 && ' |
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.
'export ANSIBLE_NOCOLOR=True && export PY_COLORS=0 && ' | ||
f'. ~/localenv/bin/activate && cd {FAM_ROOT_DIR} && make livetest_{ansible_module}' | ||
) | ||
assert 'PASSED' in result.stdout |
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 think you want to also assert exit code being zero, just to be sure?
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.
ok works for me
I think I know why we're missing the "real" output in the test results. The pytest that is running the "outer" tests is not called with
|
Interesting. I'll try changing it. Let me update everything and we'll rerun. |
4e94038
to
633573c
Compare
trigger: test-robottelo |
PRT Result
|
Well, at least it didn't eat up the output now |
Yeah we can at least scroll to the bottom for the failure. Works for me. |
633573c
to
92a1e0d
Compare
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.
great addition! just one minor thing
tests/foreman/sys/test_fam.py
Outdated
module_target_sat.execute(f"sed -i '/^live/ s/$(MANIFEST)//' {FAM_ROOT_DIR}/Makefile") | ||
|
||
# Upload manifest to test playbooks directory | ||
module_target_sat.put(f'{module_sca_manifest.path}', f'{module_sca_manifest.name}') |
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.
why the f-strings here?
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.
Addressed.
92a1e0d
to
3b2fd71
Compare
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.
Co-reviewed with @jameerpathan111
LGTM, let's see how it behaves in the production.
(cherry picked from commit 7aca395)
(cherry picked from commit 7aca395)
(cherry picked from commit 7aca395)
Integrate FAM pipeline into robottelo (SatelliteQE#14028) (cherry picked from commit 7aca395) Co-authored-by: Griffin Sullivan <48397354+Griffin-Sullivan@users.noreply.github.com>
Problem Statement
Current FAM misc pipeline has been broken for a couple releases. This is due to some version changes, but also we were not testing things as accurately as possible. For instance, we were cloning upstream and running the develop branch.
Solution
Integrate the FAM pipeline into robottelo. This now runs everything on the satellite against itself, so we know that the collection being packaged in Satellite is working correctly.
Note
The expectation is not that this will pass 100%. Getting all of the modules and roles to pass will take individual setup that needs to be done in robottelo, AAP, or upstream in the test playbook itself. For now I would like to see that the tests are executing as expected and the results show helpful output on failure (ie: the actual ansible tasking logs). After merging, we will need to evaluate as teams how to remediate the issues based on component and team.