pbstest

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package pbstest is a minimal fake Proxmox Backup Server for tests: it accepts the backup-protocol upgrade over TLS and implements the session endpoints gopbs uses (dynamic index create/append/close, chunk and blob upload, previous, finish).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Name       string
	Digests    []string
	Offsets    []uint64
	Closed     bool
	Size       uint64
	ChunkCount uint64
}

Index is a dynamic index written during a session

type Server

type Server struct {

	// ExpectAuthorization, when set, is the exact Authorization header required on the
	// upgrade request; anything else is answered 401 like PBS (minus its 3 s delay).
	ExpectAuthorization string
	// FailUpgrade, when non-zero, answers every upgrade with this status
	FailUpgrade int
	// contains filtered or unexported fields
}

Server is the fake PBS

func New

func New(t *testing.T) *Server

New starts a fake PBS on 127.0.0.1 with a self-signed certificate

func (*Server) Blobs

func (s *Server) Blobs() map[string][]byte

Blobs returns the uploaded blob names

func (*Server) ChunkCount

func (s *Server) ChunkCount() int

ChunkCount is the number of distinct chunks uploaded

func (*Server) Fingerprint

func (s *Server) Fingerprint() string

Fingerprint is the SHA-256 of the certificate as colon-separated hex

func (*Server) Finished

func (s *Server) Finished() int

Finished reports how many sessions called /finish

func (*Server) Indexes

func (s *Server) Indexes() map[string]*Index

Indexes returns the indexes by archive name

func (*Server) URL

func (s *Server) URL() string

URL is the https endpoint (host:port of the listener)

func (*Server) Upgrades

func (s *Server) Upgrades() []*http.Request

Upgrades returns the upgrade requests received so far

Jump to

Keyboard shortcuts

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