testutils

package
v0.0.0-...-9fddfa3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestServerPort                         = "4567"
	TestServerJMXPort                      = "7199"
	JbossJMXPort                           = "9990"
	JbossJMXUsername                       = "admin1234"
	JbossJMXPassword                       = "Password1!"
	TestServerAddDataEndpoint              = "/cat"
	TestServerAddDataWithExceptionEndpoint = "/exceptional_cat"
	TestServerAddDataBatchEndpoint         = "/cat_batch"
	TestServerAddCompositeDataEndpoint     = "/composite_data_cat"
	TestServerCleanDataEndpoint            = "/clear"
	KeystorePassword                       = "password"
	TruststorePassword                     = "password"
	JmxUsername                            = "testuser"
	JmxPassword                            = "testpassword"
	DefaultTimeoutMs                       = 10000
)

Variables

View Source
var (
	PrjDir         string
	KeystorePath   string
	TruststorePath string
)

Functions

func AddMBeans

func AddMBeans(ctx context.Context, container testcontainers.Container, body map[string]interface{}) ([]byte, error)

AddMBeans will add new MBeans to the test-server.

func AddMBeansBatch

func AddMBeansBatch(ctx context.Context, container testcontainers.Container, body []map[string]interface{}) ([]byte, error)

AddMBeansBatch will add new MBeans to the test-server.

func AddMBeansWithException

func AddMBeansWithException(ctx context.Context, container testcontainers.Container, body map[string]interface{}) ([]byte, error)

AddMBeans will add new MBeans to the test-server.

func AddMCompositeDataBeans

func AddMCompositeDataBeans(ctx context.Context, container testcontainers.Container, body map[string]interface{}) ([]byte, error)

AddMBeans will add new MBeans to the test-server.

func CleanMBeans

func CleanMBeans(ctx context.Context, container testcontainers.Container) ([]byte, error)

CleanMBeans will remove all new added MBeans from test-server.

func CopyFileFromContainer

func CopyFileFromContainer(ctx context.Context, container testcontainers.Container, srcPath, dstPath string) error

CopyFileFromContainer will copy a file from a given docker container.

func DoHttpRequest

func DoHttpRequest(method, url string, body []byte) ([]byte, error)

DoHttpRequest will perform the http request.

func GetContainerMappedPort

func GetContainerMappedPort(ctx context.Context, container testcontainers.Container, targetPort nat.Port) (host string, port nat.Port, err error)

GetContainerMappedPort returns the hostname and the port for a given container.

func GetContainerServiceURL

func GetContainerServiceURL(ctx context.Context, container testcontainers.Container, port nat.Port, endpoint string) (string, error)

GetContainerServiceURL will return the url to the test-server running inside the container.

func NrJMXAsSubprocess

func NrJMXAsSubprocess(ctx context.Context, host, port string) *exec.Cmd

NrJMXAsSubprocess will return an exec.Cmd that will be configured to run the main function from testutils.

func RunJMXServiceContainer

func RunJMXServiceContainer(ctx context.Context) (testcontainers.Container, error)

RunJMXServiceContainer will start a container running test-server with JMX.

func RunJMXServiceContainerSSL

func RunJMXServiceContainerSSL(ctx context.Context) (testcontainers.Container, error)

RunJMXServiceContainerSSL will start a container running test-server configured with SSL JMX.

func RunJbossStandaloneJMXContainer

func RunJbossStandaloneJMXContainer(ctx context.Context) (testcontainers.Container, error)

RunJbossStandaloneJMXContainer will start a container running a jboss instace with JMX.

Types

type TestLogConsumer

type TestLogConsumer struct {
}

TestLogConsumer is used to print container logs to stdout.

func (*TestLogConsumer) Accept

func (g *TestLogConsumer) Accept(l testcontainers.Log)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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