Implement the debug flag and help command

I'm vacillating about the choice to have separate Config structs in the
`helm` and `run` packages. I can't tell whether it's "good separation of
concerns" or "cumbersome and over-engineered." It seems appropriate at
the moment, though.
This commit is contained in:
Erin Call
2019-12-09 16:25:47 -08:00
parent 446c6f1761
commit 4cbb4922fb
8 changed files with 260 additions and 63 deletions

View File

@@ -25,15 +25,13 @@ func (suite *PlanTestSuite) TestNewPlanUpgradeCommand() {
plan, err := NewPlan(cfg)
suite.Require().Nil(err)
suite.Equal(1, len(plan.steps))
suite.Require().Equal(1, len(plan.steps))
switch step := plan.steps[0].(type) {
case *run.Upgrade:
suite.Equal("billboard_top_100", step.Chart)
suite.Equal("post_malone_circles", step.Release)
default:
suite.Failf("Wrong type for step 1", "Expected Upgrade, got %T", step)
}
suite.Require().IsType(&run.Upgrade{}, plan.steps[0])
step, _ := plan.steps[0].(*run.Upgrade)
suite.Equal("billboard_top_100", step.Chart)
suite.Equal("post_malone_circles", step.Release)
}
func (suite *PlanTestSuite) TestNewPlanUpgradeFromDroneEvent() {
@@ -51,3 +49,15 @@ func (suite *PlanTestSuite) TestNewPlanUpgradeFromDroneEvent() {
suite.IsType(&run.Upgrade{}, plan.steps[0], fmt.Sprintf("for event type '%s'", event))
}
}
func (suite *PlanTestSuite) TestNewPlanHelpCommand() {
cfg := Config{
Command: "help",
}
plan, err := NewPlan(cfg)
suite.Require().Nil(err)
suite.Equal(1, len(plan.steps))
suite.Require().IsType(&run.Help{}, plan.steps[0])
}