fix test to run without NodeInfo

Also removed --fullall from node list and profile list

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-12-20 15:52:44 +01:00
committed by Jonathon Anderson
parent ffef31969e
commit ac6cd69ca6
28 changed files with 456 additions and 993 deletions

View File

@@ -2,8 +2,6 @@ package rename
import (
"bytes"
"io"
"os"
"path"
"testing"
@@ -12,6 +10,7 @@ import (
"github.com/warewulf/warewulf/internal/pkg/testenv"
"github.com/warewulf/warewulf/internal/pkg/warewulfd"
"github.com/warewulf/warewulf/internal/pkg/wwlog"
"github.com/warewulf/warewulf/internal/pkg/wwlog"
)
func Test_Rename(t *testing.T) {
@@ -43,23 +42,14 @@ func Test_Rename(t *testing.T) {
func verifyContainerListOutput(t *testing.T, content string) {
baseCmd := containerList.GetCommand()
stdoutR, stdoutW, _ := os.Pipe()
os.Stdout = stdoutW
baseCmd.SetOut(os.Stdout)
baseCmd.SetErr(os.Stdout)
wwlog.SetLogWriter(os.Stdout)
buf := new(bytes.Buffer)
baseCmd.SetOut(buf)
baseCmd.SetErr(buf)
wwlog.SetLogWriterErr(buf)
wwlog.SetLogWriterInfo(buf)
err := baseCmd.Execute()
assert.NoError(t, err)
stdoutC := make(chan string)
go func() {
var buf bytes.Buffer
_, _ = io.Copy(&buf, stdoutR)
stdoutC <- buf.String()
}()
stdoutW.Close()
stdout := <-stdoutC
assert.NotEmpty(t, stdout, "output should not be empty")
assert.Contains(t, stdout, content)
assert.NotEmpty(t, buf.String(), "output should not be empty")
assert.Contains(t, buf.String(), content)
}