Help us shape the future of Go! Take the 2026 Go Developer Survey

fakews

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fakews serves recorded Databricks API fixtures over httptest so the reader and contract can be tested end to end without a workspace.

Index

Constants

View Source
const (
	WorkspaceID      int64 = 1111
	OtherWorkspaceID int64 = 2222
)

WorkspaceID is the fixture workspace's id; OtherWorkspaceID is a sibling workspace used for multi-bound securables.

Variables

This section is empty.

Functions

func NewStandalone

func NewStandalone() http.Handler

NewStandalone returns the fake as an http.Handler for fakewsd.

Types

type Route

type Route struct {
	Method string            `json:"method"`
	Path   string            `json:"path"`
	Query  map[string]string `json:"query,omitempty"`
	Status int               `json:"status,omitempty"`
	File   string            `json:"file,omitempty"`
	Body   json.RawMessage   `json:"body,omitempty"`
}

Route is one fixture endpoint. Query entries must all match; the most specific matching route wins.

type Server

type Server struct {
	*httptest.Server
	// contains filtered or unexported fields
}

Server is a fake workspace.

func New

func New(t testing.TB) *Server

New starts a fake workspace from the manifest in testdata/routes.json.

func (*Server) Client

func (s *Server) Client(t testing.TB) *databricks.WorkspaceClient

Client returns an SDK workspace client that talks to the fake.

func (*Server) Fail

func (s *Server) Fail(method, path string, status int, message string)

Fail overrides a route to return an API error. It is matched before the manifest routes.

Directories

Path Synopsis
cmd
fakewsd command
fakewsd serves the recorded fake workspace on a fixed port so terraform and datatf can be pointed at it during local end-to-end checks:
fakewsd serves the recorded fake workspace on a fixed port so terraform and datatf can be pointed at it during local end-to-end checks:

Jump to

Keyboard shortcuts

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