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

Ensure correct finalizer order #14620

Merged

Conversation

dosas
Copy link
Collaborator

@dosas dosas commented Apr 4, 2024

Problem Statement

the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)

Solution

Execute host finalizer after hostgroup finalizer

Note

This should replace #14568

@dosas dosas requested a review from a team as a code owner April 4, 2024 10:46
Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

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

Interesting how the finalizers work as a stack. My recommendation would be to flip the order of creation. Make the HG then the host and leave finalizers right after each create. Although this works too.

@Griffin-Sullivan Griffin-Sullivan added CherryPick PR needs CherryPick to previous branches 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing labels Apr 4, 2024
@dosas
Copy link
Collaborator Author

dosas commented Apr 8, 2024

Interesting how the finalizers work as a stack. My recommendation would be to flip the order of creation. Make the HG then the host and leave finalizers right after each create. Although this works too.

My recommendation would be to flip the order of creation.

Wouldn't that change the test logic?

1. Create Global Parameter
2. Create host and verify global parameter is assigned
3. Create Host Group with parameter

Copy link
Member

@JacobCallahan JacobCallahan left a comment

Choose a reason for hiding this comment

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

I overall like this approach better than the fixture-heavy one. However, I will block on changing creation order (and yes the test logic order) to create the hostgroup first, then add its finalizer before creating the host. This is the best balance between ensuring finalizer execution order and actual execution if something goes wrong between entity creation and finalizer addition.

@dosas dosas force-pushed the fix-finalizer-execution-order-v2 branch from cb296b3 to 2927fca Compare April 11, 2024 06:46
@dosas dosas requested a review from JacobCallahan April 11, 2024 06:47
the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
@dosas dosas force-pushed the fix-finalizer-execution-order-v2 branch from 2927fca to be19f79 Compare April 11, 2024 06:48
@Gauravtalreja1
Copy link
Collaborator

trigger: test-robottelo
pytest: tests/foreman/api/test_parameters.py

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6453
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_parameters.py --external-logging
Test Result : ================== 1 passed, 9 warnings in 655.80s (0:10:55) ===================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 11, 2024
Copy link
Member

@JacobCallahan JacobCallahan left a comment

Choose a reason for hiding this comment

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

ACK, thanks for taking this on!

@JacobCallahan JacobCallahan merged commit 8eea8dc into SatelliteQE:master Apr 11, 2024
10 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 11, 2024
the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
(cherry picked from commit 8eea8dc)
github-actions bot pushed a commit that referenced this pull request Apr 11, 2024
the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
(cherry picked from commit 8eea8dc)
github-actions bot pushed a commit that referenced this pull request Apr 11, 2024
the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
(cherry picked from commit 8eea8dc)
JacobCallahan pushed a commit that referenced this pull request Apr 11, 2024
Ensure correct finalizer order (#14620)

the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
(cherry picked from commit 8eea8dc)

Co-authored-by: dosas <dosas@users.noreply.github.com>
JacobCallahan pushed a commit that referenced this pull request Apr 11, 2024
Ensure correct finalizer order (#14620)

the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
(cherry picked from commit 8eea8dc)

Co-authored-by: dosas <dosas@users.noreply.github.com>
JacobCallahan pushed a commit that referenced this pull request Apr 11, 2024
Ensure correct finalizer order (#14620)

the host was not deleted before the hostgroup

see: pytest-dev/pytest#10023 (comment)
(cherry picked from commit 8eea8dc)

Co-authored-by: dosas <dosas@users.noreply.github.com>
jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants