func TestInvokeRectifyDryruns(t *testing.T) { assert := assert.New(t) require := require.New(t) testDryRun := func(which string) (sous.Deployer, sous.Registry) { exe := justCommand(t, []string{`sous`, `rectify`, `-dry-run`, which, `-repo`, `github.com/somewhere`}) assert.Len(exe.Args, 0) require.IsType(&SousRectify{}, exe.Cmd) rect := exe.Cmd.(*SousRectify) // currently no easy way to tell if the deploy client is live or dummy return nil, rect.Resolver.Registry } _, r := testDryRun("both") assert.IsType(&sous.DummyRegistry{}, r) _, r = testDryRun("none") assert.IsType(&docker.NameCache{}, r) _, r = testDryRun("scheduler") assert.IsType(&docker.NameCache{}, r) _, r = testDryRun("registry") assert.IsType(&sous.DummyRegistry{}, r) }
/* usage: sous <command> sous is a tool to help speed up the build/test/deploy cycle at your organisation subcommands: build build your project config view and edit sous configuration context show the current build context deploy initialise a new sous project help get help with sous init initialise a new sous project query build your project rectify force Sous to make the deployment match the contents of the local state directory version print the version of sous options: -d debug: output detailed logs of internal operations -q quiet: output only essential error messages -s silent: silence all non-essential output -v loud: output extra info, including all shell commands */ func TestInvokeBareSous(t *testing.T) { assert := assert.New(t) require := require.New(t) log.SetFlags(log.Flags() | log.Lshortfile) c, exe, _, _ := prepareCommand(t, []string{`sous`}) assert.Len(exe.Args, 0) var r cmdr.Result c.InvokeWithoutPrinting([]string{"sous", "help"}) require.NotPanics(func() { r = c.InvokeWithoutPrinting([]string{"sous", "help"}) }) assert.IsType(cmdr.SuccessResult{}, r) }
// IsType asserts that the specified objects are of the same type. func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { if !assert.IsType(t, expectedType, object, msgAndArgs...) { t.FailNow() } }