Utku Ozdemir f55f5df739
feat: move dashboard package & run it in tty2
Move dashboard package into a common location where both Talos and talosctl can use it.

Add support for overriding stdin, stdout, stderr and ctt in process runner.

Create a dashboard service which runs the dashboard on /dev/tty2.

Redirect kernel messages to tty1 and switch to tty2 after starting the dashboard on it.

Related to siderolabs/talos#6841, siderolabs/talos#4791.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2023-02-28 12:00:25 +01:00

40 lines
1.0 KiB
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package components_test
import (
"testing"
"github.com/siderolabs/talos/internal/pkg/dashboard/components"
"github.com/siderolabs/talos/internal/pkg/dashboard/data"
"github.com/siderolabs/talos/pkg/machinery/api/machine"
)
func TestUpdate(t *testing.T) {
testProcessTable := components.NewProcessTable()
testData := &data.Data{
Nodes: map[string]*data.Node{
"node1": {
Processes: &machine.Process{
Processes: []*machine.ProcessInfo{},
},
ProcsDiff: map[int32]*machine.ProcessInfo{
1: {},
},
Series: map[string][]float64{},
},
"node2": {
ProcsDiff: map[int32]*machine.ProcessInfo{
1: {},
},
},
},
}
testProcessTable.Update("node1", testData)
// Node2 does not have processes, without the check it panics
testProcessTable.Update("node2", testData)
}