service-catalog-cli/docs
Carolyn Van Slyck 7248844c68 Add our first unit test (#74)
* Vendor github.com/pkg/errors

This makes it much easier to track down where a test failed

* Enable running a command directly from a test

* Add failing test for svcat get brokers

* Rely on go 1.9 to only run non-vendored tests

Not a huge deal regardless, because dep prune removes tests from vendor.

* Prototype unit test structure for testing the cli

There are some changes here (notably the constructor for
output.NewListTable2) that won't survive but allowed me to avoid
changing the entire CLI while considering the design.

* Explain how to run tests in the contributing guide

* Compile with go 1.9

This helps with our unit testing adding support for
* go test ./... (which no longer hits vendor/)
* t.Helper() which fixes stack traces for asserts

* Note that Go 1.9 is required

* Enable passing --kubeconfig from unit tests

Previously we were loading the kubeconfig before the command was
executed and read directly from os.Args. Now we wait for cobra to parse
the command/args, and then load the kubeconfig.

* Use fake k8s api during tests

The test http handler returns canned responses based on the URL.
Anything more complicated should be an integration test.

* Remove commented out cert settings from fake kubeconfig

* Always print to the testable output

* Sweep for fmt.Print* and swap with fmt.Fprint*
* Remove loggers so that all output goes to the same writer

* Fix failing unit test

I ran go test ./... --update=true
ok  	github.com/Azure/service-catalog-cli/cmd/svcat	0.066s
?   	github.com/Azure/service-catalog-cli/internal/test	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/binding	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/broker	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/class	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/command	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/environment	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/instance	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/kube	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/output	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/plan	[no test files]
?   	github.com/Azure/service-catalog-cli/pkg/traverse	[no test files]
2017-12-18 15:20:08 -08:00
..
contributing.md Add our first unit test (#74) 2017-12-18 15:20:08 -08:00
index.md Document release process (#75) 2017-12-18 15:01:59 -08:00
maintainers.md Document release process (#75) 2017-12-18 15:01:59 -08:00
reviewing.md Add contributing and reviewing guides (#23) 2017-11-21 11:55:42 -08:00