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

Don't skip failed actions on preparation stage #27

Merged
merged 2 commits into from
Apr 16, 2024
Merged

Conversation

SandakovMM
Copy link
Contributor

We need to make all required actions on the preparation stage, so if some action has been failed, we should re-perform it

@SandakovMM SandakovMM requested a review from kpushkaryov April 11, 2024 13:04
@SandakovMM SandakovMM self-assigned this Apr 11, 2024
simple_action._prepare_action.assert_called_once()
saved_action._prepare_action.assert_called_once()

def test_skip_failed_saved_state(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

These 3 tests are almost identical. Could they be converted into invocations of a single function with different parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure it will simplify things, but ok let's do it

pleskdistup/common/src/action.py Outdated Show resolved Hide resolved
pleskdistup/common/src/action.py Outdated Show resolved Hide resolved
@SandakovMM SandakovMM requested a review from kpushkaryov April 12, 2024 06:29
saved_action = SavedAction()

if phase == "prepare":
simple_action._prepare_action = mock.Mock(return_value=action.ActionResult())
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to use setattr() and getattr() to avoid duplicating these assignments.

@SandakovMM SandakovMM requested a review from kpushkaryov April 15, 2024 06:11
Copy link
Contributor

@kpushkaryov kpushkaryov left a comment

Choose a reason for hiding this comment

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

Please rebase before merge.

Mikhail Sandakov added 2 commits April 16, 2024 07:34
We need to make all required actions on the preparation stage,
so if some action has been failed, we should re-perform it
oved the logic for tests into a separate function since it was nearly identical
@SandakovMM SandakovMM merged commit 8d26738 into main Apr 16, 2024
1 check passed
@SandakovMM SandakovMM deleted the no-skip-failed branch April 16, 2024 04:41
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.

2 participants