shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Configuring Metadata Tests for Specific Databases in ShardingSphere

Open makssent opened this issue 2 years ago • 0 comments

Could you please advise on which databases are typically used for metadata unit tests in ShardingSphere? While exploring parser tests, I noticed that with the InternalSQLParserIT class, it’s possible to run tests for a specific database, which was quite convenient. Now, I’d like to do something similar with metadata tests, but I couldn’t find any direct instructions.

I checked the documentation but couldn’t find any information on how to set this up, so I wanted to ask here in case I might have missed something. If there is a relevant section, please tell me.

In the metadata test configurations, I noticed references to MySQL:

foo_ds:
  password: root
  closed: false
  dataSourceClassName: org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource
  connectionInitSqls:
    - set names utf8mb4;
    - set names utf8;
  url: jdbc:mysql://localhost:3306/foo_ds
  username: root

It looks like mock data and MySQL connections are being used here, but it’s unclear how to configure the tests to run with a specific database (for example, PostgreSQL, MySQL, or other supported databases).

I’d appreciate any guidance on the following:

  1. Which databases are recommended for testing metadata?
  2. Is there a way to run these tests for a specific database, similar to InternalSQLParserIT, and how can I set that up?

My primary goal is to add support for a new database in ShardingSphere. I’ve already added support in the SQL parser tests, but I’m not yet sure how to approach this for metadata. If you could assist me with this, I would greatly appreciate it.

makssent avatar Nov 05 '24 06:11 makssent