| 1 |
package calls_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"context" |
| 5 |
"time" |
| 6 |
|
| 7 |
"github.com/mesos/mesos-go/api/v1/lib" |
| 8 |
"github.com/mesos/mesos-go/api/v1/lib/agent" |
| 9 |
. "github.com/mesos/mesos-go/api/v1/lib/agent/calls" |
| 10 |
) |
| 11 |
|
| 12 |
func Example() { |
| 13 |
var ( |
| 14 |
check = func(err error) { |
| 15 |
if err != nil { |
| 16 |
panic(err) |
| 17 |
} |
| 18 |
} |
| 19 |
swallow = func(_ mesos.Response, err error) { check(err) } |
| 20 |
|
| 21 |
ctx = context.Background() |
| 22 |
sender = SenderFunc(func(_ context.Context, _ Request) (_ mesos.Response, _ error) { return }) |
| 23 |
blackhole = func(calls ...*agent.Call) { |
| 24 |
for i := range calls { |
| 25 |
swallow(sender.Send(ctx, NonStreaming(calls[i]))) |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
d = time.Duration(0) |
| 30 |
) |
| 31 |
blackhole( |
| 32 |
GetHealth(), |
| 33 |
GetFlags(), |
| 34 |
GetVersion(), |
| 35 |
GetMetrics(nil), |
| 36 |
GetMetrics(&d), |
| 37 |
GetLoggingLevel(), |
| 38 |
ListFiles(""), |
| 39 |
ReadFile("", 0), |
| 40 |
ReadFileWithLength("", 0, 0), |
| 41 |
GetState(), |
| 42 |
GetContainers(), |
| 43 |
GetFrameworks(), |
| 44 |
GetExecutors(), |
| 45 |
GetTasks(), |
| 46 |
GetAgent(), |
| 47 |
WaitNestedContainer(mesos.ContainerID{}), |
| 48 |
LaunchNestedContainerSession(mesos.ContainerID{}, nil, nil), |
| 49 |
) |
| 50 |
|
| 51 |
blackhole = func(calls ...*agent.Call) { |
| 52 |
for i := range calls { |
| 53 |
check(SendNoData(ctx, sender, NonStreaming(calls[i]))) |
| 54 |
} |
| 55 |
} |
| 56 |
blackhole( |
| 57 |
SetLoggingLevel(0, d), |
| 58 |
LaunchNestedContainer(mesos.ContainerID{}, nil, nil), |
| 59 |
KillNestedContainer(mesos.ContainerID{}), |
| 60 |
RemoveNestedContainer(mesos.ContainerID{}), |
| 61 |
AttachContainerOutput(mesos.ContainerID{}), |
| 62 |
) |
| 63 |
|
| 64 |
swallow(sender.Send(ctx, Empty().Push( |
| 65 |
AttachContainerInput(mesos.ContainerID{}), |
| 66 |
AttachContainerInputTTY(nil), |
| 67 |
AttachContainerInputData(nil), |
| 68 |
))) |
| 69 |
|
| 70 |
|
| 71 |
} |