12
"github.com/juju/loggo"
13
jc "github.com/juju/testing/checkers"
11
14
gc "gopkg.in/check.v1"
16
jujucmd "github.com/juju/juju/cmd/juju/commands"
13
17
coretesting "github.com/juju/juju/testing"
16
20
var runFeatureTests = flag.Bool("featuretests", true, "Run long-running feature tests.")
22
25
if *runFeatureTests == false {
39
42
gc.Suite(&dumpLogsCommandSuite{})
40
43
gc.Suite(&undertakerSuite{})
41
44
gc.Suite(&upgradeSuite{})
45
gc.Suite(&CmdRelationSuite{})
43
47
// TODO (anastasiamac 2016-07-19) Bug#1603585
44
48
// These tests cannot run on windows - they require a bootstrapped controller.
51
func TestPackage(t *stdtesting.T) {
55
func TestPackage(t *testing.T) {
52
56
coretesting.MgoTestPackage(t)
59
func runCommand(c *gc.C, args ...string) (*cmd.Context, error) {
60
// Writers need to be reset, because
61
// they are set globally in the juju/cmd package and will
62
// return an error if we attempt to run two commands in the
65
ctx := coretesting.Context(c)
66
command := jujucmd.NewJujuCommand(ctx)
67
return coretesting.RunCommand(c, command, args...)
70
func runCommandExpectSuccess(c *gc.C, command string, args ...string) {
71
_, err := runCommand(c, append([]string{command}, args...)...)
72
c.Assert(err, jc.ErrorIsNil)
75
func runCommandExpectFailure(c *gc.C, command, expectedError string, args ...string) {
76
context, err := runCommand(c, append([]string{command}, args...)...)
77
c.Assert(err, gc.ErrorMatches, "cmd: error out silently")
78
c.Assert(coretesting.Stderr(context), jc.Contains, expectedError)