MCPcopy Index your code
hub / github.com/ContainerSSH/ContainerSSH / TestConformance

Function TestConformance

internal/sshproxy/conformance_test.go:17–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestConformance(t *testing.T) {
18 var factories = map[string]func(t *testing.T, logger log.Logger) (sshserver.NetworkConnectionHandler, error){
19 "sshproxy": func(t *testing.T, logger log.Logger) (sshserver.NetworkConnectionHandler, error) {
20 var err error
21 sshServer := test.SSH(t)
22 connectionID := sshserver.GenerateConnectionID()
23 cfg := config.SSHProxyConfig{}
24 structutils.Defaults(&cfg)
25 cfg.Server = sshServer.Host()
26 cfg.Port = uint16(sshServer.Port())
27 cfg.Username = sshServer.Username()
28 cfg.Password = sshServer.Password()
29 cfg.AllowedHostKeyFingerprints = []string{
30 sshServer.FingerprintSHA256(),
31 }
32 cfg.HostKeyAlgorithms, err = config.SSHKeyAlgoListFromStringList(sshServer.HostKeyAlgorithms())
33 if err != nil {
34 t.Fatalf("invalid SSH host key algorithm list (%v)", err)
35 }
36 collector := metrics.New(dummy.New())
37 return sshproxy.New(
38 net.TCPAddr{
39 IP: net.ParseIP("127.0.0.1"),
40 Port: test.GetNextPort(t, "client"),
41 Zone: "",
42 },
43 connectionID,
44 cfg,
45 logger,
46 collector.MustCreateCounter("backend_requests", "", ""),
47 collector.MustCreateCounter("backend_failures", "", ""),
48 )
49 },
50 }
51
52 sshserver.RunConformanceTests(t, factories)
53}

Callers

nothing calls this directly

Calls 15

SSHFunction · 0.92
GenerateConnectionIDFunction · 0.92
DefaultsFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
GetNextPortFunction · 0.92
RunConformanceTestsFunction · 0.92
FatalfMethod · 0.80
HostMethod · 0.65
PortMethod · 0.65

Tested by

no test coverage detected