functiontest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package functiontest holds test helpers shared by the builtin gitlab_project.* function tests: an httptest-backed GitLab client and a JSONL output-file parser. These intentionally live in a non-_test.go file so they're importable from sibling packages' tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGitlabClient

func NewGitlabClient(t *testing.T, handler http.HandlerFunc) *gitlab.Client

NewGitlabClient stands up an httptest server with the given handler and returns a *gitlab.Client wired to it. The server is closed on test cleanup.

Retries are disabled — the upstream client retries 5xx five times with exponential backoff, which would turn each error-path test into a multi-second wait. The retry behaviour is the library's, not ours, so skipping it in tests doesn't weaken anything.

func ParseOutputFile

func ParseOutputFile(t *testing.T, path string) map[string]string

ParseOutputFile reads a JSONL output file and returns {name: value}. String-valued outputs only — that's all the scalar gitlab_project.* functions produce.

func ParseOutputFileAny

func ParseOutputFileAny(t *testing.T, path string) map[string]any

ParseOutputFileAny reads a JSONL output file and returns {name: value} with each value decoded as any — so a struct output arrives as map[string]any and an array output as []any. Use this for functions that emit structured (non-string) outputs, e.g. gitlab_project.read_files's files array.

Types

This section is empty.

Jump to

Keyboard shortcuts

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