Documentation ¶
Index ¶
- Variables
- func Debug(t *testing.T, driverName string, config []byte, tests ...APITestFunc)
- func DebugGroup(t *testing.T, driverName string, config []byte, tests ...APITestFunc)
- func LogAsJSON(i interface{}, t *testing.T)
- func Run(t *testing.T, driverName string, config []byte, tests ...APITestFunc)
- func RunGroup(t *testing.T, driverName string, config []byte, tests ...APITestFunc)
- func RunGroupWithClientType(t *testing.T, clientType types.ClientType, driverName string, config []byte, ...)
- func RunWithClientType(t *testing.T, clientType types.ClientType, driverName string, config []byte, ...)
- type APITestFunc
- type InstanceIDTest
- type InstanceTest
- type LocalDevicesTest
- type NextDeviceTest
Constants ¶
This section is empty.
Variables ¶
var TestExecutors = func( config gofig.Config, client types.Client, t *testing.T) { reply, err := client.API().Executors(nil) if err != nil { t.Fatal(err) } assertLSXLinux(t, reply["lsx-linux"]) }
TestExecutors tests the GET /executors route.
var TestExecutorsWithControllerClient = func( config gofig.Config, client types.Client, t *testing.T) { _, err := client.API().Executors(nil) assert.Error(t, err) assert.Equal(t, "unsupported op for client type", err.Error()) }
TestExecutorsWithControllerClient tests the GET /executors route using a controller client.
var TestGetExecutorLinux = func( config gofig.Config, client types.Client, t *testing.T) { reply, err := client.API().ExecutorGet(nil, "lsx-linux") if err != nil { t.Fatal(err) } defer reply.Close() buf, err := ioutil.ReadAll(reply) if err != nil { t.Fatal(err) } assert.EqualValues(t, lsxLinuxInfo.Size, len(buf)) }
TestGetExecutorLinux tests the GET /executors/lsx-linux route.
var TestHeadExecutorLinux = func( config gofig.Config, client types.Client, t *testing.T) { reply, err := client.API().ExecutorHead(nil, "lsx-linux") if err != nil { t.Fatal(err) } assertLSXLinux(t, reply) }
TestHeadExecutorLinux tests the HEAD /executors/lsx-linux route.
var TestRoot = func(config gofig.Config, client types.Client, t *testing.T) { reply, err := client.API().Root(nil) if err != nil { t.Fatal(err) } assert.Equal(t, len(reply), 6) }
TestRoot tests the GET / route.
Functions ¶
func Debug ¶
func Debug( t *testing.T, driverName string, config []byte, tests ...APITestFunc)
Debug is the same as Run except with additional logging.
func DebugGroup ¶
func DebugGroup( t *testing.T, driverName string, config []byte, tests ...APITestFunc)
DebugGroup is the same as RunGroup except with additional logging.
func Run ¶
func Run( t *testing.T, driverName string, config []byte, tests ...APITestFunc)
Run executes the provided tests in a new test harness. Each test is executed against a new server instance.
func RunGroup ¶
func RunGroup( t *testing.T, driverName string, config []byte, tests ...APITestFunc)
RunGroup executes the provided tests in a new test harness. All tests are executed against the same server instance.
func RunGroupWithClientType ¶ added in v0.1.1
func RunGroupWithClientType( t *testing.T, clientType types.ClientType, driverName string, config []byte, tests ...APITestFunc)
RunGroupWithClientType executes the provided tests in a new test harness with the specified client type. All tests are executed against the same server instance.
func RunWithClientType ¶ added in v0.1.1
func RunWithClientType( t *testing.T, clientType types.ClientType, driverName string, config []byte, tests ...APITestFunc)
RunWithClientType executes the provided tests in a new test harness with the specified client type. Each test is executed against a new server instance.
Types ¶
type APITestFunc ¶
APITestFunc is a function that wraps a block of test logic for testing the API. An APITestFunc is executed four times:
1 - tcp 2 - tcp+tls 3 - sock 4 - sock+tls
type InstanceIDTest ¶
type InstanceIDTest struct { // Driver is the name of the driver/executor for which to get the instance // ID. Driver string // Expected is the expected instance ID value. Expected *types.InstanceID }
InstanceIDTest is the test harness for testing the instance ID.
type InstanceTest ¶
type InstanceTest struct { // Driver is the name of the driver/executor for which to inspect the // instance. Driver string // Expected is the expected instance. Expected *types.Instance }
InstanceTest is the test harness for testing instance inspection.
type LocalDevicesTest ¶
type LocalDevicesTest struct { // Driver is the name of the driver/executor for which to get the local // devices. Driver string // Expected is the expected local devices. Expected *types.LocalDevices }
LocalDevicesTest is the test harness for testing getting the local devices.
type NextDeviceTest ¶
type NextDeviceTest struct { // Driver is the name of the driver/executor for which to get the next // device. Driver string // Expected is the expected next device. Expected string }
NextDeviceTest is the test harness for testing getting the next device.