dedupetest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package dedupetest is the conformance suite every dedupe backend runs: the Deduplicator contract (dedupe.go) as tests, driven through the production path — a backend's Factory and the Managed switch it returns — so a backend that passes here behaves the same under ingest as every other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mark

func Mark(ctx context.Context, d dedupe.Deduplicator, k dedupe.Key) (duplicate bool, err error)

Mark is the old check-and-mark in one call, for tests that only need an id seen: it reserves k and commits it with no expiry, reporting whether k was already committed. A key another request holds is an error.

func Run

func Run(t *testing.T, newHarness func(t *testing.T) Harness)

Run runs every case, each against a backend newHarness builds fresh.

Types

type Harness

type Harness struct {
	// Factory builds a tenant's store over the backend. The suite switches
	// each store it builds on and closes it at cleanup.
	Factory dedupe.Factory
	// Peer, if set, builds a tenant's store over the same data through a
	// second client — another process's view, for backends that have one.
	// nil uses Factory.
	Peer dedupe.Factory
	// Advance moves the backend's clock forward by d. nil makes the suite
	// sleep instead, which is why its leases and retentions are whole
	// seconds: a backend may store expiry at one-second resolution.
	Advance func(d time.Duration)
	// FailNextReserve, if set, makes the backend's next Reserve fail after it
	// has claimed n keys. nil skips the case that needs it.
	FailNextReserve func(n int)
}

Harness is one fresh backend under test.

Jump to

Keyboard shortcuts

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