testkit

package
v0.2026268.2152 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package testkit provides disposable live protocol fixtures shared by SDK consumers. The fixtures are test infrastructure, not production fallbacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyCandyFixReplace added in v0.2026215.1748

func CopyCandyFixReplace(src, dst, charlyDir string) error

CopyCandyFixReplace copies a candy module tree to dst, rewriting go.mod's RELATIVE `replace github.com/opencharly/{sdk,spec} => ../../{sdk,spec}` directives to the ABSOLUTE repo-submodule dirs (derived from charlyDir's parent — the repo root) so an out-of-process plugin-candy build resolves them from a staged temp project location. A candy go.mod carries BOTH replaces (the sdk contract + the spec contract module it depends on transitively); a relative `=> ../../spec` staged into a temp project resolves to `<temp>/spec`, which does not exist, so the out-of-process `go build` fails with "reading ../../spec/go.mod: no such file" unless the spec replace is rewritten to the absolute spec dir exactly as the sdk replace is.

This is test-support infrastructure shared by charly's out-of-process plugin end-to-end tests (candy staging for a temp project's LoadUnified/build path). It lives here — outside both the charly module and the sdk contract module — because it spells the sdk/spec module import paths as STRING LITERALS (rewriting go.mod text), which would otherwise defeat a decoupling gate scoped to "no charly/*.go source spells the sdk import path as a literal" even though the file makes no actual Go import of either module.

Types

type SSHProcessServer

type SSHProcessServer struct {
	Address      string
	Port         int64
	IdentityFile string
	Home         string
}

SSHProcessServer is a real SSH server whose accepted exec session is wired byte-for-byte to a child process. It lets consumers prove gRPC-over-SSH with the system OpenSSH client without relying on a machine-level sshd fixture.

func StartSSHProcessServer

func StartSSHProcessServer(t TestingT, process func(string) *exec.Cmd) *SSHProcessServer

type TestingT

type TestingT interface {
	Helper()
	TempDir() string
	Cleanup(func())
	Fatalf(string, ...any)
}

Jump to

Keyboard shortcuts

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