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

Port #52368 doc requirement tests to master #55914

Merged
merged 41 commits into from
Apr 14, 2020

Conversation

mchugh19
Copy link
Contributor

What does this PR do?

Ports #52368 to master

What issues does this PR fix or reference?

Adds tests to ensure modules have needed doc entries and ensures all defined doc entries have associated modules

Tests written?

Yes

Commits signed with GPG?

No

@mchugh19 mchugh19 requested a review from a team as a code owner January 19, 2020 07:51
@ghost ghost requested a review from xeacott January 19, 2020 07:51
@max-arnold
Copy link
Contributor

Do you think it is possible to also have a test to detect unreachable documentation pages?

#49335
#51153
#53296 (fix)

@mchugh19
Copy link
Contributor Author

@max-arnold Turns out we sure can!

Added a test to check each module's rst for the text ".. _virtual" which successfully detects problems with shadow and service execution module naming.

With this additional check, the doc test is expected to fail based on the mentioned issues with shadow and service. I don't think correcting those should be part of his PR, so waiting for input from core team on next steps. I suggest merging #53296 and an equivalent for service.

@codecov
Copy link

codecov bot commented Jan 19, 2020

Codecov Report

Merging #55914 into master will increase coverage by 0.01%.
The diff coverage is 6.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #55914      +/-   ##
==========================================
+ Coverage      17%      17%   +0.01%     
==========================================
  Files        1202     1202              
  Lines      224545   224679     +134     
  Branches    49238    49266      +28     
==========================================
+ Hits        38153    38177      +24     
- Misses     183555   183632      +77     
- Partials     2837     2870      +33
Flag Coverage Δ
#archlts 16.25% <5.89%> (ø) ⬇️
#centos7 23.76% <8.67%> (-0.01%) ⬇️
#proxy 23.8% <8.67%> (ø) ⬇️
#py2 16.84% <6.17%> (ø) ⬇️
#py3 16.7% <6.17%> (+0.01%) ⬆️
#runtests 17% <6.17%> (+0.01%) ⬆️
#ubuntu1604 23.74% <8.67%> (-0.01%) ⬇️
#zeromq 17% <6.17%> (+0.01%) ⬆️
Impacted Files Coverage Δ
salt/states/xml.py 25% <ø> (ø) ⬆️
salt/modules/x509.py 11.1% <ø> (ø) ⬆️
salt/modules/xml.py 27.28% <ø> (ø) ⬆️
salt/states/ssh_auth.py 4.93% <ø> (ø) ⬆️
salt/states/virt.py 11.41% <ø> (ø) ⬆️
salt/modules/gpg.py 11.54% <ø> (ø) ⬆️
salt/modules/hashutil.py 43.08% <ø> (ø) ⬆️
salt/modules/virt.py 9.81% <ø> (ø) ⬆️
salt/modules/mine.py 23.45% <ø> (ø) ⬆️
salt/modules/saltcheck.py 12.89% <ø> (ø) ⬆️
... and 70 more

@xeacott
Copy link
Contributor

xeacott commented Jan 21, 2020

Looks like some builds are failing

@mchugh19
Copy link
Contributor Author

@xeacott yep! Please review the posted comments. This is creating new tests, some of which are detecting currently broken things and I asked for how the core team wants it handled.

I can remove the test for broken stuff and you can merge the doc fixes. Or the broken stuff can be fixed and you can merge the whole thing. Just let me know what you want here.

@waynew
Copy link
Contributor

waynew commented Apr 8, 2020

Interesting. I'm guessing that something may have incorrectly patched the beacons log, unless it's simply not being set. I'll take a look at this.

@sagetherage sagetherage added Documentation Relates to Salt documentation Tests labels Apr 9, 2020
@waynew
Copy link
Contributor

waynew commented Apr 9, 2020

Hrm. Still seeing that same error, grr. Test passes on its own, no problem.

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.

Found the problem!

tests/unit/beacons/test_log.py Outdated Show resolved Hide resolved
salt/beacons/__init__.py Outdated Show resolved Hide resolved
@@ -37,9 +37,11 @@
except ImportError:
HAS_CRYPT = False

__virtualname__ = "shadow"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also be renaming this file?

Copy link
Contributor

Choose a reason for hiding this comment

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

And I guess the linux_service.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As in, is it appropriate to mv shadow to linux_shadow and service to linux_service? Yes, they have to be updated. See the previous comments for more context.

From above:

Added a test to check each module's rst for the text ".. _virtual" which successfully detects problems with shadow and service execution module naming.
With this additional check, the doc test is expected to fail based on the mentioned issues with shadow and service. I don't think correcting those should be part of his PR, so waiting for input from core team on next steps. I suggest merging #53296 and an equivalent for service.

(The referenced PR was since merged into this one to get the mentioned tests passing)

The issue is #49335 and also #52000. Salt docs generate index pages for virtual modules. Since service is a virtual module name, having a module also named service means that any links to the service module, instead are directed to the virtual module index page. This means that on
https://docs.saltstack.com/en/2018.3/ref/modules/all/salt.modules.service.html you are unable to click on the service module link name in the middle, as it just loads the current page rather than the module doc.

This was a problem for the generically named shadow and service modules. A test was added in this PR to detect modules which duplicate virtual module index names, so they had to be renamed in order to keep tests passing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I'm pretty sure I'm down with that. If we're renaming things only within salt, but they're not part of the API, I think it's a great idea to name them consistently.

If it borked with the public API then we'd have to deprecate things, but if people shouldn't be importing this code themselves then I'm 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know, module file names are not part of the salt api. Advice has always been to call other modules via __salt__['whatever'] rather than direct imports (https://docs.saltstack.com/en/latest/ref/modules/index.html#cross-calling-execution-modules).

Feel free to discuss with the everyone, but as far as I know, this should be a-ok!

@mchugh19
Copy link
Contributor Author

tests are green! (pre-commit looks like a new, not yet working one)

@mchugh19
Copy link
Contributor Author

@waynew thoughts on getting this merged? Already seeing merge conflicts.

@dwoz
Copy link
Contributor

dwoz commented Apr 13, 2020

@waynew LGTM, you good on this now?

@waynew
Copy link
Contributor

waynew commented Apr 13, 2020

@dwoz yeah I'm good 👍

@dwoz dwoz merged commit fed72cb into saltstack:master Apr 14, 2020
@waynew
Copy link
Contributor

waynew commented Apr 14, 2020

@mchugh19 🎉 🚀 📖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Relates to Salt documentation master-port Tests ZRelease-Sodium retired label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants