testing

package
v0.0.0-...-5238b66 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const AppExitTopic = "natssync.testing.exitapp"

Variables

This section is empty.

Functions

func NotifyOnAppExitMessage

func NotifyOnAppExitMessage(natsConnection NatsConnectionInterface, quitChannel chan os.Signal)

NotifyOnAppExitMessage subscribes to the AppExitTopic for the given NATS client. When a message is received, an os.Interrupt signal is sent using the given channel. This can then be used to exit the app 'gracefully', which is required for collecting code coverage reports generated via 'go test'.

WARNING: this function should only be used during testing (generally for the purposes of collecting coverage, as explained above).

func NotifyOnAppExitMessageGeneric

func NotifyOnAppExitMessageGeneric(client nats2.ClientInterface, quitChannel chan os.Signal)

NotifyOnAppExitMessageGeneric does the same thing as NotifyOnAppExitMessage but allows using the generic interface defined in this repository.

func NotifyOnAppExitMessageGenericNats

func NotifyOnAppExitMessageGenericNats(client *natspkg.Conn, quitChannel chan os.Signal)

Types

type NatsConnectionInterface

type NatsConnectionInterface interface {
	Subscribe(subj string, cb nats.MsgHandler) (*nats.Subscription, error)
}

Jump to

Keyboard shortcuts

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