k3s/pkg/daemons/agent/agent_windows_test.go
Jamie Phillips a62d143936 Fixing various bugs related to windows.
This changes the crictl template for issues with the socket information. It also addresses a typo in the socket address. Last it makes tweaks to configuration that aren't required or had incorrect logic.

Signed-off-by: Jamie Phillips <jamie.phillips@suse.com>


spelling
2021-07-07 15:50:34 -07:00

48 lines
1.0 KiB
Go

// +build windows
package agent
import (
"testing"
"github.com/rancher/k3s/pkg/daemons/config"
)
func TestCheckRuntimeEndpoint(t *testing.T) {
type args struct {
cfg *config.Agent
}
tests := []struct {
name string
args args
want string
}{
{
name: "Runtime endpoint unaltered",
args: args{
cfg: &config.Agent{RuntimeSocket: "npipe:////./pipe/containerd-containerd"},
},
want: "npipe:////./pipe/containerd-containerd",
},
{
name: "Runtime endpoint altered",
args: args{
cfg: &config.Agent{RuntimeSocket: "//./pipe/containerd-containerd"},
},
want: "npipe:////./pipe/containerd-containerd",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
argsMap := map[string]string{}
checkRuntimeEndpoint(tt.args.cfg, argsMap)
if argsMap["container-runtime-endpoint"] != tt.want {
got := argsMap["container-runtime-endpoint"]
t.Errorf("error, input was " + tt.args.cfg.RuntimeSocket + " should be " + tt.want + ", but got " + got)
}
})
}
}