Documentation
¶
Overview ¶
Package testharness provides test-only request, SQLite, and generated-module fixtures. Production packages must not import it.
Index ¶
- func AssertJSONEqual(t *testing.T, expectedJSON string, actual any)
- func CapFixtureParallelism()
- func DecodeJSON[T any](raw string) (*T, error)
- func GeneratedGoMod() string
- func GeneratedGoModWithoutModule() string
- func StructuredObject(t testing.TB, value any) map[string]any
- func WriteGeneratedGoMod(t *testing.T, root string)
- type Fixture
- type GeneratedModule
- type Harness
- type HarnessOption
- type JWT
- type Output
- type Request
- func (r Request) Providers() []locator.Provider
- func (r Request) Scope() (*requestprovider.Scope, error)
- func (r Request) WithBody(body []byte, contentType string) Request
- func (r Request) WithHeaders(headers http.Header) Request
- func (r Request) WithPathParams(pathParams map[string]string) Request
- func (r Request) WithQuery(query url.Values) Request
- func (r Request) WithRequest(request *http.Request) Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CapFixtureParallelism ¶ added in v1.1.0
func CapFixtureParallelism()
CapFixtureParallelism limits -test.parallel for packages whose tests spawn `go test` builds of generated modules. Each spawned build already uses every core for compiling and linking, so fanning parallel tests out to NumCPU oversubscribes the machine and slows every fixture down. The cap keeps the linker saturated instead. An explicit -test.parallel on the command line is respected. Call it from TestMain before m.Run().
func DecodeJSON ¶
func GeneratedGoMod ¶
func GeneratedGoMod() string
GeneratedGoMod retains the existing test entrypoint over the shared owner.
func GeneratedGoModWithoutModule ¶
func GeneratedGoModWithoutModule() string
GeneratedGoModWithoutModule is for tests that deliberately verify missing module identity; all local dependencies still come from the actual checkout.
func StructuredObject ¶
StructuredObject asserts an object-shaped structured protocol payload. MCP's schema permits any JSON value; tests of object contracts must prove the shape before indexing it.
func WriteGeneratedGoMod ¶
Types ¶
type Fixture ¶
func LoadFixture ¶
type GeneratedModule ¶
GeneratedModule derives fixture replacements from the actual source checkout, so generated tests do not assume a GOPATH layout or a second Datly checkout.
func (GeneratedModule) Content ¶
func (m GeneratedModule) Content() (string, error)
func (GeneratedModule) DependencyDir ¶
func (m GeneratedModule) DependencyDir(name string) (string, error)
type Harness ¶
Harness adds component fixtures to the shared, dependency-light SQLite owner.
func NewSQLiteHarness ¶
func NewSQLiteHarness(t *testing.T, opts ...HarnessOption) *Harness
type HarnessOption ¶
func WithDSN ¶
func WithDSN(dsn string) HarnessOption
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
JWT supplies local signed credentials and verifier resources without a TCP server.
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output captures concurrent command output and waits for complete readiness lines.
type Request ¶
Request is a synthetic HTTP provider scope for tests.
func NewRequest ¶
func (Request) WithPathParams ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth supplies local RSA/JWT fixtures using the actual Datly verifier.
|
Package auth supplies local RSA/JWT fixtures using the actual Datly verifier. |
|
Package devapp provides linked SQLite application fixtures for developer MCP tests.
|
Package devapp provides linked SQLite application fixtures for developer MCP tests. |
|
Package genpatch owns the shared high-level generation acceptance fixture.
|
Package genpatch owns the shared high-level generation acceptance fixture. |
|
Package manifestfree holds the shared CLI/API generation-to-SQLite fixture.
|
Package manifestfree holds the shared CLI/API generation-to-SQLite fixture. |
|
Package mcpclient runs real viant/mcp client/server transport tests.
|
Package mcpclient runs real viant/mcp client/server transport tests. |
|
Package otlp provides a real protobuf HTTP collector for integration tests.
|
Package otlp provides a real protobuf HTTP collector for integration tests. |
|
Package sqlite provides shared SQLite fixtures and typed SQLX result verification for dependency-light data-driven tests.
|
Package sqlite provides shared SQLite fixtures and typed SQLX result verification for dependency-light data-driven tests. |