-
Notifications
You must be signed in to change notification settings - Fork 90
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 named pipe to decrease local Windows runtime #220
Merged
Merged
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c8a8442
Use named pipe to decrease local Windows runtime
jerryaldrichiii 4540c4b
Modify named pipe creation to use unique name
jerryaldrichiii 48fa142
Remove `$ProgressPreference = 'SilentlyContinue'`
jerryaldrichiii bed61c5
Modify code to persist pipe usage
jerryaldrichiii fe773e6
Removed pipe argument (default is In/Out)
jerryaldrichiii ccd1a8d
Privatize pipe related functions
jerryaldrichiii 8f2437b
Add fallback to not used pipe if creation fails
jerryaldrichiii 82ffa18
Move Windows local command logic to separate class
jerryaldrichiii 776b8da
Revert file code format
jerryaldrichiii 44a7a6a
Change `@platform` to `@os` for consistency
jerryaldrichiii 9681fe6
Split Windows runners and create a `GenericRunner`
jerryaldrichiii d1ad987
Add test for Windows named pipe usage
jerryaldrichiii 18a4245
Tweak `GenericRunner` and default `run_command`
jerryaldrichiii d3b6f86
Remove `Local::` from `CommandWrapper`
jerryaldrichiii bd2c7c3
Fix test for Windows named pipe
jerryaldrichiii e7d7d32
Make changes to integrate @jquick's cacheing magic
jerryaldrichiii ecad39f
Remove unneeded logic for opening an existing pipe
jerryaldrichiii 7517045
Add comments explaining pipe check tests
jerryaldrichiii d494df2
Change `Shellout` to `ShellOut`
jerryaldrichiii ab34ccc
Change `stubs` to `expects` where appropriate
jerryaldrichiii 824f2e3
Modify pipe tests
jerryaldrichiii 9965ef8
Move/Modify Unit tests and add Integration tests
jerryaldrichiii e63627f
Fix local tests when running with others.
jquick 17d9de7
Minor style changes
jerryaldrichiii 6160bde
Remove extra newline between `let`s
jerryaldrichiii 0bfd1c1
Modify TransportHelper to accept platform options
jerryaldrichiii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,11 @@ | |
class TransportHelper | ||
attr_accessor :transport | ||
|
||
def initialize | ||
def initialize(type = :mock) | ||
Train::Platforms::Detect::Specifications::OS.load | ||
plat = Train::Platforms.name('mock').in_family('linux') | ||
plat = Train::Platforms.name('mock') | ||
plat.add_platform_methods | ||
plat.stubs(:windows?).returns(true) if type == :windows | ||
Train::Platforms::Detect.stubs(:scan).returns(plat) | ||
@transport = Train::Transports::Local.new | ||
end | ||
|
@@ -93,4 +94,36 @@ def mock_run_cmd(cmd, &block) | |
end | ||
end | ||
end | ||
|
||
describe 'when running on Windows' do | ||
let(:connection) { TransportHelper.new(:windows).transport.connection } | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove extra newline - it's more common to group all the |
||
let(:runner) { mock } | ||
|
||
it 'uses `WindowsPipeRunner` by default' do | ||
Train::Transports::Local::Connection::WindowsPipeRunner | ||
.expects(:new) | ||
.returns(runner) | ||
|
||
Train::Transports::Local::Connection::WindowsShellRunner | ||
.expects(:new) | ||
.never | ||
|
||
runner.expects(:run_command).with('not actually executed') | ||
connection.run_command('not actually executed') | ||
end | ||
|
||
it 'uses `WindowsShellRunner` when a named pipe is not available' do | ||
Train::Transports::Local::Connection::WindowsPipeRunner | ||
.expects(:new) | ||
.raises(Train::Transports::Local::PipeError) | ||
|
||
Train::Transports::Local::Connection::WindowsShellRunner | ||
.expects(:new) | ||
.returns(runner) | ||
|
||
runner.expects(:run_command).with('not actually executed') | ||
connection.run_command('not actually executed') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 seems a bit brute-force. Can we accept an options hash and then we can plumb the family in as necessary and let the
Train::Platforms
stuff work normally without stubbing methods on this?Would that work?
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.
Sure will! Great idea. See latest commit.