Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR] Fix restore tests third part #9646

Merged
merged 25 commits into from
Feb 6, 2020
Merged

[1LP][RFR] Fix restore tests third part #9646

merged 25 commits into from
Feb 6, 2020

Conversation

jarovo
Copy link
Contributor

@jarovo jarovo commented Nov 20, 2019

Purpose or Intent

This is my last PR that makes the restore tests fixed.

  • Enhancement .. generalization of the repmgr attribute to support CFME 5.10 as well as 5.11
  • Fixing test_appliance_console_restore_db_replicated
  • Fixing timeout for the db backup to complete
  • Enhancement - close the ssh channel explicitly using with statement
  • Enhancement - make the restore_db_replicated more reliable by adding wait instead of just assert
  • Fix - the SCAP update test
  • Enhancement - convert some calls to use interaction.answer
  • Enhancement - use re.escape rather then defining resc
  • Fix - use preupdate appliances in test_update_replicated_webui. I think appliances of the target version were used so no real update was made.

{{py.test: cfme/tests/cli/test_appliance_update.py cfme/tests/cli/test_appliance_console_db_restore.py -v --use-provider 'complete' --collect-logs}}

Remaining unresolved failures on PRT:

  • test_proxy_* with azure providers
  • test_appliance_console_restore_pg_basebackup_replicated often fails to obtain additional VMs from sprout or is getting connection reset by peer while in configure()

@jarovo jarovo changed the title [WIPTEST] Fix restore tests third part [RFR] Fix restore tests third part Nov 28, 2019
@mshriver mshriver self-assigned this Dec 3, 2019
@jarovo jarovo changed the title [RFR] Fix restore tests third part [WIP] Fix restore tests third part Dec 5, 2019
@jarovo jarovo changed the title [WIP] Fix restore tests third part [WIPTEST] Fix restore tests third part Dec 5, 2019
@dajoRH dajoRH changed the title [WIPTEST] Fix restore tests third part [WIP] Fix restore tests third part Dec 5, 2019
@jarovo jarovo changed the title [WIP] Fix restore tests third part [WIPTEST] Fix restore tests third part Dec 5, 2019
@dajoRH dajoRH added WIP-testing and removed WIP labels Dec 5, 2019
@dajoRH dajoRH changed the title [WIPTEST] Fix restore tests third part [WIP] Fix restore tests third part Dec 13, 2019
@jarovo jarovo changed the title [WIP] Fix restore tests third part [WIPTEST] Fix restore tests third part Dec 18, 2019
@dajoRH dajoRH added WIP-testing and removed WIP labels Dec 18, 2019
@jarovo jarovo changed the title [WIPTEST] Fix restore tests third part [RFR] Fix restore tests third part Jan 16, 2020
Copy link
Contributor

@john-dupuy john-dupuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big PR but I think we have seen most of this stuff before. Nice work @JaryN I have a few required comments but they are fairly trivial.

@pytest.fixture
def get_appliance_with_ansible(temp_appliance_preconfig_funcscope):
"""Returns database-owning appliance, enables embedded ansible,
takes a pg_backup prior to running tests.

waits for it to ready, takes a backup prior to running tests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by waits for it to be ready?

"""Waits for embedded ansible to be ready

Args:
timeout: Number of seconds to wait until timeout (default ``1200``)
"""

timeout = 1200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required I don't think this value should be hard-coded. Why have you removed it as an argument?

Copy link
Contributor Author

@jarovo jarovo Jan 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it from the arguments because the value used to be mangled in this function in case the appliance is pod. And I though well this already gets mangled, so I will mangle it bit more but to not make even more confusion I though it would be best to remove the argument.

I guess you are suggesting to put this somewhere as a "constant" right? Perhaps on top of the module. Then do you think this function should even exist? I don't see much of value over just calling the wait_for instead of this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave the argument in and, if is not specified then we should modify it. I also think the function should exist, as it's useful to have these convenience functions so you don't have to remember exactly what to wait_for. So what I'm suggesting is:

default_timeout = 1200 == timeout
if self.is_pod and default_timeout:
    timeout *= 2
if self.version < '5.11' and default_timeout:
    timeout *=2

If a user passes in something other than the default timeout then we should use that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it bit differently.
I also decreased the timeout when we are dealing with 5.11 as there I think the ansible should be available almost instantly. What do you thinkg @sbulage ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @JaryN on 5.11 version Embedded Ansible gets enabled instantly.

Jaroslav Henner added 18 commits January 29, 2020 18:49
40s seems to be too little
The number got changed for the SCAP. We didn't really do any SCAP.
The fixture is redundant. I rather made the tests use the
replicated_appliances_with_providers with an argument that is a list of
either preupdate appliances or temporary (no-preupdate) appliances
depending on which test is requiring them
The were several issues with this test:
 * There was some leftover code doing reboot.
 * Reboot was causing the login page to not fully load on 5.11.
   I think this is some bug that we should investigate, but for now,
   I want the backup/restore test passing.)
 * The runcmd was used to check an aws service was running, but the
   result was not checked.

revert
Fixes test_appliance_console_restore_db_external
This helps with test_appliance_console_restore_pg_basebackup_ansible
On 5.11, we seem to be getting the "Embedded ansible" as as "bulit-in
provider".
The test is failing (only) on PRT. Waiting for the failover monitor to
start using monitoring of the log helps.
The CFME 5.11.2.1 brough re-numbering of the menu options (BZ 1790995).
This has to be reflected in the tests code.
@jarovo jarovo changed the title [1LP][WIPTEST][NOMERGE] Fix restore tests third part [1LP][WIPTEST] Fix restore tests third part Jan 30, 2020
@dajoRH
Copy link
Contributor

dajoRH commented Jan 31, 2020

I detected some fixture changes in commit 60a6281

The local fixture get_appliance_with_ansible is used in the following files:

  • cfme/tests/cli/test_appliance_console_db_restore.py
    • test_appliance_console_restore_pg_basebackup_ansible

The local fixture get_ha_appliances_with_providers is used in the following files:

  • cfme/tests/cli/test_appliance_console_db_restore.py

Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃

@jarovo jarovo changed the title [1LP][WIPTEST] Fix restore tests third part [1LP][RFR] Fix restore tests third part Feb 5, 2020
@dajoRH dajoRH removed the WIP-testing label Feb 5, 2020
@mshriver mshriver merged commit 0f6c358 into ManageIQ:master Feb 6, 2020
@jarovo jarovo deleted the fix_restore_tests_third_part branch February 7, 2020 10:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants