Fix excessive line spacing issue when listing nodes

Signed-off-by: xu yang <xyang@ciq.com>
This commit is contained in:
xu yang
2024-09-24 04:08:30 +00:00
committed by Jonathon Anderson
parent d24a92965f
commit aa8282ad10
9 changed files with 78 additions and 72 deletions

View File

@@ -13,6 +13,7 @@ import (
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
"github.com/warewulf/warewulf/internal/pkg/node"
"github.com/warewulf/warewulf/internal/pkg/warewulfd"
"github.com/warewulf/warewulf/internal/pkg/wwlog"
)
func Test_List(t *testing.T) {
@@ -67,10 +68,11 @@ WW_INTERNAL: 0
tt.mockFunc()
baseCmd := GetCommand()
baseCmd.SetArgs(tt.args)
baseCmd.SetOut(nil)
baseCmd.SetErr(nil)
stdoutR, stdoutW, _ := os.Pipe()
os.Stdout = stdoutW
wwlog.SetLogWriter(os.Stdout)
baseCmd.SetOut(os.Stdout)
baseCmd.SetErr(os.Stdout)
err = baseCmd.Execute()
if err != nil {
t.Errorf("Received error when running command, err: %v", err)