Skip to content
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

Add maxitest #1441

Open
wants to merge 30 commits into
base: v0-11-dev
Choose a base branch
from
Open

Add maxitest #1441

wants to merge 30 commits into from

Conversation

lgebhardt
Copy link
Member

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

bf4 and others added 26 commits September 19, 2023 14:22
- also add dependabot workflow
- also standardize rails/ruby version quoting/ordering
* refactor: easily quote table/column
* refactor: extract table name when missing
* fix: Reliably quote columns/tables
* refactor: putting quoting methods together
* Handle special case of *
- tests
  * fix: hack mysql test query comparison
* fix: test the adapter-specific query ordering
* test: make order independent
* test: sort order-dependent response
* test: skip failing mysql tests as ok for now
* Restore previous include directives behavior

* Default sort use _primary_key

* Remove support for pluck attributes

* Pass relationship instead of relationship name

* Update copyright date

* Ignore docker-compose override files

* add _relation_name method

* Rework resource class to support using modules for retrieving resources by way of a `resource_retrieval_strategy`

Removes BasicResource class and replaces ActiveRelationResource with a module

* Use `_relationship` helper method

* Add ActiveRelationRetrieval

Allows retrieval of resources by querying the primary table and joining the source table - the opposite of the v10 version

* Skip extra pluck queries when not caching a resource

* Test Cleanup

* Adjust tested query counts based on default_resource_retrieval_strategy

* create_implicit_polymorphic_type_relationships

* Add ActiveRelationRetrievalV09

* Move resource down in the load order

* Use underscore instead of downcase

* Refactor Resource to load retrieval strategy as class loads

* Simplify loading resource retrieval strategy modules

Add SimpleResource that does not load a resource retrieval strategy module

* Remove no longer need deferred_relationship code

* Add warning about potentially unused `records_for_populate`

* Rework loading the resource_retrieval_strategy to fix issue in real projects

* Use SortedSets for resource_identities

* Add sorted_set gem

* Remove rails 5 support
* fix: warnings

* fix: warning

* fix: warnings
* Restore `use_related_resource_records_for_joins` for v0_10

* Handle nil actual hashes

* Add back join_options for v10 compatibility

* Test JoinManager not JoinManagerV10

* Use sql_for_compare to account for different sql dialect quoating
handle gems like GraphQL which override `include?`

```
rake aborted!
ArgumentError: wrong number of arguments (given 1, expected 3)
gems/graphql-2.0.13/lib/graphql/schema/directive.rb:58:in `include?'
```
* Cleanup table definitions for Rails 7.1

* Test helper move require 'rails/test_help'

* Test helper add `config.hosts`

* Update test matrix to add rails 7.1 and remove ruby 2.6

Note: ruby 2.7 is also EOL, but I'm choosing to continue testing 2.7 for now
#1421)

* Namespace references to Rails using `::Rails` to avoid conflicts with other gems

* Use uppercase JSONAPI module name
* Make SortedSet for identity arrays optional

* Fix tests to use sort_related_identities_by_primary_key option override

* Keep SortedSet as a development dependency, unless required

* Remove sorted_set dependency

* Add better messaging about using SortedSet

* Clarify setting sort_criteria for includes vs. related resources
Removes the need to allocate a new array for every comparison
add tests for ResourceIdentity, including that comparison does not allocate memory
* Reduce number of string allocations in LinkBuilder

* Consistently access `include_related`

* Remove unused class variable

* Cache `id` after retrieving it from the model

* Cache `module_path`

* Cache resource_klass_for and resource_type_for

* Remove no longer used method _setup_relationship

* Delete nil values without creating a new object

* Rework resource naming for method caches
* fix: check if relation retrieval in included via included_modules

* require 'jsonapi/relation_retrieval'

* feat: raise when cannot include different retrieval strategy

* test: multiple retrieval strategies

---------

Co-authored-by: lgebhardt <[email protected]>
* refactor: lookup polymorphic types only once

* refactor: polymorphic lookups to utility module

* refactor: separate polymorphic functions

* Refactor into PolymorphicTypesLookup

---------

Co-authored-by: lgebhardt <[email protected]>
* feat: teach JR in tests to parse the response

* use response.parsed_body instead of JSON.parse when evaluating responses in tests

---------

Co-authored-by: lgebhardt <[email protected]>
* chore(deprecation): test_fixture= has been deprecated

in favor of tests_fixtures=

* chore(deprecations): ActiveSupport::Deprecation.silenced

```
ActiveSupport::Deprecation is deprecated and will be removed from Rails
(use Rails.application.deprecators.silenced= instead)
```

* chore(deprecation): prefer ActiveSupport.deprectator

or our own deprecator.

since https://github.com/rails/rails/pull/47354/files
* test: failing request posting sti with polymorphic has one
* fix: polymorphic resource assignment
* Add polymorphic_type_for method
* Favor classify over singularize.camelize

---------

Co-authored-by: lgebhardt <[email protected]>
* chore: fix file typo

* fix: railtie to use correct load hook
* fix: more flexible polymorphic types lookup

* test: add polymorphic lookup tests

they pass on v-11-dev

I'm going to look into the existing lookup warnings

now
```
[POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for fileable
[POLYMORPHIC TYPE] No polymorphic types found for FilePropertiesResource fileable
[POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for respondent
[POLYMORPHIC TYPE] No polymorphic types found for QuestionResource respondent
[POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for respondent
[POLYMORPHIC TYPE] No polymorphic types found for AnswerResource respondent
[POLYMORPHIC TYPE NOT FOUND] No polymorphic types found for keepable
[POLYMORPHIC TYPE] No polymorphic types found for KeeperResource keepable
```

* Revert "test: add polymorphic lookup tests"

This reverts commit 0979a7243b6bc816dd2327d3ff23f70209c52dce.

* feat: easily clear the lookup

* feat: add a descendents strategy

* test: polymorphic type lookup

* feat: make polymorphic type lookup configurable

* feat: clear polymorphic lookup after initialize
@lgebhardt lgebhardt marked this pull request as ready for review January 26, 2024 17:23
@lgebhardt lgebhardt requested a review from bf4 January 26, 2024 17:24
@@ -1,6 +1,9 @@
require 'simplecov'
require 'database_cleaner'

require "maxitest/autorun"
require "maxitest/threads"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👯

we'll want to update lib/bug_report_templates/rails_5_latest.rb and lib/bug_report_templates/rails_5_master.rb at some point as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, those are very out of date in many ways. :-(

@bf4
Copy link
Collaborator

bf4 commented Jan 26, 2024

Confirmed I can run tests locally with this just fine

bundle exec mtest test/integration/requests/request_test.rb

and

bundle exec rake test

and

bundle exec rake test TEST=test/integration/requests/request_test.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants