test

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustFlushRedis

func MustFlushRedis(p *redis.Pool)

MustFlushRedis flushes the Redis storage.

func MustPrefillRedisPool

func MustPrefillRedisPool(p *redis.Pool, count int)

MustPrefillRedisPool pre-fills the pool with count connections.

func MustResetDB

func MustResetDB(db *common.DBLogger)

MustResetDB re-applies all database migrations.

func NewApplicationServerPool

func NewApplicationServerPool(client *ApplicationClient) asclient.Pool

NewApplicationServerPool create an application-server client pool which always returns the given client on Get.

func NewJoinServerPool

func NewJoinServerPool(client jsclient.Client) jsclient.Pool

NewJoinServerPool create a join-server pool for testing.

Types

type ApplicationClient

type ApplicationClient struct {
	HandleDataUpErr        error
	HandleProprietaryUpErr error
	HandleDownlinkACKErr   error
	SetDeviceStatusError   error

	HandleDataUpChan        chan as.HandleUplinkDataRequest
	HandleProprietaryUpChan chan as.HandleProprietaryUplinkRequest
	HandleErrorChan         chan as.HandleErrorRequest
	HandleDownlinkACKChan   chan as.HandleDownlinkACKRequest
	SetDeviceStatusChan     chan as.SetDeviceStatusRequest

	HandleDataUpResponse        empty.Empty
	HandleProprietaryUpResponse empty.Empty
	HandleErrorResponse         empty.Empty
	HandleDownlinkACKResponse   empty.Empty
	SetDeviceStatusResponse     empty.Empty
}

ApplicationClient is an application client for testing.

func NewApplicationClient

func NewApplicationClient() *ApplicationClient

NewApplicationClient returns a new ApplicationClient.

func (*ApplicationClient) HandleDownlinkACK

func (t *ApplicationClient) HandleDownlinkACK(ctx context.Context, in *as.HandleDownlinkACKRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleDownlinkACK method.

func (*ApplicationClient) HandleError

func (t *ApplicationClient) HandleError(ctx context.Context, in *as.HandleErrorRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleError method.

func (t *ApplicationClient) HandleProprietaryUplink(ctx context.Context, in *as.HandleProprietaryUplinkRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleProprietaryUplink method.

func (*ApplicationClient) HandleUplinkData

func (t *ApplicationClient) HandleUplinkData(ctx context.Context, in *as.HandleUplinkDataRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleUplinkData method.

func (*ApplicationClient) SetDeviceStatus

func (t *ApplicationClient) SetDeviceStatus(ctx context.Context, in *as.SetDeviceStatusRequest, opts ...grpc.CallOption) (*empty.Empty, error)

SetDeviceStatus method.

type ApplicationServerPool

type ApplicationServerPool struct {
	Client      as.ApplicationServerServiceClient
	GetHostname string
}

ApplicationServerPool is an application-server pool for testing.

func (*ApplicationServerPool) Get

func (p *ApplicationServerPool) Get(hostname string, caCert, tlsCert, tlsKey []byte) (as.ApplicationServerServiceClient, error)

Get returns the Client.

type Config

type Config struct {
	RedisURL    string
	PostgresDSN string
}

Config contains the test configuration.

func GetConfig

func GetConfig() *Config

GetConfig returns the test configuration.

type DatabaseTestSuiteBase

type DatabaseTestSuiteBase struct {
	// contains filtered or unexported fields
}

DatabaseTestSuiteBase provides the setup and teardown of the database for every test-run.

func (*DatabaseTestSuiteBase) DB

DB returns the database.

func (*DatabaseTestSuiteBase) RedisPool

func (b *DatabaseTestSuiteBase) RedisPool() *redis.Pool

RedisPool returns the redis.Pool object.

func (*DatabaseTestSuiteBase) SetupSuite

func (b *DatabaseTestSuiteBase) SetupSuite()

SetupSuite is called once before starting the test-suite.

func (*DatabaseTestSuiteBase) SetupTest

func (b *DatabaseTestSuiteBase) SetupTest()

SetupTest is called before every test.

func (*DatabaseTestSuiteBase) TearDownTest

func (b *DatabaseTestSuiteBase) TearDownTest()

TearDownTest is called after every test.

func (*DatabaseTestSuiteBase) Tx

func (b *DatabaseTestSuiteBase) Tx() sqlx.Ext

Tx returns a database transaction (which is rolled back after every test).

type GatewayBackend

type GatewayBackend struct {
	TXPacketChan            chan gw.TXPacket
	GatewayConfigPacketChan chan gw.GatewayConfigPacket
	// contains filtered or unexported fields
}

GatewayBackend is a test gateway backend.

func NewGatewayBackend

func NewGatewayBackend() *GatewayBackend

NewGatewayBackend returns a new GatewayBackend.

func (*GatewayBackend) Close

func (b *GatewayBackend) Close() error

Close method.

func (*GatewayBackend) RXPacketChan

func (b *GatewayBackend) RXPacketChan() chan gw.RXPacket

RXPacketChan method.

func (*GatewayBackend) SendGatewayConfigPacket

func (b *GatewayBackend) SendGatewayConfigPacket(config gw.GatewayConfigPacket) error

SendGatewayConfigPacket method.

func (*GatewayBackend) SendTXPacket

func (b *GatewayBackend) SendTXPacket(txPacket gw.TXPacket) error

SendTXPacket method.

func (*GatewayBackend) StatsPacketChan

func (b *GatewayBackend) StatsPacketChan() chan gw.GatewayStatsPacket

StatsPacketChan method.

type JoinServerClient

type JoinServerClient struct {
	JoinReqPayloadChan   chan backend.JoinReqPayload
	RejoinReqPayloadChan chan backend.RejoinReqPayload
	JoinReqError         error
	RejoinReqError       error
	JoinAnsPayload       backend.JoinAnsPayload
	RejoinAnsPayload     backend.RejoinAnsPayload
}

JoinServerClient is a join-server client for testing.

func NewJoinServerClient

func NewJoinServerClient() *JoinServerClient

NewJoinServerClient creates a new join-server client.

func (*JoinServerClient) JoinReq

JoinReq method.

func (*JoinServerClient) RejoinReq

RejoinReq method.

type JoinServerPool

type JoinServerPool struct {
	Client     jsclient.Client
	GetJoinEUI lorawan.EUI64
}

JoinServerPool is a join-server pool for testing.

func (*JoinServerPool) Get

func (p *JoinServerPool) Get(joinEUI lorawan.EUI64) (jsclient.Client, error)

Get method.

type NetworkControllerClient

type NetworkControllerClient struct {
	HandleRXInfoChan           chan nc.HandleUplinkMetaDataRequest
	HandleDataUpMACCommandChan chan nc.HandleUplinkMACCommandRequest

	HandleRXInfoResponse           empty.Empty
	HandleDataUpMACCommandResponse empty.Empty
}

NetworkControllerClient is a network-controller client for testing.

func NewNetworkControllerClient

func NewNetworkControllerClient() *NetworkControllerClient

NewNetworkControllerClient returns a new NetworkControllerClient.

func (*NetworkControllerClient) HandleUplinkMACCommand

func (t *NetworkControllerClient) HandleUplinkMACCommand(ctx context.Context, in *nc.HandleUplinkMACCommandRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleUplinkMACCommand method.

func (*NetworkControllerClient) HandleUplinkMetaData

func (t *NetworkControllerClient) HandleUplinkMetaData(ctx context.Context, in *nc.HandleUplinkMetaDataRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleUplinkMetaData method.

Jump to

Keyboard shortcuts

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