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

Ignore tests when reloading files #13988

Merged

Conversation

adfoster-r7
Copy link
Contributor

@adfoster-r7 adfoster-r7 commented Aug 12, 2020

Before

When spec files are changed, this causes issues with the reload_lib command:

msf6 exploit(windows/smb/psexec) > echo ' ' >> spec/lib/msf/core/author_spec.rb
[*] exec: echo ' ' >> spec/lib/msf/core/author_spec.rb

msf6 exploit(windows/smb/psexec) > reload_lib -a
[*] Reloading /Users/adfoster/Documents/code/metasploit-framework/spec/lib/msf/core/author_spec.rb
[-] Error while running command reload_lib: cannot load such file -- spec_helper

After

The reload_lib command works, ignoring spec file changes:

msf6 exploit(windows/smb/psexec) > echo ' ' >> spec/lib/msf/core/author_spec.rb
[*] exec: echo ' ' >> spec/lib/msf/core/author_spec.rb

msf6 exploit(windows/smb/psexec) > reload_lib -a
msf6 exploit(windows/smb/psexec) >

Verification

List the steps needed to make sure this thing works

  • Modify an arbitrary spec file: echo ' ' >> spec/lib/msf/core/author_spec.rb
  • Start msfconsole
  • reload_lib -a
  • Verify there is no crash

@adfoster-r7 adfoster-r7 force-pushed the ignore-tests-when-reloading-files branch from 0debf3b to 5970984 Compare August 12, 2020 16:10
@gwillcox-r7 gwillcox-r7 self-assigned this Aug 12, 2020
@gwillcox-r7
Copy link
Contributor

Confirmed this is an issue before the patch:

msf6 > echo ' ' >> spec/lib/msf/core/author_spec.rb
[*] exec: echo ' ' >> spec/lib/msf/core/author_spec.rb

msf6 > reload_lib -a
[*] Reloading /home/gwillcox/git/metasploit-framework/spec/lib/msf/core/author_spec.rb
[-] Error while running command reload_lib: cannot load such file -- spec_helper
msf6 > exit

After patch:

msf6 > echo ' ' >> spec/lib/msf/core/author_spec.rb
[*] exec: echo ' ' >> spec/lib/msf/core/author_spec.rb

msf6 > reload_lib -a
msf6 >

Code also looks good, will land this in so long.

@gwillcox-r7 gwillcox-r7 merged commit 9f17dda into rapid7:master Aug 12, 2020
@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented Aug 12, 2020

Release Notes

Improved the Framework reload-changed-files logic to skip RSpec test files. Previously, commands like reload_lib -a would return an error attempting to load these test files.

@gwillcox-r7 gwillcox-r7 added the rn-enhancement release notes enhancement label Aug 12, 2020
@adfoster-r7 adfoster-r7 deleted the ignore-tests-when-reloading-files branch August 12, 2020 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants