Skip to content

Conversation

@StepanVovkPLV
Copy link
Collaborator

Objective: if in collected tests we have at least one test_l1 we will sort the list with collected test items, and to the last test of the list(which will be last L1 test) we add additional fixture which will reboot device

  • in def pytest_collection_modifyitems(session, config, items) will perform sorting of ALL the items based on the key provided
  • in pytest_collection_finish(session) hook we will select last test within current session and set the test where to add reboot fixture
  • in async def reboot_device(testbed) will perform reboot of the device
  • in pytest_runtest_setup(item): we modify the last item in sorted session.items list and add rebot_device fixture

yield
devices = await _get_dent_devs_from_testbed(testbed)
to_reboot = [dev.reboot() for dev in devices]
# up_ports = [dev.run_cmd("sudo onlpdump -S") for dev in devices]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can not perform onlpdump on the device. -> cmd not found

@StepanVovkPLV StepanVovkPLV force-pushed the l1_tests_reboot_device branch 4 times, most recently from bde955a to 4ba1a94 Compare March 28, 2023 16:25
@StepanVovkPLV StepanVovkPLV force-pushed the l1_tests_reboot_device branch 3 times, most recently from 761b676 to 35ca1d6 Compare April 6, 2023 06:56
@yuriilisovskyi yuriilisovskyi added the PR Created public PR label Apr 12, 2023
@yuriilisovskyi yuriilisovskyi force-pushed the l1_tests_reboot_device branch from 35ca1d6 to 131ad5d Compare April 20, 2023 14:38
@github-actions

This comment was marked as resolved.

@StepanVovkPLV StepanVovkPLV force-pushed the l1_tests_reboot_device branch from 131ad5d to 20ffb68 Compare June 1, 2023 19:41
@github-actions

This comment was marked as resolved.

@StepanVovkPLV StepanVovkPLV force-pushed the l1_tests_reboot_device branch from f410ad9 to 5b01ffb Compare June 1, 2023 19:44
Comment on lines +100 to +103
if reboot_after_test:
if reboot_after_test.name == item.name:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if reboot_after_test:
if reboot_after_test.name == item.name:
if reboot_after_test and reboot_after_test.name == item.name:

Comment on lines +176 to +181
to_reboot = [dev.reboot() for dev in devices]
up_ports = [dev.run_cmd('onlpd') for dev in devices]
await asyncio.gather(*to_reboot)
await asyncio.gather(*up_ports)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
to_reboot = [dev.reboot() for dev in devices]
up_ports = [dev.run_cmd('onlpd') for dev in devices]
await asyncio.gather(*to_reboot)
await asyncio.gather(*up_ports)
await asyncio.gather(*[dev.reboot() for dev in devices])
# https://github.com/dentproject/dentOS/issues/152#issuecomment-973264204
await asyncio.gather(*[dev.run_cmd('onlpd') for dev in devices])

Signed-off-by: Stepan Vovk <stepan.vovk@plvision.eu>
@StepanVovkPLV StepanVovkPLV force-pushed the l1_tests_reboot_device branch from 2f19191 to fe531c5 Compare July 20, 2023 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR Created public PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants