mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Cache MockLoader.connection.
Speeds up test/unit/profile/profile_context_test from 7-8s to 0.5s. Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
a0ffa67b71
commit
313f3462ca
1 changed files with 5 additions and 1 deletions
|
@ -42,6 +42,10 @@ class MockLoader
|
|||
@platform = OPERATING_SYSTEMS[os]
|
||||
end
|
||||
|
||||
def self.connection
|
||||
@connection ||= Train.create("local", command_runner: :generic).connection
|
||||
end
|
||||
|
||||
def backend
|
||||
return @backend if defined?(@backend)
|
||||
|
||||
|
@ -52,7 +56,7 @@ class MockLoader
|
|||
mock = @backend.backend
|
||||
|
||||
# create all mock files
|
||||
local = Train.create("local", command_runner: :generic).connection
|
||||
local = MockLoader.connection
|
||||
|
||||
# set os emulation
|
||||
mock.mock_os(@platform)
|
||||
|
|
Loading…
Reference in a new issue