tstutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupTestServerClient

func SetupTestServerClient(testingObj *testing.T, handlers *[]Handler) (*ibmc.ClientSession, *httptest.Server, error)

SetupTestServerClient sets up a unit test http server, and creates a client to be used in unit testing.

Params

testingObj - the test object
handlers - the handlers that create the responses

Returns

  • a configured "provider" client (ready to talk to the IBM cloud). nil of there is a problem
  • the (started) test http server, on which the caller should call 'defer ....Close()' (reason for this is we need to keep it around to prevent garbage collection)
  • an error (if there is one)

Types

type Args

type Args struct {
	Managed resource.Managed
}

Args is used in testing, to hold the arguments passed to the crossplane functions

type Handler

type Handler struct {
	// http path to handle a request
	Path string

	// Function that will deal with the request, and write the response in the writer.
	HandlerFunc func(w http.ResponseWriter, r *http.Request)
}

Handler is used in unit testing

Jump to

Keyboard shortcuts

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