Skip to content

chore: stable bvt/result_count.sql result check and enable load_data_LOCAL_infile case - #16474

Merged
mergify[bot] merged 10 commits into
matrixorigin:mainfrom
xzxiong:fix_ut_result_count
May 30, 2024
Merged

mergify[bot] merged 10 commits into
matrixorigin:mainfrom
xzxiong:fix_ut_result_count

Conversation

@xzxiong

@xzxiong xzxiong commented May 29, 2024 •

Copy link
Copy Markdown
Contributor

User description

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue ##14836, #16424

What this PR does / why we need it:

changes:

  1. sepract check op from result_count/result_count.sql and put it into zz_statement_query_type/result_count.sql
  2. active bvt load data LOCAL infile

PR Type

Bug fix, Tests


Description

  • Simplified and updated the result count test cases by removing redundant checks and focusing on account creation and deletion.
  • Moved result check operations from result_count.sql to zz_statement_query_type/result_count.sql for better organization.
  • Enhanced result checks by adding detailed operations for specific cases in the new location.

Changes walkthrough 📝

Relevant files
Tests
result_count.result
Simplify and update result count test cases                           

test/distributed/cases/result_count/result_count.result

  • Removed multiple test cases and result checks.
  • Updated account creation and deletion test cases.
  • +2/-62   
    result_count.sql
    Update and clean up result count SQL tests                             

    test/distributed/cases/result_count/result_count.sql

  • Updated account creation and deletion test cases.
  • Removed result check operations.
  • +4/-8     
    result_count.result
    Add detailed result checks for statement query types         

    test/distributed/cases/zz_statement_query_type/result_count.result

  • Added result check operations for specific cases.
  • Included detailed result checks for account operations.
  • +59/-0   
    result_count.sql
    Move and enhance result check operations                                 

    test/distributed/cases/zz_statement_query_type/result_count.sql

  • Moved result check operations from result_count.sql.
  • Added specific case checks for statement queries.
  • +15/-0   

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    … into zz_statement_query_type/result_count.sql
    @qodo-code-review

    Copy link
    Copy Markdown

    PR Review 🔍

    ⏱️ Estimated effort to review [1-5]

    2, because the changes are mostly about moving and simplifying SQL test cases, which are straightforward to review. The logic is not complex, and the modifications are well-documented.

    🧪 Relevant tests

    Yes

    ⚡ Possible issues

    Possible Bug: The removal of many test cases might reduce coverage unless they are redundant or replaced. It's important to ensure that the removed tests are either no longer relevant or adequately covered by new or existing tests.

    🔒 Security concerns

    No

    @matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label May 29, 2024
    @mergify mergify Bot added the kind/bug Something isn't working label May 29, 2024
    @mergify mergify Bot added the kind/test-ci label May 29, 2024
    @qodo-code-review

    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Security
    Use a more secure password for the create account statement

    To avoid potential security issues, it's better to use a more secure password for the
    create account statement. Using a simple password like '111' can be easily guessed.

    test/distributed/cases/result_count/result_count.result [137]

    -/* cloud_user */create account bvt_result_count_test_case2 admin_name 'test_account' identified by '111';
    +/* cloud_user */create account bvt_result_count_test_case2 admin_name 'test_account' identified by 'SecureP@ssw0rd!';
     
    Suggestion importance[1-10]: 9

    Why: The suggestion correctly identifies a security risk with using a simple password and proposes a more secure alternative, which is crucial for preventing unauthorized access.

    9
    Best practice
    Use consistent password masking for the create account statement

    To ensure consistency and avoid potential issues, use the same password masking technique
    for the create account statement as used elsewhere in the file.

    test/distributed/cases/zz_statement_query_type/result_count.result [59]

    -create account bvt_result_count_test_case2 admin_name 'test_account' identified by '111';
    +create account bvt_result_count_test_case2 admin_name 'test_account' identified by '******';
     
    Suggestion importance[1-10]: 7

    Why: Ensuring consistency in password masking across files is a good practice for maintaining security standards and avoiding potential leaks of sensitive information.

    7
    Add a comment explaining the purpose of the length(statement) > 0 condition

    To improve readability and maintainability, consider adding a comment explaining why the
    length(statement) > 0 condition is necessary in the select statement query.

    test/distributed/cases/zz_statement_query_type/result_count.sql [11]

    +-- Filter out statements with empty strings as they are not useful for this check
     select statement, result_count from statement_info where account="bvt_result_count" and statement not like '%mo_ctl%' and length(statement) > 0 and status != 'Running' and aggr_count < 1 order by request_at desc limit 50;
     
    Suggestion importance[1-10]: 6

    Why: Adding a comment to explain why a specific condition is used can significantly improve code readability and maintainability. However, the suggestion does not address any functional or security issues directly.

    6
    Possible issue
    Add a delay between account creation and deletion to ensure proper processing

    Adding a delay between the create account and drop account statements can help ensure that
    the account creation is fully processed before attempting to drop it.

    test/distributed/cases/result_count/result_count.sql [107-108]

     /* cloud_user */create account bvt_result_count_test_case2 admin_name 'test_account' identified by '111';
    +select sleep(5); -- Adding a delay to ensure account creation is processed
     /* cloud_user */drop account bvt_result_count_test_case2;
     
    Suggestion importance[1-10]: 5

    Why: While the suggestion to add a delay might help in ensuring account creation is fully processed, it's more of a workaround than a best practice and might not be necessary if the system handles transactions correctly.

    5

    @xzxiong xzxiong changed the title chore: stable bvt/result_count.sql result check chore: stable bvt/result_count.sql result check and active load_data_LOCAL_infile case May 29, 2024
    @xzxiong xzxiong changed the title chore: stable bvt/result_count.sql result check and active load_data_LOCAL_infile case chore: stable bvt/result_count.sql result check and enable load_data_LOCAL_infile case May 29, 2024
    mergify Bot pushed a commit that referenced this pull request May 30, 2024
    …LOCAL_infile case in mo1.2 (#16478)
    
    ref: #16474
    changes:
    1. sepract check op from result_count/result_count.sql and put it into zz_statement_query_type/result_count.sql
    2. active bvt `load data LOCAL infile`
    
    ___
    
    ### **PR Type**
    Bug fix, Tests
    
    
    ___
    
    ### **Description**
    - Refactored test cases for account operations by updating account names and moving result checks to a new file.
    - Added new test cases and result check operations for various SQL statements.
    - Improved the organization and readability of test files by separating concerns.
    
    
    
    ___
    
    
    
    ### **Changes walkthrough** 📝
    <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests
    </strong></td><td><table>
    <tr>
    <td>
    <details>
    <summary><strong>result_count.result</strong><dd><code>Update and streamline test cases for account operations</code>&nbsp; &nbsp; </dd></summary>
    <hr>
    
    test/distributed/cases/result_count/result_count.result
    
    <li>Removed multiple test cases related to account operations and SQL <br>statements.<br> <li> Added new test cases for creating and dropping accounts with a new <br>naming convention.<br>
    
    
    </details>
    
    
    </td>
    <td><a href="https://github.com/matrixorigin/matrixone/pull/16478/files#diff-ecf968a6cabc7ce4f61b9fcd12020afffac6708a05524436be05df75f657dbac">+2/-62</a>&nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
    <td>
    <details>
    <summary><strong>result_count.sql</strong><dd><code>Refactor account operation tests and move result checks</code>&nbsp; &nbsp; </dd></summary>
    <hr>
    
    test/distributed/cases/result_count/result_count.sql
    
    <li>Updated account names in test cases to follow a new naming convention.<br> <li> Removed result check operations and moved them to a new file.<br>
    
    
    </details>
    
    
    </td>
    <td><a href="https://github.com/matrixorigin/matrixone/pull/16478/files#diff-e2b271c7875446831ad9d14d210c620379da79b71ba382c36084115025d6ba4a">+4/-10</a>&nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
    <td>
    <details>
    <summary><strong>result_count.result</strong><dd><code>Add result check operations for SQL statements</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    test/distributed/cases/zz_statement_query_type/result_count.result
    
    <li>Added result check operations for various SQL statements.<br> <li> Included new test cases for verifying statement results.<br>
    
    
    </details>
    
    
    </td>
    <td><a href="https://github.com/matrixorigin/matrixone/pull/16478/files#diff-ac5557e3f8fd12bfa0a56d9ec1cbc3c2c455ae682499b7e7f47211d41ea5158b">+59/-0</a>&nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
    <td>
    <details>
    <summary><strong>result_count.sql</strong><dd><code>Move and enhance result check operations</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    test/distributed/cases/zz_statement_query_type/result_count.sql
    
    <li>Moved result check operations from the original file.<br> <li> Added conditions to filter statements based on length and content.<br>
    
    
    </details>
    
    
    </td>
    <td><a href="https://github.com/matrixorigin/matrixone/pull/16478/files#diff-49a9fa31c7dc2c692eddf676957524c5028a954986ba72ccd7394d826afee892">+15/-0</a>&nbsp; &nbsp; </td>
    
    </tr>
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > 💡 **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
    
    Approved by: @aressu1985, @sukki37
    @mergify
    mergify Bot merged commit 7df447a into matrixorigin:main May 30, 2024
    @xzxiong
    xzxiong deleted the fix_ut_result_count branch May 31, 2024 02:09
    fengttt pushed a commit to fengttt/matrixone that referenced this pull request May 7, 2026
    …LOCAL_infile case (matrixorigin#16474)
    
    changes:
    1. sepract check op from result_count/result_count.sql and put it into zz_statement_query_type/result_count.sql
    2. active bvt `load data LOCAL infile`
    
    Approved by: @aressu1985
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    Bug fix kind/bug Something isn't working kind/test-ci Review effort [1-5]: 2 size/M Denotes a PR that changes [100,499] lines Tests

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants