fix: don't call Apply() twice
For some reason this was called by `Run()`. All tests pass without it, so I'm not sure why it was there. Fixes #481
This commit is contained in:
@@ -2439,3 +2439,27 @@ func TestEmbeddedCallbacks(t *testing.T) {
|
||||
}
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
type applyCalledOnce struct {
|
||||
Dev bool
|
||||
}
|
||||
|
||||
func (c *applyCalledOnce) AfterApply() error {
|
||||
c.Dev = false
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c applyCalledOnce) Run() error {
|
||||
if c.Dev {
|
||||
return fmt.Errorf("--dev should not be set")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestApplyCalledOnce(t *testing.T) {
|
||||
cli := &applyCalledOnce{}
|
||||
kctx, err := mustNew(t, cli).Parse([]string{"--dev"})
|
||||
assert.NoError(t, err)
|
||||
err = kctx.Run()
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user