-
Notifications
You must be signed in to change notification settings - Fork 31
Fix CI setup for Windows #352
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,10 +46,13 @@ def initialize | |
Process.setsid | ||
rescue Errno::EPERM | ||
# If we can't set the session ID, continue | ||
rescue NotImplementedError | ||
# setpgrp() may be unimplemented on some platform | ||
# https://github.com/Shopify/ruby-lsp-rails/issues/348 | ||
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. (Let's look into this separately). |
||
end | ||
|
||
stdin, stdout, stderr, wait_thread = Bundler.with_original_env do | ||
Open3.popen3("bin/rails", "runner", "#{__dir__}/server.rb", "start") | ||
Open3.popen3("bundle", "exec", "rails", "runner", "#{__dir__}/server.rb", "start") | ||
end | ||
|
||
@stdin = T.let(stdin, IO) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ class Test < ActiveSupport::TestCase | |
# The last 3 are for the test declaration. | ||
assert_equal(6, response.size) | ||
assert_match("Run", response[3].command.title) | ||
assert_equal("bin/rails test /fake.rb:2", response[3].command.arguments[2]) | ||
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2]) | ||
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. Due to #353 |
||
assert_match("Run In Terminal", response[4].command.title) | ||
assert_match("Debug", response[5].command.title) | ||
end | ||
|
@@ -54,7 +54,7 @@ class Test < ActiveSupport::TestCase | |
# The last 3 are for the test declaration. | ||
assert_equal(6, response.size) | ||
assert_match("Run", response[3].command.title) | ||
assert_equal("bin/rails test /fake.rb:2", response[3].command.arguments[2]) | ||
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2]) | ||
assert_match("Run In Terminal", response[4].command.title) | ||
assert_match("Debug", response[5].command.title) | ||
end | ||
|
@@ -73,7 +73,7 @@ class Test < ActiveSupport::TestCase | |
# The last 3 are for the test declaration. | ||
assert_equal(6, response.size) | ||
assert_match("Run", response[3].command.title) | ||
assert_equal("bin/rails test /fake.rb:2", response[3].command.arguments[2]) | ||
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2]) | ||
assert_match("Run In Terminal", response[4].command.title) | ||
assert_match("Debug", response[5].command.title) | ||
end | ||
|
@@ -144,7 +144,7 @@ def test_example | |
# The last 3 are for the test class. | ||
assert_equal(6, response.size) | ||
assert_match("Run", response[3].command.title) | ||
assert_equal("bin/rails test /fake.rb:2", response[3].command.arguments[2]) | ||
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2]) | ||
assert_match("Run In Terminal", response[4].command.title) | ||
assert_match("Debug", response[5].command.title) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
require "test_helper" | ||
require "ruby_lsp/ruby_lsp_rails/runner_client" | ||
|
||
# tests are hanging in CI. https://github.com/Shopify/ruby-lsp-rails/issues/348 | ||
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. I narrowed it down to this file. 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. Do we still need to skip this test on Windows? If so, let's ship this, but please prioritize unskipping it so that we don't go long with skipped tests. |
||
return if Gem.win_platform? | ||
|
||
module RubyLsp | ||
module Rails | ||
class RunnerClientTest < ActiveSupport::TestCase | ||
|
@@ -54,16 +57,10 @@ class RunnerClientTest < ActiveSupport::TestCase | |
end | ||
|
||
test "failing to spawn server creates a null client" do | ||
FileUtils.mv("bin/rails", "bin/rails_backup") | ||
File.open("bin/rails", "w") do |f| | ||
f.write("foo") | ||
end | ||
File.chmod(0o755, "bin/rails") | ||
|
||
# The error message is slightly different on Ubuntu, so we need to allow for that | ||
FileUtils.mv("test/dummy/config/application.rb", "test/dummy/config/application.rb.bak") | ||
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. Picked this as an arbitrary file to remove to verify boot failure. |
||
assert_output( | ||
"", | ||
%r{Ruby LSP Rails failed to initialize server: bin/rails: (line )?1: foo:( command)? not found}, | ||
/Ruby LSP Rails failed to initialize server/, | ||
) do | ||
client = RunnerClient.create_client | ||
|
||
|
@@ -72,7 +69,7 @@ class RunnerClientTest < ActiveSupport::TestCase | |
assert_predicate(client, :stopped?) | ||
end | ||
ensure | ||
FileUtils.mv("bin/rails_backup", "bin/rails") | ||
FileUtils.mv("test/dummy/config/application.rb.bak", "test/dummy/config/application.rb") | ||
end | ||
|
||
test "is resilient to extra output being printed during boot" do | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
bin/rails
is failing on Windows but appears to still return a successful exit code, which was causing the build to be wrongly marked as passing.