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

Sizing Calculator: added unit tests and minor restructuring #1551

Merged
merged 16 commits into from
Jun 13, 2024

Conversation

shaharuk-yb
Copy link
Contributor

@shaharuk-yb shaharuk-yb commented Jun 10, 2024

Associated with JIRA tasks:

Function Under Test Test name Test scenario
getSourceMetadata TestGetSourceMetadata_SuccessReadingSourceMetadata successfully able to connect and load the source metadata
getSourceMetadata TestGetSourceMetadata_QueryErrorIfTableDoesNotExistOrColumnsUnavailable if table_index_stat does not exist in the assessment.db or one of the required column does not exist in the table
getSourceMetadata TestGetSourceMetadata_RowScanError verify if the all columns datatypes are correct. Expecting failure in case of unsupported data type. Example: expected column value is int but in assessment.db, float value is provided. Hence, it will fail to read/typecast
getSourceMetadata TestGetSourceMetadata_NoRows verify if there are no rows in the source metadata
shardingBasedOnTableSizeAndCount TestShardingBasedOnTableSizeAndCount_TableWithSizePlacedInColocated validate if the source table of size in colocated limit is correctly placed in colocated table recommendation
shardingBasedOnTableSizeAndCount TestShardingBasedOnTableSizeAndCount_WithIndexes_ColocateAll validate if the source table and index of size in colocated limit is correctly placed in colocated table recommendation
shardingBasedOnTableSizeAndCount TestShardingBasedOnTableSizeAndCount_ColocatedLimitExceededBySize validate if the source table and index of size in colocated limit exceeds the size limit and respective tables need to be put in sharded
shardingBasedOnTableSizeAndCount TestShardingBasedOnTableSizeAndCount_ColocatedLimitExceededByCount validate if the source table and index of size in colocated limit exceeds limit of maximum supported num objects and respective tables need to be put in sharded
shardingBasedOnTableSizeAndCount TestShardingBasedOnTableSizeAndCount_NoColocatedTables validate if the tables of size more than max colocated size supported are put in the sharded tables
shardingBasedOnOperations TestShardingBasedOnOperations_CanSupportOpsRequirement validate that the tables should be removed from colocated and added to sharded as the ops requirement is high
shardingBasedOnOperations TestShardingBasedOnOperations_CannotSupportOpsAndNeedsSharding validate that the tables should be removed from colocated and added to sharded as the ops requirement is higher than supported
checkShardedTableLimit TestCheckShardedTableLimit_WithinLimit validate that the sharded table limits is not exceeded and failure reasoning should be empty
checkShardedTableLimit TestCheckShardedTableLimit_LimitExceeded validate that the sharded table limits is exceeded and failure reasoning is generated as expected
findNumNodesNeededBasedOnThroughputRequirement TestFindNumNodesNeededBasedOnThroughputRequirement_CanSupportOps validate that the throughput requirements are supported and no scaling is needed
findNumNodesNeededBasedOnThroughputRequirement TestFindNumNodesNeededBasedOnThroughputRequirement_NeedMoreNodes validate that the throughput requirements cannot be supported by existing nodes and scaling is needed
findNumNodesNeededBasedOnTabletsRequired TestFindNumNodesNeededBasedOnTabletsRequired_CanSupportTablets validate that the tablets requirements are supported and no scaling is needed
findNumNodesNeededBasedOnTabletsRequired TestFindNumNodesNeededBasedOnTabletsRequired_NeedMoreNodes validate that the tablets cannot be supported by existing nodes and scaling is needed
pickBestRecommendation TestPickBestRecommendation_PickOneWithOptimalNodesAndCores validate if the recommendation with optimal nodes and cores is picked up
pickBestRecommendation TestPickBestRecommendation_PickOneWithOptimalNodesAndCoresWhenSomeHasFailures validate if the recommendation with optimal nodes is picked up when some of the recommendation has failure reasoning
pickBestRecommendation TestPickBestRecommendation_PickLastMaxCoreRecommendationWhenNoneCanSupport validate if the recommendation with optimal nodes and cores is picked up for showing failure reasoning
calculateTimeTakenAndParallelJobsForImport TestCalculateTimeTakenAndParallelJobsForImport_ValidateFormulaToCalculateImportTime validate the formula to calculate the import time
getReasoning TestGetReasoning_NoObjects validate reasoning when there are no objects(empty colocated and sharded objects)
getReasoning TestGetReasoning_OnlyColocatedObjects validate reasoning when there are only colocated objects
getReasoning TestGetReasoning_OnlyShardedObjects validate reasoning when there are only sharded objects
getReasoning TestGetReasoning_ColocatedAndShardedObjects validate reasoning when there are colocated and sharded objects
getReasoning TestGetReasoning_Indexes validate reasoning when there are colocated and sharded objects with indexes

Copy link
Collaborator

@makalaaneesh makalaaneesh left a comment

Choose a reason for hiding this comment

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

Thanks for this @shaharuk-yb , this is very thorough!!
Did not go through all the logic in detail, as you would be the better judge, but the overall structure looks good.

Just had one comment, pls look into that before merging

yb-voyager/src/migassessment/sizing_test.go Show resolved Hide resolved
@shaharuk-yb shaharuk-yb merged commit 810bb55 into main Jun 13, 2024
13 checks passed
@shaharuk-yb shaharuk-yb deleted the sshaikh/sizingv8 branch June 13, 2024 12:25
shaharuk-yb added a commit that referenced this pull request Jun 13, 2024
* sizing calc: added unit tests and minor restructuring
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.

3 participants