mock

package module
v0.0.0-...-2900efd Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

mock-mesos-server

A golang test utility for mocking Mesos server requests.

It allows you to mock requests against the mesos operator API using a real HTTP server in protobuf binary format.

Usage

Copy (or better still, drop) mock_mesos_server.go and cmd/gen.go into your project, create fixtures as described below, and run go generate.

Note you will need mesos-go on your GOPATH.

Test Fixtures

Each subdirectory in the testdata directory contains fixtures for a test case. For example, the 'empty' subdirectory contains a response which the Mesos agent operator API would yield if no tasks were running on the agent.

As the Mesos operator API communicates via protobuf, and the binary protobuf format is not human-readable nor human- editable, each file is in JSON format. Running go generate from the root of the directory will compile these JSON files to protobuf binary, which is then stored in a .bin file alongside the original.

If you make changes to a JSON file you should run go generate and be sure to commit both the changed JSON file and the generated protobuf binary file.

Adding a test case is as simple as creating a new directory with appropriately named JSON files and running go generate.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GET_CONTAINERS = []byte{8, 10}
	GET_STATE      = []byte{8, 9}
	GET_TASKS      = []byte{8, 13}
)

raw protobuf request types: ref https://github.com/apache/mesos/blob/master/include/mesos/v1/agent/agent.proto

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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