ruby-lsp icon indicating copy to clipboard operation
ruby-lsp copied to clipboard

Smoke test against a minimal Ruby project

Open andyw8 opened this issue 2 years ago • 5 comments

Background

https://github.com/Shopify/ruby-lsp/pull/698 wasn't caught because we were testing against a codebase which had already required uri.

Approach

To help prevent bugs such as https://github.com/Shopify/ruby-lsp/pull/698, we want to create a basic smoke test against a very minimal project. As a starting point this could just ensure that Ruby LSP boots successfully.

andyw8 avatar Jun 03 '23 21:06 andyw8

Hey @andyw8, do we have a list of basic functionalities that should be tested ?

giovannism20 avatar Sep 20 '23 01:09 giovannism20

Hi @giovannism20,

At the minimal, I think we'd want to test against having no Gemfile, and against a Rails app Gemfile.

Checking with @vinistock, he suggested the approach shown below. It's similar to what we do in test/integration_test.rb currently, but would be better isolated:

class FullIntegrationTest < Minitest::Test
  def test_no_gemfile
    # create tmpdir with no gemfile
    
    # boot LSP
    stdin, stdout, stderr, wait_thr = Open3.popen3("exe/ruby-lsp")
    
    # run many requests and verify the return
    # (look at `integration_test` for ideas)
    verify_requests(stdin, stdout, stderr, wait_thr)
  end

  def test_rails_gemfile
    # create gemfile similar the how a brand new rails app would look, but with ruby-lsp added
  end

  def test_something_else
    # ...
  end
end

andyw8 avatar Sep 20 '23 14:09 andyw8

Would it be interesting to put this in another test file @andyw8 ?

giovannism20 avatar Sep 20 '23 15:09 giovannism20

Yes, e.g. test/full_integration_test.rb

andyw8 avatar Sep 20 '23 15:09 andyw8

Another situation which this would have probably caught:

https://github.com/Shopify/ruby-lsp/pull/1068

andyw8 avatar Oct 10 '23 13:10 andyw8

Not a priority, so let's close for now.

andyw8 avatar Aug 28 '24 17:08 andyw8