testutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testutil provides test utilities for the updex project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorServer

func NewErrorServer(t *testing.T, statusCode int) *httptest.Server

NewErrorServer creates a server that always returns the given status code.

func NewTestServer

func NewTestServer(t *testing.T, files TestServerFiles) *httptest.Server

NewTestServer creates an httptest.Server that serves SHA256SUMS manifest and files. The server serves:

  • /SHA256SUMS - manifest with hash + filename entries
  • /{filename} - file content from Content map

Types

type TestServerFiles

type TestServerFiles struct {
	// Files maps filename to SHA256 hash (appears in SHA256SUMS manifest)
	Files map[string]string
	// Content maps filename to file content (for downloads)
	Content map[string][]byte
}

TestServerFiles configures the test HTTP server's responses.

Jump to

Keyboard shortcuts

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