bundletest

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bundletest is shared test scaffolding: it builds a self-contained FileDescriptorSet and writes a valid on-disk bundle so negotiate/server/e2e can exercise the real bundle.Load path without protoc. It is imported only by tests (never by cmd), so it does not enter the binary.

Index

Constants

View Source
const ValidOpenAPI = `{"openapi":"3.0.0","info":{"title":"test","version":"1"},"paths":{}}`

ValidOpenAPI is a minimal well-formed OpenAPI document.

View Source
const ValidVersions = `` /* 160-byte string literal not displayed */

ValidVersions binds contract "2024-11" → POST /v3/echo, acme.v1.Ping → acme.v1.Pong.

Variables

This section is empty.

Functions

func Dir

func Dir(t testing.TB, versions string) string

Dir writes a single-layer bundle into a fresh temp dir and returns the bundle path. If versions is empty, ValidVersions is used. The lone layer is written under the subdirectory "2024-11" (matching ValidVersions).

func FDSBytes

func FDSBytes(t testing.TB) []byte

FDSBytes returns the wire bytes of a self-contained FileDescriptorSet: google.protobuf.Timestamp plus acme.v1 {Ping{string text=1; int32 n=2}, Pong{string text=1; google.protobuf.Timestamp at=2}}. It also includes Item{int32 id=1; string text=2}, Meta{string locale=1}, and PingV2{repeated Item items=1; optional Meta meta=2} for nested/array transform coverage.

func MultiDir added in v0.3.0

func MultiDir(t testing.TB, layers ...Layer) string

MultiDir writes a multi-layer bundle into a fresh temp dir and returns the bundle path.

func WriteResolution added in v0.3.0

func WriteResolution(t testing.TB, bundleDir, content string)

WriteResolution writes resolution.yaml content into bundleDir (the bundle root). Tests use it to attach operator transform overrides to a bundle built by Dir or MultiDir.

Types

type Layer added in v0.3.0

type Layer struct {
	Name        string // the subdirectory name
	Descriptors []byte
	OpenAPI     string
	Versions    string
}

Layer is one layer's content for MultiDir.

Jump to

Keyboard shortcuts

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