testutils

package
v0.0.0-...-6cc63a5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePubsubTopic

func CreatePubsubTopic(client *pubsub.Client, ctx context.Context, topicNames []string) error

func CreateSubscriptions

func CreateSubscriptions(client *pubsub.Client, ctx context.Context, topicNames []string) (map[string]*pubsub.Subscription, error)

func ReadFile

func ReadFile(filepath string) ([]byte, error)

ReadFile reads a file and returns the byte contents

func StartPubSubEmulator

func StartPubSubEmulator(ctx context.Context, project string) (testcontainers.Container, *pubsub.Client, error)

func TestSetupEnvForGoogleCredentials

func TestSetupEnvForGoogleCredentials(t *testing.T) (reset func())

TestSetupEnvForGoogleCredentials creates a temporary file containing dummy user account JSON then set the environment variable GOOGLE_APPLICATION_CREDENTIALS to point to the file. This is useful for tests that assume Google Cloud Client libraries can automatically find the user account credentials in any environment. At the end of the test, the returned function can be called to perform cleanup.

Types

type Config

type Config struct {
	Host   string `default:"localhost"`
	Port   int    `default:"3000"`
	PubSub PubSub
	Sentry Sentry
}

type PubSub

type PubSub struct {
	Project   string `default:"dev"`
	TopicName string `default:"update"`
}

type Sentry

type Sentry struct {
	Url    string `default:"https://xx.xx.xx"`
	Labels map[string]string
}

Jump to

Keyboard shortcuts

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