seed

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package seed provides deterministic test data seeding for PeeringDB entity types. It creates well-known entities with fixed IDs so that any test package can populate a database with realistic data via a single function call.

Index

Constants

This section is empty.

Variables

View Source
var Timestamp = time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC)

Timestamp is the deterministic timestamp used for all seed entity created/updated fields.

Functions

This section is empty.

Types

type Result

type Result struct {
	Org             *ent.Organization
	Network         *ent.Network
	Network2        *ent.Network // second network, only in Full
	IX              *ent.InternetExchange
	Facility        *ent.Facility
	Facility2       *ent.Facility // campus-assigned facility, only in Full
	Campus          *ent.Campus
	Carrier         *ent.Carrier
	IxLan           *ent.IxLan
	IxPrefix        *ent.IxPrefix
	NetworkIxLan    *ent.NetworkIxLan
	NetworkFacility *ent.NetworkFacility
	IxFacility      *ent.IxFacility
	CarrierFacility *ent.CarrierFacility
	Poc             *ent.Poc
	// UsersPoc is a visible="Users" POC attached to r.Network. Created via
	// privacy.DecisionContext(Allow) because ent Policy() admits writes
	// identically to reads — future mutation policies could reject it.
	// ID 9000 (reserved band 9000-9099 for Users-tier seed rows).
	UsersPoc *ent.Poc
	// UsersPoc2 is a visible="Users" POC attached to r.Network2. ID 9001.
	UsersPoc2 *ent.Poc
	// AllPocs exposes every POC created (Public + Users) in deterministic
	// order: r.Poc, r.UsersPoc, r.UsersPoc2. Consumers that iterate POCs
	// for assertions (list-count tests) should use this slice.
	AllPocs     []*ent.Poc
	AllNetworks []*ent.Network // all created networks (for Networks())
}

Result holds typed references to all entities created by seed functions.

func Full

func Full(tb testing.TB, client *ent.Client) *Result

Full creates one entity of each of the 13 PeeringDB types plus a second Network and a campus-assigned Facility. It uses deterministic IDs matching the legacy seedAllTestData pattern for backward compatibility.

Jump to

Keyboard shortcuts

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