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

Feature/singlestore integration tests #12

Merged
merged 6 commits into from
Sep 30, 2024

Conversation

Rodriguespn
Copy link
Collaborator

@Rodriguespn Rodriguespn commented Aug 30, 2024

Integration Tests

Copied and renamed every mysql reference to singlestore on integration-tests directory

Key differences between MySQL vs SIngleStore IT Tests

  • Renamed all references from MySQL to SingleStore in the integration tests directory.
  • The tests are performed against the singlestore-dev docker image, to replicate a production environment
  • SingleStore's serial column type only assures uniqueness of the column values. The tests were modified to (set operation tests in particular) to expect SingleStore-specific behavior, by adding an ORDER BY instruction to every select instruction.
  • ORDER BY and LIMIT cannot be chained together.
  • Removed SingleStore proxy package and its IT tests. If it's necessary, this package can be replicated from the MySQLL proxy package later
  • The foreign key integration tests were removed since they are not supported by singlestore
  • Removed intersectAll and exceptAll tests since these operations are not supported by SIngleStore
  • Removed nested transaction tests since this feature is not supported by SingleStore
  • Removed isolationLevel config and tests as singlestore only supports one isolationLevel

Side notes

There are some SingleStore-specific operations, such as attach/detach, create/drop milestone and optimyzeTable for column stores tables, that are implemented on drizzle-orm/src/singlestore-core but not on drizzle-kit. There are also no integration tests for these operations. This is a known issue and should be fixed in the upcoming releases.

The relational tests that included nested selects with aggregations functions were skipped since SingleStore doesn't support it

@Rodriguespn Rodriguespn added the enhancement New feature or request label Aug 30, 2024
@Rodriguespn Rodriguespn force-pushed the feature/singlestore-integration-tests branch from 9ea059b to e79e6e9 Compare August 30, 2024 09:40
@Rodriguespn Rodriguespn force-pushed the feature/singlestore-integration-tests branch from 5a8ad0e to fced943 Compare August 30, 2024 11:55
@Rodriguespn Rodriguespn marked this pull request as ready for review September 6, 2024 16:35
@Rodriguespn Rodriguespn force-pushed the feature/singlestore-integration-tests branch 3 times, most recently from b1b7672 to 1f47600 Compare September 6, 2024 17:12
@Rodriguespn Rodriguespn force-pushed the feature/singlestore-integration-tests branch 2 times, most recently from 14712f6 to a5f5f71 Compare September 6, 2024 17:17
@Rodriguespn
Copy link
Collaborator Author

@apeng-singlestore @mitchwadair @tiagoacastro @drodrigues4 is ready to be reviewed

@mitchwadair
Copy link
Collaborator

Cool, I'll take a look soon 👍

@apeng-singlestore
Copy link
Collaborator

Notable Changes

  • Renamed all references from MySQL to SingleStore in the integration tests directory.
  • Modified timestamp precision and other minor test adjustments
  • Updated the test environment to use the SingleStore dev Docker image.

Known Issues:

  • SingleStore does not order by by default, so some test expectations (set operation tests in particular) were modified to expect SingleStore-specific behavior
  • ORDER BY and LIMIT cannot be chained together.
  • INTERSECT ALL, EXCEPT ALL, and nested transaction operations are not supported and associated tests were removed
  • Only one isolationLevel is supported, so associated tests and config options were removed

@Rodriguespn
Copy link
Collaborator Author

Thank you @apeng-singlestore. I updated the PR's description with your notable changes/known issues

Copy link
Collaborator

@mitchwadair mitchwadair left a comment

Choose a reason for hiding this comment

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

Generally LGTM, just a few comments. Very exciting!

@mitchwadair
Copy link
Collaborator

I also updated the main PR description with @apeng-singlestore's notes

"name"
],
"isUnique": true,
"using": "btree"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this should be here after removing using method

@Rodriguespn Rodriguespn force-pushed the feature/singlestore-integration-tests branch 2 times, most recently from e4c786a to 9f50061 Compare September 20, 2024 15:33
@Rodriguespn Rodriguespn force-pushed the feature/singlestore-integration-tests branch from 9f50061 to bab7f4a Compare September 20, 2024 15:33
Rodriguespn and others added 3 commits September 25, 2024 17:16
* created singlestore-proxy from mysql-proxy

* singlestore integration tests

* Added singlestore docker image to integration tests

* singlestore custom integration tests pass

* fix most of singlestore.test.ts integration tests

* rewrite init.sql for each docker container

* fix 'having' singlstore-prefixed.test.ts  integration tests

* removed nested transaction tests

* changed timestamps precision to 6 and other minor IT tests fixes

* fixed "set operations (union) from query builder with subquery" test

* lint

* fix "'set operations (union all) from query builder'" test

* fix union all and intersect as function tests

* fix set operations (intersect) from query builder and as function tests

* Remove intersect all tests

'INTERSECT ALL' is not supported by SingleStore

* Fix except tests

* Removed additional intersectall tests

* Fixed mixed and mixed all tests

* remove .only

* timestamp timezone test fix

* fix select from subquery sql it test

* Remove new column types (#11)

* rm new columns, will add back in alter PR

* rm bson, index references

* Remove new column types (#11)

* rm new columns, will add back in alter PR

* rm bson, index references

* Fix timestamp timezone test

* fix build query insert with onDuplicate

* fix UTC config for datetime: remove datetime as string as it is unsupported

* fixed onupdate tests

need to find exact match on update as singlestore doesn't guarantee order

* Fixed returningid test

batch insert autoincrements serial columns in singlestore, so updated test code to reflect that

* remove .only

* Fixed flaky mixed all test

Added two possible outputs because order is not guaranteed

* removed except all tests

* Removed additional exceptall tests

* Readded sqlite except tests

* fix linting

* remove unnecessary 'desc' import

* Cleaned up logic for mixed all test

* Fixed docker container flakiness

* remove .only

* created singlestore-proxy from mysql-proxy

* singlestore integration tests

* Added singlestore docker image to integration tests

* singlestore custom integration tests pass

* fix most of singlestore.test.ts integration tests

* rewrite init.sql for each docker container

* fix 'having' singlstore-prefixed.test.ts  integration tests

* fixed "set operations (union) from query builder with subquery" test

* changed timestamps precision to 6 and other minor IT tests fixes

* lint

* fix "'set operations (union all) from query builder'" test

* fix union all and intersect as function tests

* fix set operations (intersect) from query builder and as function tests

* Fix except tests

* removed nested transaction tests

* Fixed mixed and mixed all tests

* remove .only

* timestamp timezone test fix

* fix select from subquery sql it test

* Remove intersect all tests

'INTERSECT ALL' is not supported by SingleStore

* Removed additional intersectall tests

* Fix timestamp timezone test

* fix build query insert with onDuplicate

* fix UTC config for datetime: remove datetime as string as it is unsupported

* fixed onupdate tests

need to find exact match on update as singlestore doesn't guarantee order

* Fixed returningid test

batch insert autoincrements serial columns in singlestore, so updated test code to reflect that

* remove .only

* Fixed flaky mixed all test

Added two possible outputs because order is not guaranteed

* removed except all tests

* Removed additional exceptall tests

* Readded sqlite except tests

* fix linting

* remove unnecessary 'desc' import

* Cleaned up logic for mixed all test

* Fixed docker container flakiness

* remove .only

* removed transaction isolationlevel tests as singlestore only has one isolationlevel: https://docs.singlestore.com/cloud/getting-started-with-singlestore-helios/about-singlestore-helios/singlestore-helios-faqs/durability/

* removed transaction isolationlevel tests as singlestore only has one isolationlevel: https://docs.singlestore.com/cloud/getting-started-with-singlestore-helios/about-singlestore-helios/singlestore-helios-faqs/durability/

* fix linting

* removed isolation level since S2 only supports READ COMMITTED isolation level

* rm mode

* SingleStore2 -> SingleStoreDriver

* fix tsc

* rm unused dialect func

* lint fix

* fix type test

* fix integration tests

* update brocli version

* Added singlestore docker image to integration tests

* singlestore custom integration tests pass

* merge all commits

* create singlestore replicas tests

* change mysql protocol to singlestore on integration tests connection string remove .only

* Delete test-docker.js

* Delete init.sql

* Removed comment

* removed singlestoreproxy references

* new singlestore relational and duplicated IT tests

* add planetscale mode to allow for tests with schema

* Removed + skipped unsupported tests

Nested Scalar Subselects in Project List: "The query cannot be executed. SingleStore does not support this type of query: nested scalar subselects in project list."

Subselect in Aggregate Functions (duplicates.test and test):

"Feature 'Subselect in aggregate functions' is not supported by SingleStore. Near '(select json_agg(JSON_BUILD_OBJECT(...)) at line 1, character ...'."

* Updated remaining non-skipped tests to be order agnostic

* fixed two additional tests to be order agnostic

* skipping not supported relational it tests

* skipped unsupported tests

* remove 'mode' from relational it tests

* Delete skip-failing-tests.js

---------

Co-authored-by: apeng-singlestore <[email protected]>
Co-authored-by: Mitchell Adair <[email protected]>
Co-authored-by: Mitchell Adair <[email protected]>
Co-authored-by: Alex Blokh <[email protected]>
Copy link
Collaborator Author

@Rodriguespn Rodriguespn left a comment

Choose a reason for hiding this comment

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

LGTM 🚀
Removed the generated files from the integration-tests/tests/prisma directory since they no longer exist in the Drizzle official repository

@apeng-singlestore
Copy link
Collaborator

LGTM!

@apeng-singlestore apeng-singlestore merged commit 9151924 into main Sep 30, 2024
3 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants