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

Parametermized tests for Rewrite module. #1548

Closed
tristaZero opened this issue Dec 3, 2018 · 3 comments · Fixed by #3277 or #3299
Closed

Parametermized tests for Rewrite module. #1548

tristaZero opened this issue Dec 3, 2018 · 3 comments · Fixed by #3277 or #3299

Comments

@tristaZero
Copy link
Contributor

tristaZero commented Dec 3, 2018

We will add parameter tests for rewrite module to ensure the rewriting correct and improve the test coverge.

The basic processing is as follow:

  1. ParseResult.xml --->ParseResultEntity-->SQLStatemtent-->Optimize()-->OptimizedResult.xml-->ShardingConditions

  2. ShardingConditions+OptimizedResult.xml-->
    ShardingConditions+SQLStatemtent-->SQLRewriteEngine-->Rewrite()-->SQLBuilder-->Actual SQLs

  3. RewriteResult.xml-->Excpected SQLs

  4. Assert(Actual SQLs, Excpected SQLs)-->AssertMessage-->Output.

@terrymanu terrymanu changed the title Parameter tests for Rewrite module. Parametermized tests for Rewrite module. Dec 20, 2018
@terrymanu terrymanu added this to the 4.0.0.M1 milestone Jan 3, 2019
@terrymanu terrymanu removed this from the 4.0.0.M1 milestone Mar 20, 2019
@terrymanu terrymanu assigned terrymanu and unassigned tristaZero Jun 12, 2019
@terrymanu terrymanu removed their assignment Sep 6, 2019
@terrymanu
Copy link
Member

terrymanu commented Oct 10, 2019

After rewrite module refactor already finished, we can redefine tasks for rewrite test module.

  • Use yaml to setup encrypt rewrite engine
  • Use parse engine to setup SQLStatementContext
  • Unify sharding and encrypt's configuration of table names and column names
  • Use Parametermized test and XML to setup encrypt rewrite test engine
  • Use Parametermized test and XML to setup sharding rewrite test engine
  • Use Parametermized test and XML to setup mix for sharding + encrypt rewrite test engine

@terrymanu
Copy link
Member

terrymanu commented Oct 10, 2019

Parametermized test's xml definition:

<rewrite-assertions yaml-rule="xxx.yaml">
    <rewrite-assertion sql-case-id="xxx" parameters="xx, xx" rewrited-sql="xxx" rewrited-parameters="xx, xx" />
</rewrite-assertions>

Attributes parameters and ewrited-parameters are optional.

@terrymanu
Copy link
Member

finally, the xml definition is:

<rewrite-assertions yaml-rule="xxx.yaml">
    <rewrite-assertion id="xxx" db-type="xxx">
        <input sql="xxx" parameters="x, x" />
        <output sql="xxx" parameters="x, x" />
    </rewrite-assertion>
</rewrite-assertions>

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

Successfully merging a pull request may close this issue.

2 participants