Skip to content

Help resolving master test errors #713

@daveomcd

Description

@daveomcd

I'm currently attempting to get the master branch tests to work as there are a bunch of tests that are failing. I have managed to resolve many of the errors in test/cases folder, but it appears the errors I'm now getting are mostly ActiveRecord tests from coerced_tests.rb that haven't been implemented. My knowledge on how to resolve some of these at this point is very limited due to I've not collaborated on many projects. What's the best way to share my current cloned project changes to allow others in assisting fixing these? Creating a pull request?

Current Status

$ bundle exec rake test ONLY_SQLSERVER=1

Finished in 13.108786s, 17.9269 runs/s, 110.0026 assertions/s.
235 runs, 1442 assertions, 0 failures, 0 errors, 1 skips

$ bundle exec rake test ONLY_ACTIVERECORD=1

Finished in 138.995701s, 37.7494 runs/s, 107.3702 assertions/s.
5247 runs, 14924 assertions, 0 failures, 13 errors, 3 skips

An example of a test I tried to correct from one of the 13 errors mentioned above would be the one below:

  coerce_tests! :test_pluck_with_from_includes_quoted_original_table_name
  def test_pluck_with_from_includes_quoted_original_table_name_coerced
    relations = Post.joins(:author).order(:id)
    subquery = Post.from("#{Post.quoted_table_name} /*! USE INDEX (PRIMARY) */").includes(:author).order(:id)
    assert_equal relations.pluck(:id), subquery.pluck(:id)
  end
Error:
RelationTest#test_pluck_with_from_includes_quoted_original_table_name_coerced:
ActiveRecord::StatementInvalid: TinyTds::Error: Ambiguous column name 'id'.: SELECT [id] FROM [posts] /*! USE INDEX (PRIMARY) */ LEFT OUTER JOIN [authors] ON [authors].[id] = [posts].[author_id]  ORDER BY [id] ASC

bin/rails test mnt/c/Users/mcdonaldd/Documents/open_source/sqlserver-main/test/cases/coerced_tests.rb:763

Now to my knowledge I'd expect having to change the following line...

assert_equal relations.pluck(:id), subquery.pluck(:id)

to

assert_equal relations.pluck(:id), subquery.pluck('authors.id')

But, I'm not sure if that really tests for what it's intended to test for... So this is where I'm currently stuck.

Actual Questions:

I've covered a couple of things here so I'll summarize into these two questions...

  1. What's the best way for me to share my current changes so that others might be able to assist me in correcting these tests? Can I do a pull request with the changes even though nothing is really totally resolved?

  2. What would be the approach to fixing the new test I added:
    RelationTest#test_pluck_with_from_includes_quoted_original_table_name_coerced

As I would expect the Ambiguous column 'id' name error if I had not specified which table the id column was supposed to come from...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions