Skip to content
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

[Test] Add host to maintenance using flags #3678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sayaleeraut
Copy link
Contributor

Description

Please include Automation development guidelines. Source of Test case - New Feature/Regression Test/Close loop of customer BZs

click to expand checklist
  • Create a test case in Polarion reviewed and approved.
  • Create a design/automation approach doc. Optional for tests with similar tests already automated.
  • Review the automation design
  • Implement the test script and perform test runs
  • Submit PR for code review and approve
  • Update Polarion Test with Automation script details and update automation fields
  • If automation is part of Close loop, update BZ flag qe-test_coverage “+” and link Polarion test

Copy link
Contributor

openshift-ci bot commented May 9, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sayaleeraut

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sayaleeraut
Copy link
Contributor Author

Tox results -

===================================================================== 17 passed, 3 warnings in 0.69s ======================================================================
py3: commands[1]> flake8
py3: commands[2]> isort -c .
Skipped 3 files
py3: commands[3]> black --check --diff .
All done! ✨ 🍰 ✨
1045 files would be left unchanged.
py3: commands[4]> yamllint -d relaxed --no-warnings .
.pkg: _exit> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta legacy
py3: OK (25.29=setup[4.25]+cmd[0.87,1.50,1.46,3.00,14.21] seconds)
congratulations :) (25.33 seconds)

@@ -0,0 +1,90 @@
#===============================================================================================
#-------------------------------------
#----- Smoke Test suite ------
Copy link
Contributor

Choose a reason for hiding this comment

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

Smoke test suite ?

#-------------------------------------
#----- Smoke Test suite ------
#-------------------------------------
# Conf: conf/quincy/cephadm/tier-0.yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

quincy ?

name: configure client

# Testing stage
- test:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need separate cluster for this operation? Can't it added to any existing suite ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, will add it to suites/reef/cephadm/tier0-cephadm.yaml


# Put the host into maintainence
cmd = f"ceph orch host maintenance enter {instance_name} --force --yes-i-really-mean-it"
out = cephadm.shell([cmd])
Copy link
Contributor

Choose a reason for hiding this comment

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

Why cephadm.shell? Add libraries for same operation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @vamahaja Using this "--yes-i-really-mean-it" flag we are forcing a host into maintenance and it not a recommended way to do it.
Not sure if it will be used in other test scenarios, please let me know if still this needs to converted to a lib.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

)

# Validate Cephadm logs for no OrchestratorError
cmd = "ceph log last 3 cephadm"
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@sayaleeraut sayaleeraut force-pushed the test_bz_2111539 branch 5 times, most recently from 51c33f0 to 7d60971 Compare May 22, 2024 10:08
@sayaleeraut
Copy link
Contributor Author

Tox results -

py3: commands[1]> flake8
py3: commands[2]> isort -c .
Skipped 3 files
py3: commands[3]> black --check --diff .
All done! ✨ 🍰 ✨
1047 files would be left unchanged.
py3: commands[4]> yamllint -d relaxed --no-warnings .
.pkg: _exit> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta legacy
py3: OK (23.67=setup[3.88]+cmd[0.51,1.45,1.30,2.74,13.79] seconds)
congratulations :) (23.70 seconds)

@sayaleeraut sayaleeraut force-pushed the test_bz_2111539 branch 2 times, most recently from 36a6e70 to c3395fc Compare May 22, 2024 16:47
Signed-off-by: “sayalee” <saraut@redhat.com>
force (bool): Whether to append force with maintenance enter command
yes-i-really-mean-it (bool) : Whether to append --yes-i-really-mean-it with maintenance enter command
"""
if operation == "enter":
Copy link
Contributor

Choose a reason for hiding this comment

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

Use cmd = f"{self.base_cmd} maintenance {operation} {hostname}

operation(str): enter/exit maintenance mode
kw (dict): Key/value pairs that needs to be provided to the installer

Supported keys:
Copy link
Contributor

Choose a reason for hiding this comment

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

**kw is used for large no of parameters. For simplicity pass force & yes_i_really_mean_it parameters to method.

@@ -1,5 +1,8 @@
from cli import Cli
from cli.utilities.utils import build_cmd_from_args
from utility.log import Log

log = Log(__name__)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused variable

log.info(f"Status of the host is {host_status}")
if status:
return True if status.lower() == host_status else False
elif "offline" in host_status:
Copy link
Contributor

Choose a reason for hiding this comment

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

offline status will be specific condition. It can be handled by passing it through status.

"""
log.debug(f"Passed host : {hostname} to be added into maintenance mode")
iteration = 0
while iteration <= retry:
Copy link
Contributor

Choose a reason for hiding this comment

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

log.info(f"Host: {hostname}, not in maintenance mode. Pass")
return True

while iteration <= retry:
Copy link
Contributor

Choose a reason for hiding this comment

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

installer = ceph_cluster.get_nodes(role="installer")[0]

# Create a pool
out = orch_obj.create_pool(**pool_config)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants