testutils

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package testutils provides helpers for integration and transport tests. It is intended to be imported only by _test.go files; production binaries never import it directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSSHString

func ParseSSHString(payload []byte) (string, bool)

func StartSSHServer

func StartSSHServer(t *testing.T) (*SSHServer, SSHKeys)

Starts an in-process SSH server on 127.0.0.1 on a random port and returns the server handle and client key files. The server is stopped automatically.

Types

type SSHKeys

type SSHKeys struct {
	PrivateKeyFile string
	KnownHostsFile string
}

File paths to the generated key material for use by an SSH client.

type SSHServer

type SSHServer struct {
	// contains filtered or unexported fields
}

A minimal in-process SSH server backed by the local filesystem.

The server supports two channel types:

  • exec: runs the command via sh -c on the local host
  • subsystem sftp: serves the local filesystem via github.com/pkg/sftp

The exec subprocess is killed when the SSH signal request is received, when the session channel is closed, or when the connection drops.

func (*SSHServer) Port

func (sshServer *SSHServer) Port() int

Returns the TCP port the server is listening on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址