Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

The Index Advisor testing framework now supports CSV-based batch testing with the required column format: Category, Test Case, Tags, Collection, Positive/Negative, Query, Expected Index Advisor Suggestion, Explanation, Current Index, Comment.

Changes

Type System (test/indexAdvisor/types.ts)

  • Extended TestCase and TestResult interfaces with CSV-specific fields: tags, testType, explanation, currentIndex, comment

CSV Parser (test/indexAdvisor/utils.ts)

  • Implemented case-insensitive column matching with flexible header variants
  • Maintains backward compatibility with old CSV format via fallback column detection
  • Updated output format to preserve all input columns alongside results

Test Execution (test/indexAdvisor/testRunner.ts, runIndexAdvisorTests.ts)

  • Propagate CSV fields through execution pipeline to output
  • Enhanced error handling to include all test case metadata

Configuration

  • Migrated from clusterId to connectionString as primary connection method
  • Example files updated with new format

Documentation

  • Added comprehensive README covering CSV/directory modes, configuration, and usage patterns
  • Created 6 representative test cases demonstrating the CSV format

Example

Input CSV:

Category,Test Case,Tags,Collection,Positive / Negative,Query,Expected Index Advisor Suggestion,Explanation,Current Index,Comment
Missing Index,Test 1,basic;single-field,users,Positive,db.users.find({user_id: 1234}),"db.getCollection('users').createIndex({'user_id':1},{})","No index exists",None,Single field test

Output includes all input columns plus: Suggested Indexes, If Matches Expected, Analysis, Execution Plans, Performance Metrics, Collection Stats, Index Stats, Model Used, Errors, Timestamp.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: node /home/REDACTED/work/vscode-documentdb/vscode-documentdb/node_modules/.bin/vscode-test test/indexAdvisor/csvParser.test.ts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Integrate Testing Framework into Current Implementation</issue_title>
<issue_description>The Index Advisor has changed a little bit since the testing framework implemented. Update and integrate testing framework into current Index Advisor implementation to support testing for the newest version.

Note: You need to update and merge the code in testing framework branch: xingfan/testingframework into current branch: dev/xingfan/removesanitize

The key for this task is integrate the testing framework for current index advisor, so that we can use csv mode to run batch tests. Update the PR and prioritize to implement it

There should be one config file for csv testing, and it should contains the connection string of cluster and testing database name. All the test collection are in that database.

The input csv file to describe test cases with the following columns:
There should be one config file for csv testing, and it should contains the connection string of cluster and testing database name. All the test collection are in that database.

The input csv file to describe test cases with the following columns:
Category,Test Case,Tags,Collection,Positive / Negative,Query,Expected Index Advisor Suggestion,Explanation,Current Index,Comment

The testing framework should run the query from Query command on the collection from Collection column, and record the execution plan, and the suggested from Index advisor. And check if it is the same as expected suggestion from Expected Index Advisor Suggestion column. And record those data along with other fields in origin csv file in the output file.

The testing framework should run the query from Query command on the collection from Collection column, and record the execution plan, and the suggested from Index advisor. And check if it is the same as expected suggestion from Expected Index Advisor Suggestion column. And record those data along with other fields in origin csv file in the output file.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 13, 2025 07:05
- Update TestCase and TestResult interfaces to support new CSV columns
- Update CSV parser to handle new format with backward compatibility
- Update output CSV format to include all input and result columns
- Update example CSV file with new format structure
- Update example config to use connectionString instead of clusterId
- Add comprehensive README documentation for testing framework

Co-authored-by: xingfan-git <[email protected]>
Copilot AI changed the title [WIP] Integrate testing framework into current Index Advisor implementation Integrate CSV-based testing framework for Index Advisor Nov 13, 2025
Copilot AI requested a review from xingfan-git November 13, 2025 07:20
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