microsoft / microsoft/finops-toolkit

Break New-FinOpsTestData into smaller composable commands

Open
#2,017 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Tool: PowerShell Type: Feature 💎
Dominant language
PowerShell
Stars
603
Forks
248
Avg merge
7d 11h
Merged PRs (30d)
11

Description

Summary

Refactor New-FinOpsTestData into smaller, composable commands — one per dataset type — to improve maintainability and allow independent use.

Motivation

New-FinOpsTestData is a large (~2,400+ line) monolithic function that generates all 5 FOCUS datasets. Breaking it into smaller commands would:

  • Make each dataset generator independently testable and usable
  • Reduce complexity per function
  • Allow users to generate only the datasets they need
  • Follow PowerShell best practices for single-responsibility commands

Proposed commands

  • New-FinOpsTestCostData — generates Costs dataset rows
  • New-FinOpsTestPriceData — generates Prices dataset rows
  • New-FinOpsTestCommitmentData — generates CommitmentDiscountUsage dataset rows
  • New-FinOpsTestRecommendationData — generates Recommendations dataset rows
  • New-FinOpsTestTransactionData — generates Transactions dataset rows
  • New-FinOpsTestData — orchestrator that calls the above and handles file output, storage upload, and manifest generation

Considerations

  • Shared helper logic (provider templates, column definitions, FOCUS version filtering) should be extracted into internal/private functions
  • Each sub-command should accept common parameters (-Providers, -FocusVersion, -Months, -Seed, etc.)
  • Maintain backward compatibility — New-FinOpsTestData should continue to work as-is

Context

Deferred from PR #2006 (New-FinOpsTestData and Remove-FinOpsTestData).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the New-FinOpsTestData command and reviewing the deferred work from PR #2006. Trace how it generates the five FOCUS datasets and handles file output, storage upload, and manifest generation. Done means the five dataset commands are independently usable while New-FinOpsTestData preserves backward-compatible behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.