Documentation ¶
Overview ¶
Package test provides various testing utilities.
Index ¶
- Constants
- Variables
- func AllTrue(vs ...bool) bool
- func AssertClusterAuthRequest(ctx context.Context, reqCh <-chan ClusterAuthRequest, resp grpc.CallOption) bool
- func AssertClusterGetPeerRequest(ctx context.Context, reqCh <-chan ClusterGetPeerRequest, ...) bool
- func AssertEventPubSubPublishRequest(ctx context.Context, reqCh <-chan EventPubSubPublishRequest, ...) bool
- func AssertEventPubSubPublishRequests(ctx context.Context, reqCh <-chan EventPubSubPublishRequest, n int, ...) bool
- func AssertListApplicationRightsRequest(ctx context.Context, reqCh <-chan ApplicationAccessListRightsRequest, ...) bool
- func ClusterJoinNilFunc() error
- func CollectEvents(f func()) []events.Event
- func Context() context.Context
- func ContextWithCounterRef(ctx context.Context, key any, i *int64) context.Context
- func ContextWithTB(ctx context.Context, tb testing.TB) context.Context
- func Diff(x, y any) string
- func DiffEqual(x, y any) bool
- func EventBuilderEqual(a, b events.Builder) bool
- func FormatError(err error) string
- func FrequencyPlan(id string) *frequencyplans.FrequencyPlan
- func GetLogger(t testing.TB) log.Stack
- func IncrementContextCounter(ctx context.Context, key any, v int64) (int64, bool)
- func IsProperSubsetOfElements(eq any, sub, super any) bool
- func IsSubsetOfElements(eq any, sub, super any) bool
- func JoinStringsMap(f func(k any, v any) string, sep string, xs any) string
- func JoinStringsf(format, sep string, withKeys bool, xs any) string
- func MakeApplicationAccessListRightsChFunc(reqCh chan<- ApplicationAccessListRightsRequest) func(context.Context, *ttnpb.ApplicationIdentifiers) (*ttnpb.Rights, error)
- func MakeClusterAuthChFunc(reqCh chan<- ClusterAuthRequest) func() grpc.CallOption
- func MakeClusterGetPeerChFunc(reqCh chan<- ClusterGetPeerRequest) ...
- func MakeClusterJoinChFunc(reqCh chan<- ClusterJoinRequest) func() error
- func MakeEndDevice(opts ...EndDeviceOption) *ttnpb.EndDevice
- func MakeEndDeviceIdentifiers(opts ...EndDeviceIdentifiersOption) *ttnpb.EndDeviceIdentifiers
- func MakeEventEqual(conf EventEqualConfig) func(a, b events.Event) bool
- func MakeEventPubSubPublishChFunc(reqCh chan<- EventPubSubPublishRequest) func(...events.Event)
- func MakeMACState(opts ...MACStateOption) *ttnpb.MACState
- func MakeRootKeys(opts ...RootKeysOption) *ttnpb.RootKeys
- func MakeSession(opts ...SessionOption) *ttnpb.Session
- func MakeSessionKeys(opts ...SessionKeysOption) *ttnpb.SessionKeys
- func MapKeys(m any) []any
- func Must[T any](v T, err error) T
- func MustIncrementContextCounter(ctx context.Context, key any, v int64) int64
- func MustNewTBFromContext(ctx context.Context) (testing.TB, *assertions.Assertion)
- func MustNewTFromContext(ctx context.Context) (*testing.T, *assertions.Assertion)
- func MustTBFromContext(ctx context.Context) testing.TB
- func MustTFromContext(ctx context.Context) *testing.T
- func New(tb testing.TB) (*assertions.Assertion, context.Context)
- func NewRedis(ctx context.Context, namespace ...string) (*ttnredis.Client, func())
- func NewTBFromContext(ctx context.Context) (testing.TB, *assertions.Assertion, bool)
- func NewTFromContext(ctx context.Context) (*testing.T, *assertions.Assertion, bool)
- func NewWithContext(ctx context.Context, tb testing.TB) (*assertions.Assertion, context.Context)
- func RedirectEvents(ch chan events.Event) func()
- func RunSubtest(t *testing.T, conf SubtestConfig) bool
- func RunSubtestFromContext(ctx context.Context, conf SubtestConfig) bool
- func RunTest(t *testing.T, conf TestConfig)
- func SameElements(eq any, xs, ys any) bool
- func SetDefaultEventsPubSub(ps events.PubSub) func()
- func StringEqual(x, y string) bool
- func TBFromContext(ctx context.Context) (testing.TB, bool)
- func TFromContext(ctx context.Context) (*testing.T, bool)
- func WaitContext(ctx context.Context, f func()) bool
- func WaitDeadline(t time.Time, f func()) bool
- func WaitEvent(ctx context.Context, ch chan events.Event, name string) bool
- func WaitTimeout(d time.Duration, f func()) bool
- type ApplicationAccessListRightsRequest
- type ApplicationAccessListRightsResponse
- type ClusterAuthRequest
- type ClusterGetPeerRequest
- type ClusterGetPeerResponse
- type ClusterJoinRequest
- type EndDeviceIdentifiersOption
- type EndDeviceIdentifiersOptionNamespace
- func (EndDeviceIdentifiersOptionNamespace) Compose(opts ...EndDeviceIdentifiersOption) EndDeviceIdentifiersOption
- func (EndDeviceIdentifiersOptionNamespace) WithApplicationIds(v *ttnpb.ApplicationIdentifiers) EndDeviceIdentifiersOption
- func (o EndDeviceIdentifiersOptionNamespace) WithDefaultDevEUI() EndDeviceIdentifiersOption
- func (o EndDeviceIdentifiersOptionNamespace) WithDefaultJoinEUI() EndDeviceIdentifiersOption
- func (EndDeviceIdentifiersOptionNamespace) WithDevAddr(v []byte) EndDeviceIdentifiersOption
- func (EndDeviceIdentifiersOptionNamespace) WithDevEui(v []byte) EndDeviceIdentifiersOption
- func (EndDeviceIdentifiersOptionNamespace) WithDeviceId(v string) EndDeviceIdentifiersOption
- func (EndDeviceIdentifiersOptionNamespace) WithJoinEui(v []byte) EndDeviceIdentifiersOption
- type EndDeviceOption
- type EndDeviceOptionNamespace
- func (EndDeviceOptionNamespace) Compose(opts ...EndDeviceOption) EndDeviceOption
- func (EndDeviceOptionNamespace) WithActivatedAt(v *timestamppb.Timestamp) EndDeviceOption
- func (EndDeviceOptionNamespace) WithApplicationServerAddress(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithApplicationServerId(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithApplicationServerKekLabel(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithAttributes(v map[string]string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithBatteryPercentage(v *wrapperspb.FloatValue) EndDeviceOption
- func (EndDeviceOptionNamespace) WithClaimAuthenticationCode(v *ttnpb.EndDeviceAuthenticationCode) EndDeviceOption
- func (EndDeviceOptionNamespace) WithCreatedAt(v *timestamppb.Timestamp) EndDeviceOption
- func (o EndDeviceOptionNamespace) WithDefaultDevEUI() EndDeviceOption
- func (o EndDeviceOptionNamespace) WithDefaultFrequencyPlanID() EndDeviceOption
- func (o EndDeviceOptionNamespace) WithDefaultJoinEUI() EndDeviceOption
- func (o EndDeviceOptionNamespace) WithDefaultLoRaWANPHYVersion() EndDeviceOption
- func (o EndDeviceOptionNamespace) WithDefaultLoRaWANVersion() EndDeviceOption
- func (EndDeviceOptionNamespace) WithDescription(v string) EndDeviceOption
- func (o EndDeviceOptionNamespace) WithDevEUI(v *types.EUI64) EndDeviceOption
- func (EndDeviceOptionNamespace) WithDownlinkMargin(v int32) EndDeviceOption
- func (o EndDeviceOptionNamespace) WithEndDeviceIdentifiersOptions(opts ...EndDeviceIdentifiersOption) EndDeviceOption
- func (EndDeviceOptionNamespace) WithFormatters(v *ttnpb.MessagePayloadFormatters) EndDeviceOption
- func (EndDeviceOptionNamespace) WithFrequencyPlanId(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithIds(v *ttnpb.EndDeviceIdentifiers) EndDeviceOption
- func (o EndDeviceOptionNamespace) WithJoinEUI(v *types.EUI64) EndDeviceOption
- func (EndDeviceOptionNamespace) WithJoinServerAddress(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLastDevNonce(v uint32) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLastDevStatusReceivedAt(v *timestamppb.Timestamp) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLastJoinNonce(v uint32) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLastRjCount_0(v uint32) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLastRjCount_1(v uint32) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLastSeenAt(v *timestamppb.Timestamp) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLocations(v map[string]*ttnpb.Location) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLoraAllianceProfileIds(v *ttnpb.LoRaAllianceProfileIdentifiers) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLorawanPhyVersion(v ttnpb.PHYVersion) EndDeviceOption
- func (EndDeviceOptionNamespace) WithLorawanVersion(v ttnpb.MACVersion) EndDeviceOption
- func (o EndDeviceOptionNamespace) WithMACStateOptions(opts ...MACStateOption) EndDeviceOption
- func (EndDeviceOptionNamespace) WithMacSettings(v *ttnpb.MACSettings) EndDeviceOption
- func (EndDeviceOptionNamespace) WithMacState(v *ttnpb.MACState) EndDeviceOption
- func (EndDeviceOptionNamespace) WithMaxFrequency(v uint64) EndDeviceOption
- func (EndDeviceOptionNamespace) WithMinFrequency(v uint64) EndDeviceOption
- func (EndDeviceOptionNamespace) WithMulticast(v bool) EndDeviceOption
- func (EndDeviceOptionNamespace) WithName(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithNetId(v []byte) EndDeviceOption
- func (EndDeviceOptionNamespace) WithNetworkServerAddress(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithNetworkServerKekLabel(v string) EndDeviceOption
- func (o EndDeviceOptionNamespace) WithPendingMACStateOptions(opts ...MACStateOption) EndDeviceOption
- func (EndDeviceOptionNamespace) WithPendingMacState(v *ttnpb.MACState) EndDeviceOption
- func (EndDeviceOptionNamespace) WithPendingSession(v *ttnpb.Session) EndDeviceOption
- func (EndDeviceOptionNamespace) WithPicture(v *ttnpb.Picture) EndDeviceOption
- func (EndDeviceOptionNamespace) WithPowerState(v ttnpb.PowerState) EndDeviceOption
- func (EndDeviceOptionNamespace) WithProvisionerId(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithProvisioningData(v *structpb.Struct) EndDeviceOption
- func (EndDeviceOptionNamespace) WithQueuedApplicationDownlinks(vs ...*ttnpb.ApplicationDownlink) EndDeviceOption
- func (EndDeviceOptionNamespace) WithResetsJoinNonces(v bool) EndDeviceOption
- func (EndDeviceOptionNamespace) WithRootKeys(v *ttnpb.RootKeys) EndDeviceOption
- func (EndDeviceOptionNamespace) WithSerialNumber(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithServiceProfileId(v string) EndDeviceOption
- func (EndDeviceOptionNamespace) WithSession(v *ttnpb.Session) EndDeviceOption
- func (EndDeviceOptionNamespace) WithSkipPayloadCrypto(v bool) EndDeviceOption
- func (EndDeviceOptionNamespace) WithSkipPayloadCryptoOverride(v *wrapperspb.BoolValue) EndDeviceOption
- func (EndDeviceOptionNamespace) WithSupportsClassB(v bool) EndDeviceOption
- func (EndDeviceOptionNamespace) WithSupportsClassC(v bool) EndDeviceOption
- func (EndDeviceOptionNamespace) WithSupportsJoin(v bool) EndDeviceOption
- func (EndDeviceOptionNamespace) WithUpdatedAt(v *timestamppb.Timestamp) EndDeviceOption
- func (EndDeviceOptionNamespace) WithUsedDevNonces(vs ...uint32) EndDeviceOption
- func (EndDeviceOptionNamespace) WithVersionIds(v *ttnpb.EndDeviceVersionIdentifiers) EndDeviceOption
- type EventEqualConfig
- type EventPubSubPublishRequest
- type MACStateOption
- type MACStateOptionNamespace
- func (o MACStateOptionNamespace) AppendRecentDownlinks(downs ...*ttnpb.MACState_DownlinkMessage) MACStateOption
- func (o MACStateOptionNamespace) AppendRecentUplinks(ups ...*ttnpb.MACState_UplinkMessage) MACStateOption
- func (MACStateOptionNamespace) Compose(opts ...MACStateOption) MACStateOption
- func (MACStateOptionNamespace) WithCurrentParameters(v *ttnpb.MACParameters) MACStateOption
- func (MACStateOptionNamespace) WithDesiredParameters(v *ttnpb.MACParameters) MACStateOption
- func (MACStateOptionNamespace) WithDeviceClass(v ttnpb.Class) MACStateOption
- func (MACStateOptionNamespace) WithLastAdrChangeFCntUp(v uint32) MACStateOption
- func (MACStateOptionNamespace) WithLastConfirmedDownlinkAt(v *timestamppb.Timestamp) MACStateOption
- func (MACStateOptionNamespace) WithLastDevStatusFCntUp(v uint32) MACStateOption
- func (MACStateOptionNamespace) WithLastDownlinkAt(v *timestamppb.Timestamp) MACStateOption
- func (MACStateOptionNamespace) WithLastNetworkInitiatedDownlinkAt(v *timestamppb.Timestamp) MACStateOption
- func (MACStateOptionNamespace) WithLorawanVersion(v ttnpb.MACVersion) MACStateOption
- func (MACStateOptionNamespace) WithPendingApplicationDownlink(v *ttnpb.ApplicationDownlink) MACStateOption
- func (MACStateOptionNamespace) WithPendingJoinRequest(v *ttnpb.MACState_JoinRequest) MACStateOption
- func (MACStateOptionNamespace) WithPendingRelayDownlink(v *ttnpb.RelayForwardDownlinkReq) MACStateOption
- func (MACStateOptionNamespace) WithPendingRequests(vs ...*ttnpb.MACCommand) MACStateOption
- func (MACStateOptionNamespace) WithPingSlotPeriodicity(v *ttnpb.PingSlotPeriodValue) MACStateOption
- func (MACStateOptionNamespace) WithQueuedJoinAccept(v *ttnpb.MACState_JoinAccept) MACStateOption
- func (MACStateOptionNamespace) WithQueuedResponses(vs ...*ttnpb.MACCommand) MACStateOption
- func (MACStateOptionNamespace) WithRecentDownlinks(vs ...*ttnpb.MACState_DownlinkMessage) MACStateOption
- func (MACStateOptionNamespace) WithRecentMacCommandIdentifiers(vs ...ttnpb.MACCommandIdentifier) MACStateOption
- func (MACStateOptionNamespace) WithRecentUplinks(vs ...*ttnpb.MACState_UplinkMessage) MACStateOption
- func (MACStateOptionNamespace) WithRejectedAdrDataRateIndexes(vs ...ttnpb.DataRateIndex) MACStateOption
- func (MACStateOptionNamespace) WithRejectedAdrTxPowerIndexes(vs ...uint32) MACStateOption
- func (MACStateOptionNamespace) WithRejectedDataRateRanges(v map[uint64]*ttnpb.MACState_DataRateRanges) MACStateOption
- func (MACStateOptionNamespace) WithRejectedFrequencies(vs ...uint64) MACStateOption
- func (MACStateOptionNamespace) WithRxWindowsAvailable(v bool) MACStateOption
- type MockApplicationAccessServer
- func (m MockApplicationAccessServer) CreateAPIKey(ctx context.Context, req *ttnpb.CreateApplicationAPIKeyRequest) (*ttnpb.APIKey, error)
- func (m MockApplicationAccessServer) GetAPIKey(ctx context.Context, req *ttnpb.GetApplicationAPIKeyRequest) (*ttnpb.APIKey, error)
- func (m MockApplicationAccessServer) GetCollaborator(ctx context.Context, req *ttnpb.GetApplicationCollaboratorRequest) (*ttnpb.GetCollaboratorResponse, error)
- func (m MockApplicationAccessServer) ListAPIKeys(ctx context.Context, req *ttnpb.ListApplicationAPIKeysRequest) (*ttnpb.APIKeys, error)
- func (m MockApplicationAccessServer) ListCollaborators(ctx context.Context, req *ttnpb.ListApplicationCollaboratorsRequest) (*ttnpb.Collaborators, error)
- func (m MockApplicationAccessServer) ListRights(ctx context.Context, req *ttnpb.ApplicationIdentifiers) (*ttnpb.Rights, error)
- func (m MockApplicationAccessServer) SetCollaborator(ctx context.Context, req *ttnpb.SetApplicationCollaboratorRequest) (*emptypb.Empty, error)
- func (m MockApplicationAccessServer) UpdateAPIKey(ctx context.Context, req *ttnpb.UpdateApplicationAPIKeyRequest) (*ttnpb.APIKey, error)
- type MockClientStream
- type MockClock
- type MockCluster
- func (m MockCluster) Auth() grpc.CallOption
- func (m MockCluster) ClaimIDs(ctx context.Context, ids cluster.EntityIdentifiers) error
- func (m MockCluster) GetPeer(ctx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (cluster.Peer, error)
- func (m MockCluster) GetPeerConn(ctx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (*grpc.ClientConn, error)
- func (m MockCluster) GetPeers(ctx context.Context, role ttnpb.ClusterRole) ([]cluster.Peer, error)
- func (m MockCluster) Join() error
- func (m MockCluster) Leave() error
- func (m MockCluster) TLS() bool
- func (m MockCluster) UnclaimIDs(ctx context.Context, ids cluster.EntityIdentifiers) error
- func (m MockCluster) WithVerifiedSource(ctx context.Context) context.Context
- type MockEventPubSub
- type MockPeer
- type MockServerStream
- type MockServerTransportStream
- type MockStream
- type Ranger
- type RootKeysOption
- type RootKeysOptionNamespace
- func (RootKeysOptionNamespace) Compose(opts ...RootKeysOption) RootKeysOption
- func (RootKeysOptionNamespace) WithAppKey(v *ttnpb.KeyEnvelope) RootKeysOption
- func (RootKeysOptionNamespace) WithNwkKey(v *ttnpb.KeyEnvelope) RootKeysOption
- func (RootKeysOptionNamespace) WithRootKeyId(v string) RootKeysOption
- type SessionKeysOption
- type SessionKeysOptionNamespace
- func (SessionKeysOptionNamespace) Compose(opts ...SessionKeysOption) SessionKeysOption
- func (SessionKeysOptionNamespace) WithAppSKey(v *ttnpb.KeyEnvelope) SessionKeysOption
- func (o SessionKeysOptionNamespace) WithDefaultAppSKey() SessionKeysOption
- func (o SessionKeysOptionNamespace) WithDefaultNwkKeys(macVersion ttnpb.MACVersion) SessionKeysOption
- func (o SessionKeysOptionNamespace) WithDefaultNwkKeysWrapped(macVersion ttnpb.MACVersion) SessionKeysOption
- func (o SessionKeysOptionNamespace) WithDefaultSessionKeyID() SessionKeysOption
- func (SessionKeysOptionNamespace) WithFNwkSIntKey(v *ttnpb.KeyEnvelope) SessionKeysOption
- func (o SessionKeysOptionNamespace) WithNwkKeys(fNwkSIntKey, nwkSEncKey, sNwkSIntKey *ttnpb.KeyEnvelope) SessionKeysOption
- func (SessionKeysOptionNamespace) WithNwkSEncKey(v *ttnpb.KeyEnvelope) SessionKeysOption
- func (SessionKeysOptionNamespace) WithSNwkSIntKey(v *ttnpb.KeyEnvelope) SessionKeysOption
- func (SessionKeysOptionNamespace) WithSessionKeyId(v []byte) SessionKeysOption
- type SessionOption
- type SessionOptionNamespace
- func (SessionOptionNamespace) Compose(opts ...SessionOption) SessionOption
- func (o SessionOptionNamespace) WithDefaultAppSKey() SessionOption
- func (o SessionOptionNamespace) WithDefaultNwkKeys(macVersion ttnpb.MACVersion) SessionOption
- func (SessionOptionNamespace) WithDevAddr(v []byte) SessionOption
- func (SessionOptionNamespace) WithKeys(v *ttnpb.SessionKeys) SessionOption
- func (SessionOptionNamespace) WithLastAFCntDown(v uint32) SessionOption
- func (SessionOptionNamespace) WithLastConfFCntDown(v uint32) SessionOption
- func (SessionOptionNamespace) WithLastFCntUp(v uint32) SessionOption
- func (SessionOptionNamespace) WithLastNFCntDown(v uint32) SessionOption
- func (SessionOptionNamespace) WithQueuedApplicationDownlinks(vs ...*ttnpb.ApplicationDownlink) SessionOption
- func (o SessionOptionNamespace) WithSessionKeysOptions(opts ...SessionKeysOption) SessionOption
- func (SessionOptionNamespace) WithStartedAt(v *timestamppb.Timestamp) SessionOption
- type SubtestConfig
- type TestConfig
Constants ¶
const ( // EUFrequencyPlanID is a European frequency plan for testing. EUFrequencyPlanID = "EU_863_870" // KRFrequencyPlanID is a Korean frequency plan for testing. KRFrequencyPlanID = "KR_920_923" // USFrequencyPlanID is a American frequency plan for testing. USFrequencyPlanID = "US_902_928_FSB_2" // ASAUFrequencyPlanID is an AS923 for Australia frequency plan for testing. ASAUFrequencyPlanID = "AS_923_925_AU" // AUFrequencyPlanID is the identifier of the Australia 915-928 FSB 2 frequency plan. AUFrequencyPlanID = "AU_915_928_FSB_2" // ExampleFrequencyPlanID is an example frequency plan. ExampleFrequencyPlanID = "EXAMPLE" )
const ( DefaultApplicationID = "test-app-id" DefaultDeviceID = "test-dev-id" DefaultRootKeyID = "test-root-key-id" )
Variables ¶
var ( // StaticFrequencyPlans contains the values used to mock a static // frequencyStore in most tests component related StaticFrequencyPlans = map[string][]byte{ "frequency-plans.yml": []byte(frequencyPlansDescription), "EU_863_870.yml": []byte(euFrequencyPlan), "KR_920_923.yml": []byte(krFrequencyPlan), "US_902_928_FSB_2.yml": []byte(usFrequencyPlan), "AS_923_925_AU.yml": []byte(asAUFrequencyPlan), "AU_915_928_FSB_2.yml": []byte(auFrequencyPlan), "EXAMPLE.yml": []byte(exampleFrequencyPlan), } // FrequencyPlansFetcher fetches frequency plans from memory. FrequencyPlansFetcher = fetch.NewMemFetcher(StaticFrequencyPlans) FrequencyPlanStore = frequencyplans.NewStore(FrequencyPlansFetcher) )
var ( ErrInternal = errors.DefineInternal("test_internal", "test error") ErrNotFound = errors.DefineNotFound("test_not_found", "test error") DefaultApplicationIdentifiers = &ttnpb.ApplicationIdentifiers{ ApplicationId: DefaultApplicationID, } DefaultJoinEUI = types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} DefaultDevEUI = types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} DefaultAppKey = types.AES128Key{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} DefaultNwkKey = types.AES128Key{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} DefaultJoinNonce = types.JoinNonce{0x42, 0xff, 0xff} DefaultDevNonce = types.DevNonce{0x42, 0xff} DefaultSessionKeyID = []byte("test-session-key-id") DefaultKEK = types.AES128Key{0x42, 0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} DefaultKEKLabel = "test-kek-label" DefaultKeyVault = config.KeyVault{ Provider: "static", Static: map[string][]byte{ DefaultKEKLabel: DefaultKEK[:], }, } DefaultAppSKey = crypto.DeriveAppSKey(DefaultNwkKey, DefaultJoinNonce, DefaultJoinEUI, DefaultDevNonce) DefaultFNwkSIntKey = crypto.DeriveFNwkSIntKey(DefaultNwkKey, DefaultJoinNonce, DefaultJoinEUI, DefaultDevNonce) DefaultNwkSEncKey = crypto.DeriveNwkSEncKey(DefaultNwkKey, DefaultJoinNonce, DefaultJoinEUI, DefaultDevNonce) DefaultSNwkSIntKey = crypto.DeriveSNwkSIntKey(DefaultNwkKey, DefaultJoinNonce, DefaultJoinEUI, DefaultDevNonce) DefaultAppSKeyEnvelope = &ttnpb.KeyEnvelope{ Key: DefaultAppSKey.Bytes(), } DefaultFNwkSIntKeyEnvelope = &ttnpb.KeyEnvelope{ Key: DefaultFNwkSIntKey.Bytes(), } DefaultNwkSEncKeyEnvelope = &ttnpb.KeyEnvelope{ Key: DefaultNwkSEncKey.Bytes(), } DefaultSNwkSIntKeyEnvelope = &ttnpb.KeyEnvelope{ Key: DefaultSNwkSIntKey.Bytes(), } DefaultAppSKeyEnvelopeWrapped = Must(cryptoutil.WrapAES128KeyWithKEK(Context(), DefaultAppSKey, DefaultKEKLabel, DefaultKEK)) DefaultFNwkSIntKeyEnvelopeWrapped = Must(cryptoutil.WrapAES128KeyWithKEK(Context(), DefaultFNwkSIntKey, DefaultKEKLabel, DefaultKEK)) DefaultNwkSEncKeyEnvelopeWrapped = Must(cryptoutil.WrapAES128KeyWithKEK(Context(), DefaultNwkSEncKey, DefaultKEKLabel, DefaultKEK)) DefaultSNwkSIntKeyEnvelopeWrapped = Must(cryptoutil.WrapAES128KeyWithKEK(Context(), DefaultSNwkSIntKey, DefaultKEKLabel, DefaultKEK)) DefaultAppSKeyWrapped = DefaultAppSKeyEnvelopeWrapped.EncryptedKey DefaultFNwkSIntKeyWrapped = DefaultFNwkSIntKeyEnvelopeWrapped.EncryptedKey DefaultNwkSEncKeyWrapped = DefaultNwkSEncKeyEnvelopeWrapped.EncryptedKey DefaultSNwkSIntKeyWrapped = DefaultSNwkSIntKeyEnvelopeWrapped.EncryptedKey DefaultNetID = Must(types.NewNetID(2, []byte{0x00, 0x42, 0xff})) DefaultNSID = types.EUI64{0x00, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} DefaultDevAddr = Must(types.NewDevAddr(DefaultNetID, []byte{0x00, 0x02, 0xff, 0xff})) DefaultLegacyAppSKey = crypto.DeriveLegacyAppSKey(DefaultNwkKey, DefaultJoinNonce, DefaultNetID, DefaultDevNonce) DefaultLegacyNwkSKey = crypto.DeriveLegacyNwkSKey(DefaultNwkKey, DefaultJoinNonce, DefaultNetID, DefaultDevNonce) DefaultMACVersion = ttnpb.MACVersion_MAC_V1_1 DefaultPHYVersion = ttnpb.PHYVersion_RP001_V1_1_REV_B DefaultFrequencyPlanID = EUFrequencyPlanID )
var DefaultContext = context.Background()
DefaultContext is the default context.
var Delay = time.Millisecond * func() time.Duration { env := os.Getenv("TEST_SLOWDOWN") if env == "" { return 1 } v, err := strconv.Atoi(env) if err != nil { return 1 } return time.Duration(v) }()
Delay is the value, which can be used to slowdown the execution of time-dependent tests. You can assume, that most function calls will return in at most Delay time. It can(and should) be used to construct other time variables used in testing. Value may vary from machine to machine and can be overridden by TEST_SLOWDOWN environment variable.
var EventEqual = MakeEventEqual(EventEqualConfig{ Identifiers: true, Data: true, CorrelationIDs: true, Origin: true, Context: true, Visibility: true, RemoteIP: true, UserAgent: true, })
var HTTPClientProvider = httpclient.NewProvider( tlsconfig.ConfigurationProvider(func(context.Context) tlsconfig.Config { return tlsconfig.Config{} }), )
HTTPClientProvider is a valid httpclient.Provider.
Functions ¶
func AssertClusterAuthRequest ¶
func AssertClusterAuthRequest(ctx context.Context, reqCh <-chan ClusterAuthRequest, resp grpc.CallOption) bool
func AssertClusterGetPeerRequest ¶
func AssertClusterGetPeerRequest(ctx context.Context, reqCh <-chan ClusterGetPeerRequest, assert func(ctx, reqCtx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (ClusterGetPeerResponse, bool)) bool
func AssertListApplicationRightsRequest ¶ added in v3.12.2
func ClusterJoinNilFunc ¶
func ClusterJoinNilFunc() error
func CollectEvents ¶
CollectEvents collects events published by f.
func ContextWithCounterRef ¶ added in v3.10.5
ContextWithCounterRef adds the given counter to ctx under key specified.
func ContextWithTB ¶ added in v3.9.0
ContextWithTB saves the testing.TB in the context.
func EventBuilderEqual ¶ added in v3.9.0
func FormatError ¶ added in v3.10.0
func FrequencyPlan ¶ added in v3.11.0
func FrequencyPlan(id string) *frequencyplans.FrequencyPlan
func IncrementContextCounter ¶ added in v3.10.5
IncrementContextCounter increments the counter in the context.
func IsProperSubsetOfElements ¶
IsProperSubsetOfElements is like IsSubsetOfElements, but checks for proper subset.
func IsSubsetOfElements ¶
IsSubsetOfElements returns true iff a multiset sub represents a subset of multiset super under equality given by eq. Signature of eq must be func(A, B) bool, where A, B are types, which elements of sub and super can be assigned to respectively. It panics if either sub or super is not one of: 1. string, slice, array or map kind 2. value, which implements Ranger interface(e.g. sync.Map) NOTE: Map key values are not taken into account.
func JoinStringsMap ¶ added in v3.10.0
JoinStringsMap maps contents of xs to strings using f and joins them with sep.
func JoinStringsf ¶ added in v3.10.0
JoinStringsf formats contents of xs using format and joins them with sep.
func MakeApplicationAccessListRightsChFunc ¶
func MakeApplicationAccessListRightsChFunc(reqCh chan<- ApplicationAccessListRightsRequest) func(context.Context, *ttnpb.ApplicationIdentifiers) (*ttnpb.Rights, error)
func MakeClusterAuthChFunc ¶
func MakeClusterAuthChFunc(reqCh chan<- ClusterAuthRequest) func() grpc.CallOption
func MakeClusterGetPeerChFunc ¶
func MakeClusterGetPeerChFunc(reqCh chan<- ClusterGetPeerRequest) func(context.Context, ttnpb.ClusterRole, cluster.EntityIdentifiers) (cluster.Peer, error)
func MakeClusterJoinChFunc ¶
func MakeClusterJoinChFunc(reqCh chan<- ClusterJoinRequest) func() error
func MakeEndDevice ¶ added in v3.11.0
func MakeEndDevice(opts ...EndDeviceOption) *ttnpb.EndDevice
MakeEndDevice constructs a new ttnpb.EndDevice.
func MakeEndDeviceIdentifiers ¶ added in v3.11.0
func MakeEndDeviceIdentifiers(opts ...EndDeviceIdentifiersOption) *ttnpb.EndDeviceIdentifiers
MakeEndDeviceIdentifiers constructs a new ttnpb.EndDeviceIdentifiers.
func MakeEventEqual ¶ added in v3.9.2
func MakeEventEqual(conf EventEqualConfig) func(a, b events.Event) bool
func MakeEventPubSubPublishChFunc ¶
func MakeEventPubSubPublishChFunc(reqCh chan<- EventPubSubPublishRequest) func(...events.Event)
func MakeMACState ¶ added in v3.11.0
func MakeMACState(opts ...MACStateOption) *ttnpb.MACState
MakeMACState constructs a new ttnpb.MACState.
func MakeRootKeys ¶ added in v3.11.0
func MakeRootKeys(opts ...RootKeysOption) *ttnpb.RootKeys
MakeRootKeys constructs a new ttnpb.RootKeys.
func MakeSession ¶ added in v3.11.0
func MakeSession(opts ...SessionOption) *ttnpb.Session
MakeSession constructs a new ttnpb.Session.
func MakeSessionKeys ¶ added in v3.11.0
func MakeSessionKeys(opts ...SessionKeysOption) *ttnpb.SessionKeys
MakeSessionKeys constructs a new ttnpb.SessionKeys.
func MustIncrementContextCounter ¶ added in v3.10.5
MustIncrementContextCounter increments the counter in the context, and panics if it is not present in the context.
func MustNewTBFromContext ¶ added in v3.9.1
func MustNewTFromContext ¶ added in v3.9.1
func MustTBFromContext ¶ added in v3.9.0
MustTBFromContext returns the testing.TB from the context, and panics if it was not saved in the context.
func MustTFromContext ¶
MustTFromContext returns the *testing.T from the context, and panics if it was not saved in the context.
func NewRedis ¶
NewRedis returns a new namespaced *redis.Client ready to use and a flush function, which should be called after the client is not needed anymore to clean the namespace. NewRedis respects TEST_REDIS, REDIS_ADDRESS and REDIS_DB environment variables. Client returned logs commands executed.
func NewTBFromContext ¶ added in v3.9.1
func NewTFromContext ¶ added in v3.9.1
func NewWithContext ¶ added in v3.9.1
func RedirectEvents ¶
RedirectEvents redirects the published events to the provided channel until the returned function is called.
func RunSubtest ¶ added in v3.9.2
func RunSubtest(t *testing.T, conf SubtestConfig) bool
func RunSubtestFromContext ¶ added in v3.9.2
func RunSubtestFromContext(ctx context.Context, conf SubtestConfig) bool
func RunTest ¶ added in v3.9.2
func RunTest(t *testing.T, conf TestConfig)
func SameElements ¶
SameElements returns true iff IsSubsetOfElements(eq, xs, ys) returns true and IsSubsetOfElements(eq, ys, xs) returns true and false otherwise.
func SetDefaultEventsPubSub ¶
SetDefaultEventsPubSub calls events.SetDefaultPubSub and returns a function that can be used to undo the action. Following calls to SetDefaultEventsPubSub will block until undo function is called.
func StringEqual ¶
StringEqual returns true iff strings x and y are equal and false otherwise.
func TBFromContext ¶ added in v3.9.0
TBFromContext returns the testing.TB saved using ContextWithTB from the context.
func TFromContext ¶
TFromContext returns the *testing.T saved using ContextWithTB from the context.
func WaitContext ¶
WaitContext returns true if f returns before <-ctx.Done() or false otherwise. An example of a f, for which this is useful would be Wait method of sync.WaitGroup. Note, this function leaks a goroutine if f never returns.
func WaitDeadline ¶
WaitDeadline returns WaitTimeout(time.Until(t), f).
func WaitTimeout ¶
WaitTimeout returns true if f returns after at most d or false otherwise. An example of a f, for which this is useful would be Wait method of sync.WaitGroup. Note, this function leaks a goroutine if f never returns.
Types ¶
type ApplicationAccessListRightsRequest ¶
type ApplicationAccessListRightsRequest struct { Context context.Context Message *ttnpb.ApplicationIdentifiers Response chan<- ApplicationAccessListRightsResponse }
type ClusterAuthRequest ¶
type ClusterAuthRequest struct {
Response chan<- grpc.CallOption
}
type ClusterGetPeerRequest ¶
type ClusterGetPeerRequest struct { Context context.Context Role ttnpb.ClusterRole Identifiers cluster.EntityIdentifiers Response chan<- ClusterGetPeerResponse }
type ClusterGetPeerResponse ¶
type ClusterJoinRequest ¶
type ClusterJoinRequest struct {
Response chan<- error
}
type EndDeviceIdentifiersOption ¶ added in v3.11.0
type EndDeviceIdentifiersOption func(*ttnpb.EndDeviceIdentifiers) *ttnpb.EndDeviceIdentifiers
EndDeviceIdentifiersOption transforms ttnpb.EndDeviceIdentifiers and returns it. Implementations must be pure functions with no side-effects.
func (EndDeviceIdentifiersOption) Compose ¶ added in v3.11.0
func (f EndDeviceIdentifiersOption) Compose(opts ...EndDeviceIdentifiersOption) EndDeviceIdentifiersOption
Compose returns a functional composition of f and opts as a singular {*ttnpb.EndDeviceIdentifiers{ $optionType }}.
type EndDeviceIdentifiersOptionNamespace ¶ added in v3.11.0
type EndDeviceIdentifiersOptionNamespace struct{}
EndDeviceIdentifiersOptionNamespace represents the namespace, on which various EndDeviceIdentifiersOption are defined.
var EndDeviceIdentifiersOptions EndDeviceIdentifiersOptionNamespace
EndDeviceIdentifiersOptions is namespace containing ttnpb.EndDeviceIdentifiers options.
func (EndDeviceIdentifiersOptionNamespace) Compose ¶ added in v3.11.0
func (EndDeviceIdentifiersOptionNamespace) Compose(opts ...EndDeviceIdentifiersOption) EndDeviceIdentifiersOption
Compose returns a functional composition of opts as a singular EndDeviceIdentifiersOption.
func (EndDeviceIdentifiersOptionNamespace) WithApplicationIds ¶ added in v3.16.2
func (EndDeviceIdentifiersOptionNamespace) WithApplicationIds(v *ttnpb.ApplicationIdentifiers) EndDeviceIdentifiersOption
WithApplicationIds returns a EndDeviceIdentifiersOption, which returns a copy of ttnpb.EndDeviceIdentifiers with ApplicationIds set to v.
func (EndDeviceIdentifiersOptionNamespace) WithDefaultDevEUI ¶ added in v3.11.0
func (o EndDeviceIdentifiersOptionNamespace) WithDefaultDevEUI() EndDeviceIdentifiersOption
func (EndDeviceIdentifiersOptionNamespace) WithDefaultJoinEUI ¶ added in v3.11.0
func (o EndDeviceIdentifiersOptionNamespace) WithDefaultJoinEUI() EndDeviceIdentifiersOption
func (EndDeviceIdentifiersOptionNamespace) WithDevAddr ¶ added in v3.11.0
func (EndDeviceIdentifiersOptionNamespace) WithDevAddr(v []byte) EndDeviceIdentifiersOption
WithDevAddr returns a EndDeviceIdentifiersOption, which returns a copy of ttnpb.EndDeviceIdentifiers with DevAddr set to v.
func (EndDeviceIdentifiersOptionNamespace) WithDevEui ¶ added in v3.16.2
func (EndDeviceIdentifiersOptionNamespace) WithDevEui(v []byte) EndDeviceIdentifiersOption
WithDevEui returns a EndDeviceIdentifiersOption, which returns a copy of ttnpb.EndDeviceIdentifiers with DevEui set to v.
func (EndDeviceIdentifiersOptionNamespace) WithDeviceId ¶ added in v3.16.2
func (EndDeviceIdentifiersOptionNamespace) WithDeviceId(v string) EndDeviceIdentifiersOption
WithDeviceId returns a EndDeviceIdentifiersOption, which returns a copy of ttnpb.EndDeviceIdentifiers with DeviceId set to v.
func (EndDeviceIdentifiersOptionNamespace) WithJoinEui ¶ added in v3.16.2
func (EndDeviceIdentifiersOptionNamespace) WithJoinEui(v []byte) EndDeviceIdentifiersOption
WithJoinEui returns a EndDeviceIdentifiersOption, which returns a copy of ttnpb.EndDeviceIdentifiers with JoinEui set to v.
type EndDeviceOption ¶ added in v3.11.0
EndDeviceOption transforms ttnpb.EndDevice and returns it. Implementations must be pure functions with no side-effects.
func (EndDeviceOption) Compose ¶ added in v3.11.0
func (f EndDeviceOption) Compose(opts ...EndDeviceOption) EndDeviceOption
Compose returns a functional composition of f and opts as a singular {*ttnpb.EndDevice{ $optionType }}.
type EndDeviceOptionNamespace ¶ added in v3.11.0
type EndDeviceOptionNamespace struct{}
EndDeviceOptionNamespace represents the namespace, on which various EndDeviceOption are defined.
var EndDeviceOptions EndDeviceOptionNamespace
EndDeviceOptions is namespace containing ttnpb.EndDevice options.
func (EndDeviceOptionNamespace) Compose ¶ added in v3.11.0
func (EndDeviceOptionNamespace) Compose(opts ...EndDeviceOption) EndDeviceOption
Compose returns a functional composition of opts as a singular EndDeviceOption.
func (EndDeviceOptionNamespace) WithActivatedAt ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithActivatedAt(v *timestamppb.Timestamp) EndDeviceOption
WithActivatedAt returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ActivatedAt set to v.
func (EndDeviceOptionNamespace) WithApplicationServerAddress ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithApplicationServerAddress(v string) EndDeviceOption
WithApplicationServerAddress returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ApplicationServerAddress set to v.
func (EndDeviceOptionNamespace) WithApplicationServerId ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithApplicationServerId(v string) EndDeviceOption
WithApplicationServerId returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ApplicationServerId set to v.
func (EndDeviceOptionNamespace) WithApplicationServerKekLabel ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithApplicationServerKekLabel(v string) EndDeviceOption
WithApplicationServerKekLabel returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ApplicationServerKekLabel set to v.
func (EndDeviceOptionNamespace) WithAttributes ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithAttributes(v map[string]string) EndDeviceOption
WithAttributes returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Attributes set to v.
func (EndDeviceOptionNamespace) WithBatteryPercentage ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithBatteryPercentage(v *wrapperspb.FloatValue) EndDeviceOption
WithBatteryPercentage returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with BatteryPercentage set to v.
func (EndDeviceOptionNamespace) WithClaimAuthenticationCode ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithClaimAuthenticationCode(v *ttnpb.EndDeviceAuthenticationCode) EndDeviceOption
WithClaimAuthenticationCode returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ClaimAuthenticationCode set to v.
func (EndDeviceOptionNamespace) WithCreatedAt ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithCreatedAt(v *timestamppb.Timestamp) EndDeviceOption
WithCreatedAt returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with CreatedAt set to v.
func (EndDeviceOptionNamespace) WithDefaultDevEUI ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithDefaultDevEUI() EndDeviceOption
func (EndDeviceOptionNamespace) WithDefaultFrequencyPlanID ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithDefaultFrequencyPlanID() EndDeviceOption
func (EndDeviceOptionNamespace) WithDefaultJoinEUI ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithDefaultJoinEUI() EndDeviceOption
func (EndDeviceOptionNamespace) WithDefaultLoRaWANPHYVersion ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithDefaultLoRaWANPHYVersion() EndDeviceOption
func (EndDeviceOptionNamespace) WithDefaultLoRaWANVersion ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithDefaultLoRaWANVersion() EndDeviceOption
func (EndDeviceOptionNamespace) WithDescription ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithDescription(v string) EndDeviceOption
WithDescription returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Description set to v.
func (EndDeviceOptionNamespace) WithDevEUI ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithDevEUI(v *types.EUI64) EndDeviceOption
func (EndDeviceOptionNamespace) WithDownlinkMargin ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithDownlinkMargin(v int32) EndDeviceOption
WithDownlinkMargin returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with DownlinkMargin set to v.
func (EndDeviceOptionNamespace) WithEndDeviceIdentifiersOptions ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithEndDeviceIdentifiersOptions(opts ...EndDeviceIdentifiersOption) EndDeviceOption
func (EndDeviceOptionNamespace) WithFormatters ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithFormatters(v *ttnpb.MessagePayloadFormatters) EndDeviceOption
WithFormatters returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Formatters set to v.
func (EndDeviceOptionNamespace) WithFrequencyPlanId ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithFrequencyPlanId(v string) EndDeviceOption
WithFrequencyPlanId returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with FrequencyPlanId set to v.
func (EndDeviceOptionNamespace) WithIds ¶ added in v3.17.0
func (EndDeviceOptionNamespace) WithIds(v *ttnpb.EndDeviceIdentifiers) EndDeviceOption
WithIds returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Ids set to v.
func (EndDeviceOptionNamespace) WithJoinEUI ¶ added in v3.11.0
func (o EndDeviceOptionNamespace) WithJoinEUI(v *types.EUI64) EndDeviceOption
func (EndDeviceOptionNamespace) WithJoinServerAddress ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithJoinServerAddress(v string) EndDeviceOption
WithJoinServerAddress returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with JoinServerAddress set to v.
func (EndDeviceOptionNamespace) WithLastDevNonce ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithLastDevNonce(v uint32) EndDeviceOption
WithLastDevNonce returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LastDevNonce set to v.
func (EndDeviceOptionNamespace) WithLastDevStatusReceivedAt ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithLastDevStatusReceivedAt(v *timestamppb.Timestamp) EndDeviceOption
WithLastDevStatusReceivedAt returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LastDevStatusReceivedAt set to v.
func (EndDeviceOptionNamespace) WithLastJoinNonce ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithLastJoinNonce(v uint32) EndDeviceOption
WithLastJoinNonce returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LastJoinNonce set to v.
func (EndDeviceOptionNamespace) WithLastRjCount_0 ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithLastRjCount_0(v uint32) EndDeviceOption
WithLastRjCount_0 returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LastRjCount_0 set to v.
func (EndDeviceOptionNamespace) WithLastRjCount_1 ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithLastRjCount_1(v uint32) EndDeviceOption
WithLastRjCount_1 returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LastRjCount_1 set to v.
func (EndDeviceOptionNamespace) WithLastSeenAt ¶ added in v3.19.2
func (EndDeviceOptionNamespace) WithLastSeenAt(v *timestamppb.Timestamp) EndDeviceOption
WithLastSeenAt returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LastSeenAt set to v.
func (EndDeviceOptionNamespace) WithLocations ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithLocations(v map[string]*ttnpb.Location) EndDeviceOption
WithLocations returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Locations set to v.
func (EndDeviceOptionNamespace) WithLoraAllianceProfileIds ¶ added in v3.24.0
func (EndDeviceOptionNamespace) WithLoraAllianceProfileIds(v *ttnpb.LoRaAllianceProfileIdentifiers) EndDeviceOption
WithLoraAllianceProfileIds returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LoraAllianceProfileIds set to v.
func (EndDeviceOptionNamespace) WithLorawanPhyVersion ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithLorawanPhyVersion(v ttnpb.PHYVersion) EndDeviceOption
WithLorawanPhyVersion returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LorawanPhyVersion set to v.
func (EndDeviceOptionNamespace) WithLorawanVersion ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithLorawanVersion(v ttnpb.MACVersion) EndDeviceOption
WithLorawanVersion returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with LorawanVersion set to v.
func (EndDeviceOptionNamespace) WithMACStateOptions ¶ added in v3.12.0
func (o EndDeviceOptionNamespace) WithMACStateOptions(opts ...MACStateOption) EndDeviceOption
func (EndDeviceOptionNamespace) WithMacSettings ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithMacSettings(v *ttnpb.MACSettings) EndDeviceOption
WithMacSettings returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with MacSettings set to v.
func (EndDeviceOptionNamespace) WithMacState ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithMacState(v *ttnpb.MACState) EndDeviceOption
WithMacState returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with MacState set to v.
func (EndDeviceOptionNamespace) WithMaxFrequency ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithMaxFrequency(v uint64) EndDeviceOption
WithMaxFrequency returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with MaxFrequency set to v.
func (EndDeviceOptionNamespace) WithMinFrequency ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithMinFrequency(v uint64) EndDeviceOption
WithMinFrequency returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with MinFrequency set to v.
func (EndDeviceOptionNamespace) WithMulticast ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithMulticast(v bool) EndDeviceOption
WithMulticast returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Multicast set to v.
func (EndDeviceOptionNamespace) WithName ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithName(v string) EndDeviceOption
WithName returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Name set to v.
func (EndDeviceOptionNamespace) WithNetId ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithNetId(v []byte) EndDeviceOption
WithNetId returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with NetId set to v.
func (EndDeviceOptionNamespace) WithNetworkServerAddress ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithNetworkServerAddress(v string) EndDeviceOption
WithNetworkServerAddress returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with NetworkServerAddress set to v.
func (EndDeviceOptionNamespace) WithNetworkServerKekLabel ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithNetworkServerKekLabel(v string) EndDeviceOption
WithNetworkServerKekLabel returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with NetworkServerKekLabel set to v.
func (EndDeviceOptionNamespace) WithPendingMACStateOptions ¶ added in v3.12.0
func (o EndDeviceOptionNamespace) WithPendingMACStateOptions(opts ...MACStateOption) EndDeviceOption
func (EndDeviceOptionNamespace) WithPendingMacState ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithPendingMacState(v *ttnpb.MACState) EndDeviceOption
WithPendingMacState returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with PendingMacState set to v.
func (EndDeviceOptionNamespace) WithPendingSession ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithPendingSession(v *ttnpb.Session) EndDeviceOption
WithPendingSession returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with PendingSession set to v.
func (EndDeviceOptionNamespace) WithPicture ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithPicture(v *ttnpb.Picture) EndDeviceOption
WithPicture returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Picture set to v.
func (EndDeviceOptionNamespace) WithPowerState ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithPowerState(v ttnpb.PowerState) EndDeviceOption
WithPowerState returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with PowerState set to v.
func (EndDeviceOptionNamespace) WithProvisionerId ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithProvisionerId(v string) EndDeviceOption
WithProvisionerId returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ProvisionerId set to v.
func (EndDeviceOptionNamespace) WithProvisioningData ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithProvisioningData(v *structpb.Struct) EndDeviceOption
WithProvisioningData returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ProvisioningData set to v.
func (EndDeviceOptionNamespace) WithQueuedApplicationDownlinks ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithQueuedApplicationDownlinks(vs ...*ttnpb.ApplicationDownlink) EndDeviceOption
WithQueuedApplicationDownlinks returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with QueuedApplicationDownlinks set to vs.
func (EndDeviceOptionNamespace) WithResetsJoinNonces ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithResetsJoinNonces(v bool) EndDeviceOption
WithResetsJoinNonces returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ResetsJoinNonces set to v.
func (EndDeviceOptionNamespace) WithRootKeys ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithRootKeys(v *ttnpb.RootKeys) EndDeviceOption
WithRootKeys returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with RootKeys set to v.
func (EndDeviceOptionNamespace) WithSerialNumber ¶ added in v3.24.0
func (EndDeviceOptionNamespace) WithSerialNumber(v string) EndDeviceOption
WithSerialNumber returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with SerialNumber set to v.
func (EndDeviceOptionNamespace) WithServiceProfileId ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithServiceProfileId(v string) EndDeviceOption
WithServiceProfileId returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with ServiceProfileId set to v.
func (EndDeviceOptionNamespace) WithSession ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithSession(v *ttnpb.Session) EndDeviceOption
WithSession returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with Session set to v.
func (EndDeviceOptionNamespace) WithSkipPayloadCrypto ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithSkipPayloadCrypto(v bool) EndDeviceOption
WithSkipPayloadCrypto returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with SkipPayloadCrypto set to v.
func (EndDeviceOptionNamespace) WithSkipPayloadCryptoOverride ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithSkipPayloadCryptoOverride(v *wrapperspb.BoolValue) EndDeviceOption
WithSkipPayloadCryptoOverride returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with SkipPayloadCryptoOverride set to v.
func (EndDeviceOptionNamespace) WithSupportsClassB ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithSupportsClassB(v bool) EndDeviceOption
WithSupportsClassB returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with SupportsClassB set to v.
func (EndDeviceOptionNamespace) WithSupportsClassC ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithSupportsClassC(v bool) EndDeviceOption
WithSupportsClassC returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with SupportsClassC set to v.
func (EndDeviceOptionNamespace) WithSupportsJoin ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithSupportsJoin(v bool) EndDeviceOption
WithSupportsJoin returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with SupportsJoin set to v.
func (EndDeviceOptionNamespace) WithUpdatedAt ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithUpdatedAt(v *timestamppb.Timestamp) EndDeviceOption
WithUpdatedAt returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with UpdatedAt set to v.
func (EndDeviceOptionNamespace) WithUsedDevNonces ¶ added in v3.11.0
func (EndDeviceOptionNamespace) WithUsedDevNonces(vs ...uint32) EndDeviceOption
WithUsedDevNonces returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with UsedDevNonces set to vs.
func (EndDeviceOptionNamespace) WithVersionIds ¶ added in v3.16.2
func (EndDeviceOptionNamespace) WithVersionIds(v *ttnpb.EndDeviceVersionIdentifiers) EndDeviceOption
WithVersionIds returns a EndDeviceOption, which returns a copy of ttnpb.EndDevice with VersionIds set to v.
type EventEqualConfig ¶ added in v3.9.2
type MACStateOption ¶ added in v3.11.0
MACStateOption transforms ttnpb.MACState and returns it. Implementations must be pure functions with no side-effects.
func (MACStateOption) Compose ¶ added in v3.11.0
func (f MACStateOption) Compose(opts ...MACStateOption) MACStateOption
Compose returns a functional composition of f and opts as a singular {*ttnpb.MACState{ $optionType }}.
type MACStateOptionNamespace ¶ added in v3.11.0
type MACStateOptionNamespace struct{}
MACStateOptionNamespace represents the namespace, on which various MACStateOption are defined.
var MACStateOptions MACStateOptionNamespace
MACStateOptions is namespace containing ttnpb.MACState options.
func (MACStateOptionNamespace) AppendRecentDownlinks ¶ added in v3.12.0
func (o MACStateOptionNamespace) AppendRecentDownlinks(downs ...*ttnpb.MACState_DownlinkMessage) MACStateOption
func (MACStateOptionNamespace) AppendRecentUplinks ¶ added in v3.12.0
func (o MACStateOptionNamespace) AppendRecentUplinks(ups ...*ttnpb.MACState_UplinkMessage) MACStateOption
func (MACStateOptionNamespace) Compose ¶ added in v3.11.0
func (MACStateOptionNamespace) Compose(opts ...MACStateOption) MACStateOption
Compose returns a functional composition of opts as a singular MACStateOption.
func (MACStateOptionNamespace) WithCurrentParameters ¶ added in v3.11.0
func (MACStateOptionNamespace) WithCurrentParameters(v *ttnpb.MACParameters) MACStateOption
WithCurrentParameters returns a MACStateOption, which returns a copy of ttnpb.MACState with CurrentParameters set to v.
func (MACStateOptionNamespace) WithDesiredParameters ¶ added in v3.11.0
func (MACStateOptionNamespace) WithDesiredParameters(v *ttnpb.MACParameters) MACStateOption
WithDesiredParameters returns a MACStateOption, which returns a copy of ttnpb.MACState with DesiredParameters set to v.
func (MACStateOptionNamespace) WithDeviceClass ¶ added in v3.11.0
func (MACStateOptionNamespace) WithDeviceClass(v ttnpb.Class) MACStateOption
WithDeviceClass returns a MACStateOption, which returns a copy of ttnpb.MACState with DeviceClass set to v.
func (MACStateOptionNamespace) WithLastAdrChangeFCntUp ¶ added in v3.16.2
func (MACStateOptionNamespace) WithLastAdrChangeFCntUp(v uint32) MACStateOption
WithLastAdrChangeFCntUp returns a MACStateOption, which returns a copy of ttnpb.MACState with LastAdrChangeFCntUp set to v.
func (MACStateOptionNamespace) WithLastConfirmedDownlinkAt ¶ added in v3.11.0
func (MACStateOptionNamespace) WithLastConfirmedDownlinkAt(v *timestamppb.Timestamp) MACStateOption
WithLastConfirmedDownlinkAt returns a MACStateOption, which returns a copy of ttnpb.MACState with LastConfirmedDownlinkAt set to v.
func (MACStateOptionNamespace) WithLastDevStatusFCntUp ¶ added in v3.11.0
func (MACStateOptionNamespace) WithLastDevStatusFCntUp(v uint32) MACStateOption
WithLastDevStatusFCntUp returns a MACStateOption, which returns a copy of ttnpb.MACState with LastDevStatusFCntUp set to v.
func (MACStateOptionNamespace) WithLastDownlinkAt ¶ added in v3.11.0
func (MACStateOptionNamespace) WithLastDownlinkAt(v *timestamppb.Timestamp) MACStateOption
WithLastDownlinkAt returns a MACStateOption, which returns a copy of ttnpb.MACState with LastDownlinkAt set to v.
func (MACStateOptionNamespace) WithLastNetworkInitiatedDownlinkAt ¶ added in v3.11.0
func (MACStateOptionNamespace) WithLastNetworkInitiatedDownlinkAt(v *timestamppb.Timestamp) MACStateOption
WithLastNetworkInitiatedDownlinkAt returns a MACStateOption, which returns a copy of ttnpb.MACState with LastNetworkInitiatedDownlinkAt set to v.
func (MACStateOptionNamespace) WithLorawanVersion ¶ added in v3.16.2
func (MACStateOptionNamespace) WithLorawanVersion(v ttnpb.MACVersion) MACStateOption
WithLorawanVersion returns a MACStateOption, which returns a copy of ttnpb.MACState with LorawanVersion set to v.
func (MACStateOptionNamespace) WithPendingApplicationDownlink ¶ added in v3.11.0
func (MACStateOptionNamespace) WithPendingApplicationDownlink(v *ttnpb.ApplicationDownlink) MACStateOption
WithPendingApplicationDownlink returns a MACStateOption, which returns a copy of ttnpb.MACState with PendingApplicationDownlink set to v.
func (MACStateOptionNamespace) WithPendingJoinRequest ¶ added in v3.11.0
func (MACStateOptionNamespace) WithPendingJoinRequest(v *ttnpb.MACState_JoinRequest) MACStateOption
WithPendingJoinRequest returns a MACStateOption, which returns a copy of ttnpb.MACState with PendingJoinRequest set to v.
func (MACStateOptionNamespace) WithPendingRelayDownlink ¶ added in v3.28.1
func (MACStateOptionNamespace) WithPendingRelayDownlink(v *ttnpb.RelayForwardDownlinkReq) MACStateOption
WithPendingRelayDownlink returns a MACStateOption, which returns a copy of ttnpb.MACState with PendingRelayDownlink set to v.
func (MACStateOptionNamespace) WithPendingRequests ¶ added in v3.11.0
func (MACStateOptionNamespace) WithPendingRequests(vs ...*ttnpb.MACCommand) MACStateOption
WithPendingRequests returns a MACStateOption, which returns a copy of ttnpb.MACState with PendingRequests set to vs.
func (MACStateOptionNamespace) WithPingSlotPeriodicity ¶ added in v3.11.0
func (MACStateOptionNamespace) WithPingSlotPeriodicity(v *ttnpb.PingSlotPeriodValue) MACStateOption
WithPingSlotPeriodicity returns a MACStateOption, which returns a copy of ttnpb.MACState with PingSlotPeriodicity set to v.
func (MACStateOptionNamespace) WithQueuedJoinAccept ¶ added in v3.11.0
func (MACStateOptionNamespace) WithQueuedJoinAccept(v *ttnpb.MACState_JoinAccept) MACStateOption
WithQueuedJoinAccept returns a MACStateOption, which returns a copy of ttnpb.MACState with QueuedJoinAccept set to v.
func (MACStateOptionNamespace) WithQueuedResponses ¶ added in v3.11.0
func (MACStateOptionNamespace) WithQueuedResponses(vs ...*ttnpb.MACCommand) MACStateOption
WithQueuedResponses returns a MACStateOption, which returns a copy of ttnpb.MACState with QueuedResponses set to vs.
func (MACStateOptionNamespace) WithRecentDownlinks ¶ added in v3.11.0
func (MACStateOptionNamespace) WithRecentDownlinks(vs ...*ttnpb.MACState_DownlinkMessage) MACStateOption
WithRecentDownlinks returns a MACStateOption, which returns a copy of ttnpb.MACState with RecentDownlinks set to vs.
func (MACStateOptionNamespace) WithRecentMacCommandIdentifiers ¶ added in v3.21.0
func (MACStateOptionNamespace) WithRecentMacCommandIdentifiers(vs ...ttnpb.MACCommandIdentifier) MACStateOption
WithRecentMacCommandIdentifiers returns a MACStateOption, which returns a copy of ttnpb.MACState with RecentMacCommandIdentifiers set to vs.
func (MACStateOptionNamespace) WithRecentUplinks ¶ added in v3.11.0
func (MACStateOptionNamespace) WithRecentUplinks(vs ...*ttnpb.MACState_UplinkMessage) MACStateOption
WithRecentUplinks returns a MACStateOption, which returns a copy of ttnpb.MACState with RecentUplinks set to vs.
func (MACStateOptionNamespace) WithRejectedAdrDataRateIndexes ¶ added in v3.16.2
func (MACStateOptionNamespace) WithRejectedAdrDataRateIndexes(vs ...ttnpb.DataRateIndex) MACStateOption
WithRejectedAdrDataRateIndexes returns a MACStateOption, which returns a copy of ttnpb.MACState with RejectedAdrDataRateIndexes set to vs.
func (MACStateOptionNamespace) WithRejectedAdrTxPowerIndexes ¶ added in v3.16.2
func (MACStateOptionNamespace) WithRejectedAdrTxPowerIndexes(vs ...uint32) MACStateOption
WithRejectedAdrTxPowerIndexes returns a MACStateOption, which returns a copy of ttnpb.MACState with RejectedAdrTxPowerIndexes set to vs.
func (MACStateOptionNamespace) WithRejectedDataRateRanges ¶ added in v3.11.0
func (MACStateOptionNamespace) WithRejectedDataRateRanges(v map[uint64]*ttnpb.MACState_DataRateRanges) MACStateOption
WithRejectedDataRateRanges returns a MACStateOption, which returns a copy of ttnpb.MACState with RejectedDataRateRanges set to v.
func (MACStateOptionNamespace) WithRejectedFrequencies ¶ added in v3.11.0
func (MACStateOptionNamespace) WithRejectedFrequencies(vs ...uint64) MACStateOption
WithRejectedFrequencies returns a MACStateOption, which returns a copy of ttnpb.MACState with RejectedFrequencies set to vs.
func (MACStateOptionNamespace) WithRxWindowsAvailable ¶ added in v3.11.0
func (MACStateOptionNamespace) WithRxWindowsAvailable(v bool) MACStateOption
WithRxWindowsAvailable returns a MACStateOption, which returns a copy of ttnpb.MACState with RxWindowsAvailable set to v.
type MockApplicationAccessServer ¶
type MockApplicationAccessServer struct { ttnpb.UnimplementedApplicationAccessServer CreateAPIKeyFunc func(context.Context, *ttnpb.CreateApplicationAPIKeyRequest) (*ttnpb.APIKey, error) GetAPIKeyFunc func(context.Context, *ttnpb.GetApplicationAPIKeyRequest) (*ttnpb.APIKey, error) ListAPIKeysFunc func(context.Context, *ttnpb.ListApplicationAPIKeysRequest) (*ttnpb.APIKeys, error) ListCollaboratorsFunc func(context.Context, *ttnpb.ListApplicationCollaboratorsRequest) (*ttnpb.Collaborators, error) ListRightsFunc func(context.Context, *ttnpb.ApplicationIdentifiers) (*ttnpb.Rights, error) GetCollaboratorFunc func(context.Context, *ttnpb.GetApplicationCollaboratorRequest) (*ttnpb.GetCollaboratorResponse, error) SetCollaboratorFunc func(context.Context, *ttnpb.SetApplicationCollaboratorRequest) (*emptypb.Empty, error) UpdateAPIKeyFunc func(context.Context, *ttnpb.UpdateApplicationAPIKeyRequest) (*ttnpb.APIKey, error) }
MockApplicationAccessServer is a mock ttnpb.ApplicationAccessServer used for testing.
func (MockApplicationAccessServer) CreateAPIKey ¶
func (m MockApplicationAccessServer) CreateAPIKey(ctx context.Context, req *ttnpb.CreateApplicationAPIKeyRequest) (*ttnpb.APIKey, error)
CreateAPIKey calls CreateAPIKeyFunc if set and panics otherwise.
func (MockApplicationAccessServer) GetAPIKey ¶
func (m MockApplicationAccessServer) GetAPIKey(ctx context.Context, req *ttnpb.GetApplicationAPIKeyRequest) (*ttnpb.APIKey, error)
GetAPIKey calls GetAPIKeyFunc if set and panics otherwise.
func (MockApplicationAccessServer) GetCollaborator ¶
func (m MockApplicationAccessServer) GetCollaborator(ctx context.Context, req *ttnpb.GetApplicationCollaboratorRequest) (*ttnpb.GetCollaboratorResponse, error)
GetCollaborator calls GetCollaboratorFunc if set and panics otherwise.
func (MockApplicationAccessServer) ListAPIKeys ¶
func (m MockApplicationAccessServer) ListAPIKeys(ctx context.Context, req *ttnpb.ListApplicationAPIKeysRequest) (*ttnpb.APIKeys, error)
ListAPIKeys calls ListAPIKeysFunc if set and panics otherwise.
func (MockApplicationAccessServer) ListCollaborators ¶
func (m MockApplicationAccessServer) ListCollaborators(ctx context.Context, req *ttnpb.ListApplicationCollaboratorsRequest) (*ttnpb.Collaborators, error)
ListCollaborators calls ListCollaboratorsFunc if set and panics otherwise.
func (MockApplicationAccessServer) ListRights ¶
func (m MockApplicationAccessServer) ListRights(ctx context.Context, req *ttnpb.ApplicationIdentifiers) (*ttnpb.Rights, error)
ListRights calls ListRightsFunc if set and panics otherwise.
func (MockApplicationAccessServer) SetCollaborator ¶
func (m MockApplicationAccessServer) SetCollaborator(ctx context.Context, req *ttnpb.SetApplicationCollaboratorRequest) (*emptypb.Empty, error)
SetCollaborator calls SetCollaboratorFunc if set and panics otherwise.
func (MockApplicationAccessServer) UpdateAPIKey ¶
func (m MockApplicationAccessServer) UpdateAPIKey(ctx context.Context, req *ttnpb.UpdateApplicationAPIKeyRequest) (*ttnpb.APIKey, error)
UpdateAPIKey calls UpdateAPIKeyFunc if set and panics otherwise.
type MockClientStream ¶
type MockClientStream struct { *MockStream HeaderFunc func() (metadata.MD, error) TrailerFunc func() metadata.MD CloseSendFunc func() error }
MockClientStream is a mock grpc.ClientStream.
func (MockClientStream) CloseSend ¶
func (m MockClientStream) CloseSend() error
CloseSend calls CloseSendFunc if set and panics otherwise.
func (MockClientStream) Header ¶
func (m MockClientStream) Header() (metadata.MD, error)
Header calls HeaderFunc if set and panics otherwise.
func (MockClientStream) Trailer ¶
func (m MockClientStream) Trailer() metadata.MD
Trailer calls TrailerFunc if set and panics otherwise.
type MockClock ¶
type MockClock struct {
// contains filtered or unexported fields
}
MockClock is used to mock time package functionality.
type MockCluster ¶
type MockCluster struct { JoinFunc func() error LeaveFunc func() error GetPeersFunc func(ctx context.Context, role ttnpb.ClusterRole) ([]cluster.Peer, error) GetPeerFunc func(ctx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (cluster.Peer, error) ClaimIDsFunc func(ctx context.Context, ids cluster.EntityIdentifiers) error UnclaimIDsFunc func(ctx context.Context, ids cluster.EntityIdentifiers) error TLSFunc func() bool AuthFunc func() grpc.CallOption WithVerifiedSourceFunc func(ctx context.Context) context.Context }
MockCluster is a mock cluster.Cluster used for testing.
func (MockCluster) Auth ¶
func (m MockCluster) Auth() grpc.CallOption
Auth calls AuthFunc if set and panics otherwise.
func (MockCluster) ClaimIDs ¶
func (m MockCluster) ClaimIDs(ctx context.Context, ids cluster.EntityIdentifiers) error
ClaimIDs calls ClaimIDsFunc if set and panics otherwise.
func (MockCluster) GetPeer ¶
func (m MockCluster) GetPeer(ctx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (cluster.Peer, error)
GetPeer calls GetPeerFunc if set and panics otherwise.
func (MockCluster) GetPeerConn ¶
func (m MockCluster) GetPeerConn(ctx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (*grpc.ClientConn, error)
GetPeerConn calls GetPeer and then Conn.
func (MockCluster) GetPeers ¶
func (m MockCluster) GetPeers(ctx context.Context, role ttnpb.ClusterRole) ([]cluster.Peer, error)
GetPeers calls GetPeersFunc if set and panics otherwise.
func (MockCluster) Join ¶
func (m MockCluster) Join() error
Join calls JoinFunc if set and panics otherwise.
func (MockCluster) Leave ¶
func (m MockCluster) Leave() error
Leave calls LeaveFunc if set and panics otherwise.
func (MockCluster) TLS ¶
func (m MockCluster) TLS() bool
TLS calls TLSFunc if set and panics otherwise.
func (MockCluster) UnclaimIDs ¶
func (m MockCluster) UnclaimIDs(ctx context.Context, ids cluster.EntityIdentifiers) error
UnclaimIDs calls UnclaimIDsFunc if set and panics otherwise.
func (MockCluster) WithVerifiedSource ¶
func (m MockCluster) WithVerifiedSource(ctx context.Context) context.Context
WithVerifiedSource calls WithVerifiedSourceFunc if set and panics otherwise.
type MockEventPubSub ¶
type MockEventPubSub struct { PublishFunc func(...events.Event) SubscribeFunc func(context.Context, []string, []*ttnpb.EntityIdentifiers, events.Handler) error }
func (MockEventPubSub) Publish ¶
func (m MockEventPubSub) Publish(evs ...events.Event)
Publish calls PublishFunc if set and panics otherwise.
type MockPeer ¶
type MockPeer struct { NameFunc func() string ConnFunc func() (*grpc.ClientConn, error) HasRoleFunc func(ttnpb.ClusterRole) bool RolesFunc func() []ttnpb.ClusterRole TagsFunc func() map[string]string }
MockPeer is a mock cluster.Peer used for testing.
func NewGRPCServerPeer ¶
NewGRPCServerPeer creates a new MockPeer with ConnFunc, which always returns the same loopback connection to the server itself. srv is the implementation of the gRPC interface. registrators represents a slice of functions, which register the gRPC interface implementation at a gRPC server.
func (MockPeer) Conn ¶
func (m MockPeer) Conn() (*grpc.ClientConn, error)
Conn calls ConnFunc if set and panics otherwise.
func (MockPeer) HasRole ¶
func (m MockPeer) HasRole(r ttnpb.ClusterRole) bool
HasRole calls HasRoleFunc if set and panics otherwise.
func (MockPeer) Roles ¶
func (m MockPeer) Roles() []ttnpb.ClusterRole
Roles calls RolesFunc if set and panics otherwise.
type MockServerStream ¶
type MockServerStream struct { *MockStream SetHeaderFunc func(md metadata.MD) error SendHeaderFunc func(md metadata.MD) error SetTrailerFunc func(md metadata.MD) }
MockServerStream is a mock grpc.ServerStream.
func (MockServerStream) SendHeader ¶
func (m MockServerStream) SendHeader(md metadata.MD) error
SendHeader calls SendHeaderFunc if set and panics otherwise.
func (MockServerStream) SetHeader ¶
func (m MockServerStream) SetHeader(md metadata.MD) error
SetHeader calls SetHeaderFunc if set and panics otherwise.
func (MockServerStream) SetTrailer ¶
func (m MockServerStream) SetTrailer(md metadata.MD)
SetTrailer calls SetTrailerFunc if set and panics otherwise.
type MockServerTransportStream ¶
type MockServerTransportStream struct { *MockServerStream MethodFunc func() string SetTrailerFunc func(metadata.MD) error }
MockServerTransportStream is a mock grpc.ServerTransportStream.
func (MockServerTransportStream) Method ¶
func (m MockServerTransportStream) Method() string
Method calls MethodFunc if set and panics otherwise.
func (MockServerTransportStream) SetTrailer ¶
func (m MockServerTransportStream) SetTrailer(md metadata.MD) error
SetTrailer calls SetTrailerFunc if set and panics otherwise.
type MockStream ¶
type MockStream struct { ContextFunc func() context.Context SendMsgFunc func(m any) error RecvMsgFunc func(m any) error }
MockStream is a mock grpc.Stream.
func (MockStream) Context ¶
func (m MockStream) Context() context.Context
Context calls ContextFunc if set and panics otherwise.
func (MockStream) RecvMsg ¶
func (m MockStream) RecvMsg(msg any) error
RecvMsg calls RecvMsgFunc if set and panics otherwise.
func (MockStream) SendMsg ¶
func (m MockStream) SendMsg(msg any) error
SendMsg calls SendMsgFunc if set and panics otherwise.
type Ranger ¶
Ranger represents an entity, which can be ranged over(e.g. sync.Map).
func WrapRanger ¶
WrapRanger returns Ranger, true if v can be ranged over and nil, false otherwise.
type RootKeysOption ¶ added in v3.11.0
RootKeysOption transforms ttnpb.RootKeys and returns it. Implementations must be pure functions with no side-effects.
func (RootKeysOption) Compose ¶ added in v3.11.0
func (f RootKeysOption) Compose(opts ...RootKeysOption) RootKeysOption
Compose returns a functional composition of f and opts as a singular {*ttnpb.RootKeys{ $optionType }}.
type RootKeysOptionNamespace ¶ added in v3.11.0
type RootKeysOptionNamespace struct{}
RootKeysOptionNamespace represents the namespace, on which various RootKeysOption are defined.
var RootKeysOptions RootKeysOptionNamespace
RootKeysOptions is namespace containing ttnpb.RootKeys options.
func (RootKeysOptionNamespace) Compose ¶ added in v3.11.0
func (RootKeysOptionNamespace) Compose(opts ...RootKeysOption) RootKeysOption
Compose returns a functional composition of opts as a singular RootKeysOption.
func (RootKeysOptionNamespace) WithAppKey ¶ added in v3.11.0
func (RootKeysOptionNamespace) WithAppKey(v *ttnpb.KeyEnvelope) RootKeysOption
WithAppKey returns a RootKeysOption, which returns a copy of ttnpb.RootKeys with AppKey set to v.
func (RootKeysOptionNamespace) WithNwkKey ¶ added in v3.11.0
func (RootKeysOptionNamespace) WithNwkKey(v *ttnpb.KeyEnvelope) RootKeysOption
WithNwkKey returns a RootKeysOption, which returns a copy of ttnpb.RootKeys with NwkKey set to v.
func (RootKeysOptionNamespace) WithRootKeyId ¶ added in v3.16.2
func (RootKeysOptionNamespace) WithRootKeyId(v string) RootKeysOption
WithRootKeyId returns a RootKeysOption, which returns a copy of ttnpb.RootKeys with RootKeyId set to v.
type SessionKeysOption ¶ added in v3.11.0
type SessionKeysOption func(*ttnpb.SessionKeys) *ttnpb.SessionKeys
SessionKeysOption transforms ttnpb.SessionKeys and returns it. Implementations must be pure functions with no side-effects.
func (SessionKeysOption) Compose ¶ added in v3.11.0
func (f SessionKeysOption) Compose(opts ...SessionKeysOption) SessionKeysOption
Compose returns a functional composition of f and opts as a singular {*ttnpb.SessionKeys{ $optionType }}.
type SessionKeysOptionNamespace ¶ added in v3.11.0
type SessionKeysOptionNamespace struct{}
SessionKeysOptionNamespace represents the namespace, on which various SessionKeysOption are defined.
var SessionKeysOptions SessionKeysOptionNamespace
SessionKeysOptions is namespace containing ttnpb.SessionKeys options.
func (SessionKeysOptionNamespace) Compose ¶ added in v3.11.0
func (SessionKeysOptionNamespace) Compose(opts ...SessionKeysOption) SessionKeysOption
Compose returns a functional composition of opts as a singular SessionKeysOption.
func (SessionKeysOptionNamespace) WithAppSKey ¶ added in v3.11.0
func (SessionKeysOptionNamespace) WithAppSKey(v *ttnpb.KeyEnvelope) SessionKeysOption
WithAppSKey returns a SessionKeysOption, which returns a copy of ttnpb.SessionKeys with AppSKey set to v.
func (SessionKeysOptionNamespace) WithDefaultAppSKey ¶ added in v3.11.0
func (o SessionKeysOptionNamespace) WithDefaultAppSKey() SessionKeysOption
func (SessionKeysOptionNamespace) WithDefaultNwkKeys ¶ added in v3.11.0
func (o SessionKeysOptionNamespace) WithDefaultNwkKeys(macVersion ttnpb.MACVersion) SessionKeysOption
func (SessionKeysOptionNamespace) WithDefaultNwkKeysWrapped ¶ added in v3.12.0
func (o SessionKeysOptionNamespace) WithDefaultNwkKeysWrapped(macVersion ttnpb.MACVersion) SessionKeysOption
func (SessionKeysOptionNamespace) WithDefaultSessionKeyID ¶ added in v3.12.0
func (o SessionKeysOptionNamespace) WithDefaultSessionKeyID() SessionKeysOption
func (SessionKeysOptionNamespace) WithFNwkSIntKey ¶ added in v3.11.0
func (SessionKeysOptionNamespace) WithFNwkSIntKey(v *ttnpb.KeyEnvelope) SessionKeysOption
WithFNwkSIntKey returns a SessionKeysOption, which returns a copy of ttnpb.SessionKeys with FNwkSIntKey set to v.
func (SessionKeysOptionNamespace) WithNwkKeys ¶ added in v3.12.0
func (o SessionKeysOptionNamespace) WithNwkKeys(fNwkSIntKey, nwkSEncKey, sNwkSIntKey *ttnpb.KeyEnvelope) SessionKeysOption
func (SessionKeysOptionNamespace) WithNwkSEncKey ¶ added in v3.11.0
func (SessionKeysOptionNamespace) WithNwkSEncKey(v *ttnpb.KeyEnvelope) SessionKeysOption
WithNwkSEncKey returns a SessionKeysOption, which returns a copy of ttnpb.SessionKeys with NwkSEncKey set to v.
func (SessionKeysOptionNamespace) WithSNwkSIntKey ¶ added in v3.11.0
func (SessionKeysOptionNamespace) WithSNwkSIntKey(v *ttnpb.KeyEnvelope) SessionKeysOption
WithSNwkSIntKey returns a SessionKeysOption, which returns a copy of ttnpb.SessionKeys with SNwkSIntKey set to v.
func (SessionKeysOptionNamespace) WithSessionKeyId ¶ added in v3.16.2
func (SessionKeysOptionNamespace) WithSessionKeyId(v []byte) SessionKeysOption
WithSessionKeyId returns a SessionKeysOption, which returns a copy of ttnpb.SessionKeys with SessionKeyId set to v.
type SessionOption ¶ added in v3.11.0
SessionOption transforms ttnpb.Session and returns it. Implementations must be pure functions with no side-effects.
func (SessionOption) Compose ¶ added in v3.11.0
func (f SessionOption) Compose(opts ...SessionOption) SessionOption
Compose returns a functional composition of f and opts as a singular {*ttnpb.Session{ $optionType }}.
type SessionOptionNamespace ¶ added in v3.11.0
type SessionOptionNamespace struct{}
SessionOptionNamespace represents the namespace, on which various SessionOption are defined.
var SessionOptions SessionOptionNamespace
SessionOptions is namespace containing ttnpb.Session options.
func (SessionOptionNamespace) Compose ¶ added in v3.11.0
func (SessionOptionNamespace) Compose(opts ...SessionOption) SessionOption
Compose returns a functional composition of opts as a singular SessionOption.
func (SessionOptionNamespace) WithDefaultAppSKey ¶ added in v3.11.0
func (o SessionOptionNamespace) WithDefaultAppSKey() SessionOption
func (SessionOptionNamespace) WithDefaultNwkKeys ¶ added in v3.11.0
func (o SessionOptionNamespace) WithDefaultNwkKeys(macVersion ttnpb.MACVersion) SessionOption
func (SessionOptionNamespace) WithDevAddr ¶ added in v3.11.0
func (SessionOptionNamespace) WithDevAddr(v []byte) SessionOption
WithDevAddr returns a SessionOption, which returns a copy of ttnpb.Session with DevAddr set to v.
func (SessionOptionNamespace) WithKeys ¶ added in v3.16.2
func (SessionOptionNamespace) WithKeys(v *ttnpb.SessionKeys) SessionOption
WithKeys returns a SessionOption, which returns a copy of ttnpb.Session with Keys set to v.
func (SessionOptionNamespace) WithLastAFCntDown ¶ added in v3.11.0
func (SessionOptionNamespace) WithLastAFCntDown(v uint32) SessionOption
WithLastAFCntDown returns a SessionOption, which returns a copy of ttnpb.Session with LastAFCntDown set to v.
func (SessionOptionNamespace) WithLastConfFCntDown ¶ added in v3.11.0
func (SessionOptionNamespace) WithLastConfFCntDown(v uint32) SessionOption
WithLastConfFCntDown returns a SessionOption, which returns a copy of ttnpb.Session with LastConfFCntDown set to v.
func (SessionOptionNamespace) WithLastFCntUp ¶ added in v3.11.0
func (SessionOptionNamespace) WithLastFCntUp(v uint32) SessionOption
WithLastFCntUp returns a SessionOption, which returns a copy of ttnpb.Session with LastFCntUp set to v.
func (SessionOptionNamespace) WithLastNFCntDown ¶ added in v3.11.0
func (SessionOptionNamespace) WithLastNFCntDown(v uint32) SessionOption
WithLastNFCntDown returns a SessionOption, which returns a copy of ttnpb.Session with LastNFCntDown set to v.
func (SessionOptionNamespace) WithQueuedApplicationDownlinks ¶ added in v3.11.0
func (SessionOptionNamespace) WithQueuedApplicationDownlinks(vs ...*ttnpb.ApplicationDownlink) SessionOption
WithQueuedApplicationDownlinks returns a SessionOption, which returns a copy of ttnpb.Session with QueuedApplicationDownlinks set to vs.
func (SessionOptionNamespace) WithSessionKeysOptions ¶ added in v3.11.0
func (o SessionOptionNamespace) WithSessionKeysOptions(opts ...SessionKeysOption) SessionOption
func (SessionOptionNamespace) WithStartedAt ¶ added in v3.11.0
func (SessionOptionNamespace) WithStartedAt(v *timestamppb.Timestamp) SessionOption
WithStartedAt returns a SessionOption, which returns a copy of ttnpb.Session with StartedAt set to v.
type SubtestConfig ¶ added in v3.9.2
type TestConfig ¶ added in v3.9.2
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package apitest contains common API definition test utilities.
|
Package apitest contains common API definition test utilities. |
Package assertions contains custom assertions compatible with github.com/smarty/assertions.
|
Package assertions contains custom assertions compatible with github.com/smarty/assertions. |
should
Package should wraps assertions in github.com/smarty/assertions and util/test/assertions.
|
Package should wraps assertions in github.com/smarty/assertions and util/test/assertions. |