refactored overlay class
overlay.GetOverlay(name) returns now an error if the overlay doesn't exist. This is the most canonical way to act if there is no overlay.
This commit is contained in:
committed by
Jonathon Anderson
parent
c17fe8d512
commit
6f4fd60d8f
@@ -29,8 +29,8 @@ func Test_Overlay_List(t *testing.T) {
|
||||
assert.Contains(t, buf.String(), "testoverlay")
|
||||
})
|
||||
t.Run("overlay list all", func(t *testing.T) {
|
||||
baseCmd.SetArgs([]string{"-a"})
|
||||
baseCmd := GetCommand()
|
||||
baseCmd.SetArgs([]string{"-a"})
|
||||
buf := new(bytes.Buffer)
|
||||
baseCmd.SetOut(buf)
|
||||
baseCmd.SetErr(buf)
|
||||
@@ -40,8 +40,8 @@ func Test_Overlay_List(t *testing.T) {
|
||||
assert.Contains(t, buf.String(), "email.ww")
|
||||
})
|
||||
t.Run("overlay list long", func(t *testing.T) {
|
||||
baseCmd.SetArgs([]string{"--long"})
|
||||
baseCmd := GetCommand()
|
||||
baseCmd.SetArgs([]string{"--long"})
|
||||
buf := new(bytes.Buffer)
|
||||
baseCmd.SetOut(buf)
|
||||
baseCmd.SetErr(buf)
|
||||
@@ -50,4 +50,16 @@ func Test_Overlay_List(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, buf.String(), "email.ww")
|
||||
})
|
||||
|
||||
t.Run("overlay list path", func(t *testing.T) {
|
||||
baseCmd := GetCommand()
|
||||
baseCmd.SetArgs([]string{"--path"})
|
||||
buf := new(bytes.Buffer)
|
||||
baseCmd.SetOut(buf)
|
||||
baseCmd.SetErr(buf)
|
||||
wwlog.SetLogWriter(buf)
|
||||
err := baseCmd.Execute()
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, buf.String(), env.BaseDir)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user