google

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

package google provide structures to catch/send message to pubsub instance

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMatch        = errors.New("no match")
	ErrUnknownMessage = errors.New("positions does not match a known message")
)

Functions

func Debug

func Debug() error

Debug activate debug logs.

func NoLog

func NoLog()

NoLog disable logging under Fatal level.

func Reset

func Reset() error

Reset matcher instance.

func ResetLog

func ResetLog()

ResetLog activate debug logs.

Types

type Client

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

Client provides a structure to manage GCP instances.

func Pubsub

func Pubsub(name string, cli *pubsub.Client, store *picker.Store) *Client

Pubsub initializes a Client instance for GCP pubsub. It will persists instance using provided name to be injectable through {{gcp.name}} in gherkin steps.

Providing an empty picker does not impact initialization. It will just not picked the instance.

You can always call Client.Persist to save client instance in a picker store.

func (*Client) AssertMessageMetadata

func (ps *Client) AssertMessageMetadata(data *godog.Table, within time.Duration) error

AssertMessageMetadata assert pubsub client received a message metadata matching providing assertions from godog.Table.

/!\ It does not apply filters to message data.

func (*Client) AssertMessageReceived

func (ps *Client) AssertMessageReceived(data *godog.Table, within time.Duration) error

AssertMessageReceived assert pubsub client received a message matching providing assertions from godog.Table.

/!\ It does not apply filters to message metadata.

func (*Client) AssertXMessageData

func (ps *Client) AssertXMessageData(position int, expectedMessage *godog.Table) error

AssertXMessageData assert pubsub client Xth message data matches provided conditions.

/!\ It does not apply filters to message metadata.

func (*Client) AssertXMessageMetadata

func (ps *Client) AssertXMessageMetadata(position int, expectedMetadata *godog.Table) error

AssertXMessageMetadata assert pubsub client Xth message metadata matches provided conditions.

/!\ It does not apply filters to message data.

func (*Client) Persist

func (ps *Client) Persist(store *picker.Store)

Persist persists client instance through picker instance using gcp.name key.

func (*Client) ReceiveOn

func (ps *Client) ReceiveOn(subscription string, acknowledgeOnReception bool) error

ReceiveOn set up pubsub message reception from subscription. Messages will be stored in a slice until Client.Reset is called.

func (*Client) Reset

func (ps *Client) Reset()

Reset instance.

func (*Client) SeedFromFile

func (ps *Client) SeedFromFile(filePath string, store *picker.Store) error

func (*Client) Send

func (ps *Client) Send(topic string, data *godog.DocString) error

Send send message to topic

type Manifest

type Manifest struct {
	Send            []Message `yaml:"send"`
	Receive         []string  `yaml:"receive"`
	AutoAcknowledge bool      `yaml:"acknowledgeOnReceive"`
}

func (Manifest) Load

func (m Manifest) Load(cli *Client) error

type Message

type Message struct {
	Topic    string                 `yaml:"topic"`
	Data     map[string]interface{} `yaml:"data"`
	Metadata map[string]string      `yaml:"metadata"`
}

Jump to

Keyboard shortcuts

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