File: calls_test.go

package info (click to toggle)
golang-github-mesos-mesos-go 0.0.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 11,724 kB
  • sloc: makefile: 163
file content (67 lines) | stat: -rw-r--r-- 1,803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package calls_test

import (
	"context"
	"time"

	"github.com/mesos/mesos-go/api/v1/lib"
	"github.com/mesos/mesos-go/api/v1/lib/maintenance"
	"github.com/mesos/mesos-go/api/v1/lib/master"
	. "github.com/mesos/mesos-go/api/v1/lib/master/calls"
	"github.com/mesos/mesos-go/api/v1/lib/quota"
)

func Example() {
	var (
		check = func(err error) {
			if err != nil {
				panic(err)
			}
		}
		swallow = func(_ mesos.Response, err error) { check(err) }

		ctx       = context.Background()
		sender    = SenderFunc(func(_ context.Context, _ Request) (_ mesos.Response, _ error) { return })
		blackhole = func(c *master.Call) { swallow(sender.Send(ctx, NonStreaming(c))) }

		d = time.Duration(0)
	)
	blackhole(GetHealth())
	blackhole(GetFlags())
	blackhole(GetVersion())
	blackhole(GetMetrics(nil))
	blackhole(GetMetrics(&d))
	blackhole(GetLoggingLevel())
	blackhole(ListFiles(""))
	blackhole(ReadFile("", 0))
	blackhole(ReadFileWithLength("", 0, 0))
	blackhole(GetState())
	blackhole(GetAgents())
	blackhole(GetFrameworks())
	blackhole(GetExecutors())
	blackhole(GetTasks())
	blackhole(GetRoles())
	blackhole(GetWeights())
	blackhole(GetMaster())
	blackhole(GetMaintenanceStatus())
	blackhole(GetMaintenanceSchedule())
	blackhole(GetQuota())
	blackhole(Subscribe())

	blackhole = func(c *master.Call) {
		check(SendNoData(ctx, sender, NonStreaming(c)))
	}
	blackhole(SetLoggingLevel(0, 0))
	blackhole(UpdateWeights())
	blackhole(ReserveResources(mesos.AgentID{}))
	blackhole(UnreserveResources(mesos.AgentID{}))
	blackhole(CreateVolumes(mesos.AgentID{}))
	blackhole(DestroyVolumes(mesos.AgentID{}))
	blackhole(UpdateMaintenanceSchedule(maintenance.Schedule{}))
	blackhole(StartMaintenance())
	blackhole(StopMaintenance())
	blackhole(SetQuota(quota.QuotaRequest{}))
	blackhole(RemoveQuota(""))

	// Output:
}