-
Notifications
You must be signed in to change notification settings - Fork 133
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
Use caching to improve spec performance #136
Use caching to improve spec performance #136
Conversation
@ncs-alane can you please rebase your pr |
We can take the cached part of chef, but I'm not sure how we can proceed with @ncs-alane are you maybe open to provide similar contribution for chef-ssh-hardening ? All other cookbooks (apache, nginx ..) can be updated by myself when I get to them. @atomic111 @chris-rock what is your view on this? |
a09e655
to
52cb3d0
Compare
@atomic111: done! @artem-sidorenko: I would be happy to make further contributions! If you prefer, I can split the caching improvements and the RSpec 3 syntax changes in to separate pull requests. |
@ncs-alane and @artem-sidorenko this would be nice, if we have the same style in all our cookbooks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ncs-alane it looks good to me, see some questions about line breaks and suggestion/idea about spec_helper.
Many thanks for this work! Feel free to open a PR for chef-ssh-hardening and/or other chef hardening cookbooks :)
command: 'chmod go-w -R /usr/local/bin' | ||
) | ||
end | ||
|
||
it 'remove write permission from /usr/sbin' do | ||
expect(chef_run).to run_execute('remove write permission from /usr/sbin').with( | ||
is_expected.to run_execute('remove write permission from /usr/sbin').with( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any special reason why the the lines above got spitted to multiple lines and here not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artem-sidorenko: no special reason. Can we enable the Metrcis/LineLength cop in RuboCop so there is an enforceable rule for when to break lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ncs-alane I did not know/notice its disabled
Yes, feel free to enable it, I usually have it like this
Metrics/LineLength:
Max: 120
This should be probably Ok, what do you think?
I took a look to the .rubocop.yml
in chef-os-hardening and chef-ssh-hardening, maybe it makes sense to go through this file in both repos in a dedicated PRs and see if we can minimize the configured settings and have more defaults from rubocop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default is 80 characters, which is what I recommend as well; 80 character lines display nicely on GitHub without the need for scrolling. Switching over to Cookstyle also seems like a good way to align cookbook style specifically with the Chef community.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, lets stay with 80 and enabling of LineLength cop
Last time I tried cookstyle - it was in the very early stage, I do not know the current state of it. I think its a good idea to check this way, but a dedicated PR would be better for that from my view (in order to get this PR merged as soon as possible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've enabled the 80 character line limit, but I limited it to the spec files since there are a number of violations in other files that need to be addressed separately.
spec/recipes/limits_spec.rb
Outdated
@@ -18,20 +18,24 @@ | |||
require_relative '../spec_helper' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we maybe also change all require_relative
to require 'spec_helper'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make that change. Alternatively, RSpec will read command line configuration options from .rspec
so we can put --require spec_helper
there and remove all of the require
statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ncs-alane good idea, lets do that
Still if `require 'spec_helper' is a more common way, we do not have anything special in the spec_helper, so that should be fine
Can you please add --color
and --format documentation
in the same step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
||
it 'not write log for cpu_vendor fallback' do | ||
is_expected.to_not write_log( | ||
'WARNING: Could not properly determine the cpu vendor. Fallback to ' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any reason for this line break?
- enable color - use documentation format - require spec_helper
@ncs-alane many thanks! |
@ncs-alane as far I remember you wanted to provide a similar contribution for chef-ssh-hardening. Is this still the case and do you know if this is going to happen in the next time? |
@artem-sidorenko I definitely intend on making the contribution; I have just been quite busy lately. 😢 |
No description provided.