microsoft / microsoft/go-sqlcmd

Refactor tools package, to enable dependency injection of run method

Open
#266 0 comments 0 reactions 1 assignee View on GitHub

@stuartpa is already working on this.

Since Feb 28, 2023.

ADS housekeeping testing
Dominant language
Go
Stars
595
Forks
91
Avg merge
9h 35m
Merged PRs (30d)
1

Description

We need a better way of unit testing the sqlcmd code to launch 3rd party UI tools, like ADS and SSMS.

Comment from code reviews:

if !test.IsRunningInTestExecutor() {
	return t.tool.Run(args)
} else {
	return 0, nil
}

"this is another opportunity to introduce dependency inversion where the tests can inject an alternate Run method for a tool. That will enable the tests to validate the correct args are passed based on the current config.
It also allows removal of test-environment-specific code from the product code. " - David

"Agree, this is a good idea and great feedback (I'd become a bit stuck on approach here). I've entered an issue to refactor this package. We've been asked to add SSMS support as well, so when I do that, I'll also refactor with the appropriate interfaces to enable DI here." - Stuart

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.