test_utils

package
v0.0.0-...-0e75ced Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLocalKeyConfig

func BuildLocalKeyConfig(key string, allowedIps []string, methods *config.AuthMethods, contracts *config.AuthContracts) *config.LocalKeyConfig

func CacheableMethod

func CacheableMethod(name string) *specs.Method

CacheableMethod builds a spec method that is eligible for caching, for use as a request fixture in cache tests. The fallback constructors (specs.DefaultMethod) produce non-cacheable methods, so cache tests must construct a cacheable one.

func CreateChainSupervisor

func CreateChainSupervisor() upstreams.ChainSupervisor

func CreateEventWithBlockData

func CreateEventWithBlockData(
	id string,
	status protocol.AvailabilityStatus,
	head protocol.Block,
	methods methods.Methods,
	blockInfo *protocol.BlockInfo,
) protocol.UpstreamEvent

func CreateRemoveEvent

func CreateRemoveEvent(id string) protocol.UpstreamEvent

func CtxWithRemoteAddr

func CtxWithRemoteAddr(remote string) context.Context

func CtxWithXFF

func CtxWithXFF(xff string) context.Context

CtxWithXFF simulates a request that arrived through a trusted proxy, so the client IP is taken from X-Forwarded-For.

func ExpectEthValidationRequest

func ExpectEthValidationRequest(
	connector *mocks.ConnectorMock,
	request protocol.RequestHolder,
	response protocol.ResponseHolder,
)

func GetMethodMockAndUpSupervisor

func GetMethodMockAndUpSupervisor() (*mocks.MethodsMock, *mocks.UpstreamSupervisorMock)

func GetResultAsBytes

func GetResultAsBytes(json []byte) []byte

func NewUpstreamRequest

func NewUpstreamRequest(t *testing.T, method string, params any) protocol.RequestHolder

func PolicyConfig

func PolicyConfig(chain, method, connector, maxSize, ttl string, cacheEmpty bool) *config.CachePolicyConfig

func PolicyConfigBlockchainType

func PolicyConfigBlockchainType(blockchainType, method, connector, maxSize, ttl string, cacheEmpty bool) *config.CachePolicyConfig

func PolicyConfigFinalized

func PolicyConfigFinalized(chain, method, connector, maxSize, ttl string, cacheEmpty bool) *config.CachePolicyConfig

func PublishEvent

func PublishEvent(chainSupervisor upstreams.ChainSupervisor, upId string, status protocol.AvailabilityStatus, caps mapset.Set[protocol.Cap])

func TestEvmUpstream

func TestEvmUpstream(
	connector connectors.ApiConnector,
	upConfig *config.Upstream,
	upstreamMethods methods.Methods,
	processorAggregator *event_processors.UpstreamProcessorAggregator,
) *upstreams.GenericUpstream

func UpstreamJsonRpcRequestMatcher

func UpstreamJsonRpcRequestMatcher(request protocol.RequestHolder) func(protocol.RequestHolder) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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