1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00

Fail if 'Msf::Framework#threads cleaner' is unnecessary

MSP-11605

The 'Msf::Framework#threads cleaner' shared context fails with a
RuntimeError if `framework.threads?` is false, which would indicate that
cleaning is unnecessary.  This change stops 'Msf::Framework#threads
cleaner' from accessing `framework.threads`, which would create threads
only to immediately clean them up.
This commit is contained in:
Luke Imhoff 2014-11-13 14:22:40 -06:00
parent eb3ff769a9
commit 69e726e2c9
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8

View File

@ -1,5 +1,13 @@
shared_context 'Msf::Framework#threads cleaner' do
after(:each) do
after(:each) do |example|
unless framework.threads?
fail RuntimeError.new(
"framework.threads was never initialized. There are no threads to clean up. " \
"Remove `include_context Msf::Framework#threads cleaner` from context around " \
"'#{example.metadata.full_description}'"
)
end
# explicitly kill threads so that they don't exhaust connection pool
thread_manager = framework.threads