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

On start, update git_pillar on second loop #56316

Merged
merged 2 commits into from
Sep 9, 2020

Conversation

sathieu
Copy link
Contributor

@sathieu sathieu commented Mar 6, 2020

What does this PR do?

Before this patch, the master would wait git_pillar_update_interval before doing the first update. When this setting is big (we set it to one week at work), this can lead to unfetched repositories.

What issues does this PR fix or reference?

PR #53621

Fixes #56356.

Previous Behavior

The first git_pillar update would run at start time + git_pillar_update_interval.

New Behavior

The first git_pillar update would run at start time.

Tests written?

No

Commits signed with GPG?

No

@sathieu sathieu requested a review from a team as a code owner March 6, 2020 10:56
@ghost ghost requested a review from Ch3LL March 6, 2020 10:56
salt/master.py Outdated Show resolved Hide resolved
@Ch3LL
Copy link
Contributor

Ch3LL commented Mar 9, 2020

can we get an associated issue open alongside this PR, so its clear what issue we are fixing and in case anyone else is running into the issue its easily discoverable?

@Ch3LL Ch3LL self-assigned this Mar 9, 2020
@sathieu
Copy link
Contributor Author

sathieu commented Mar 11, 2020

@Ch3LL Issue created: #56356.

Copy link
Contributor

@Ch3LL Ch3LL left a comment

Choose a reason for hiding this comment

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

any chance we can get a test case here to ensure it does not regress in the future?

@Ch3LL Ch3LL added the Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases label Mar 12, 2020
@sathieu
Copy link
Contributor Author

sathieu commented Apr 3, 2020

@Ch3LL I have no idea of how to test this.

@Ch3LL
Copy link
Contributor

Ch3LL commented Apr 8, 2020

I would suggest a unit test here tests/unit/test_master.py and add a new test ckass for the maintenance class and add a test for the run function with git_pillar_update_interval set to different values.

@sagetherage sagetherage assigned xeacott and unassigned Ch3LL May 5, 2020
@xeacott
Copy link
Contributor

xeacott commented May 5, 2020

Hey @sathieu any follow up on this? I can help you write a test if you need for this PR. 😄

@sathieu
Copy link
Contributor Author

sathieu commented May 14, 2020

@xeacott Yes, please help me with a test.

@sathieu
Copy link
Contributor Author

sathieu commented May 14, 2020

I would suggest a unit test here tests/unit/test_master.py and add a new test ckass for the maintenance class and add a test for the run function with git_pillar_update_interval set to different values.

@Ch3LL OK but how to escape the while True loop?

@xeacott
Copy link
Contributor

xeacott commented May 20, 2020

I would suggest something like this to get you started...

class MaintenanceTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
    """
    TestCase for salt.master.Maintenance class
    """

    def setUp(self):
        self.opts = salt.config.master_config(None)
        self.main_class = salt.master.Maintenance(self.opts)

    def tearDown(self):
        del self.main_class

    def test_run_func(self):
        """
        Test the run function inside Maintenance class.
        """
        with patch("salt.utils.process", autospec=True):
            with patch("salt.master", autospec=True):
                self.main_class.run()

@sathieu sathieu force-pushed the git_pillar_update0 branch 2 times, most recently from 289c55c to 7a93f6d Compare May 28, 2020 10:43
@sathieu sathieu requested a review from Ch3LL May 28, 2020 12:51
@sathieu
Copy link
Contributor Author

sathieu commented May 28, 2020

@Ch3LL Please review again. There are (passing 😄) tests now!

@sathieu
Copy link
Contributor Author

sathieu commented May 28, 2020

Also @xeacott please review ...

@xeacott
Copy link
Contributor

xeacott commented May 29, 2020

Oh yes will do, thanks for writing those tests!

@xeacott xeacott requested review from waynew and xeacott May 29, 2020 19:28
waynew
waynew previously approved these changes May 29, 2020
Copy link
Contributor

@waynew waynew left a comment

Choose a reason for hiding this comment

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

@xeacott Tests look good to me - I'd double check the docs to make sure we don't specify a different behavior (I'm guessing not).

xeacott
xeacott previously approved these changes May 29, 2020
@xeacott xeacott added Merge Ready and removed Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases labels May 29, 2020
Ch3LL
Ch3LL previously approved these changes Aug 5, 2020
@sathieu
Copy link
Contributor Author

sathieu commented Aug 26, 2020

@xeacott You've marked this PR Merge Ready. I've now rebased and fixed pre-commit and Pylint. Hope you merge it now ...

@dwoz dwoz merged commit cc56c46 into saltstack:master Sep 9, 2020
@sagetherage sagetherage added the Magnesium Mg release after Na prior to Al label Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Magnesium Mg release after Na prior to Al
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refresh git_pillar on master start
6 participants