acceptance

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package acceptance provides a suite of acceptance tests for Cache implementations.

This package ensures custom cache backends comply with httpcache requirements, particularly byte-identical storage for no-transform directive compliance (RFC 9111 §5.2.1.6, §5.2.2.6, RFC 9110 §7.7).

Usage

Create a factory function and run the test suite:

func TestMyCache(t *testing.T) {
    factory := acceptance.FactoryFunc(func() (driver.Conn, func()) {
        cache := NewMyCache() // Your implementation
        cleanup := func() { /* cleanup logic */ }
        return cache, cleanup
    })
    acceptance.Run(t, factory)
}

Tests

Verifies byte-identical storage/retrieval, overwrite behavior, deletion semantics, error handling for non-existent keys, and optional key listing functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, factory Factory)

Run runs a standard suite of tests against the provided Cache implementation. The factory function must return a new, empty Cache for each test.

Types

type Factory

type Factory interface {
	Make() (cache driver.Conn, cleanup func())
}

type FactoryFunc

type FactoryFunc func() (driver.Conn, func())

func (FactoryFunc) Make

func (f FactoryFunc) Make() (driver.Conn, func())

Jump to

Keyboard shortcuts

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