File: testing.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 (42 lines) | stat: -rw-r--r-- 808 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
package executor

import (
	"github.com/gogo/protobuf/proto"
	"github.com/mesos/mesos-go/api/v0/messenger"
	"github.com/mesos/mesos-go/api/v0/upid"
	"golang.org/x/net/context"
)

type TestDriver struct {
	*MesosExecutorDriver
}

func (e *TestDriver) SetConnected(b bool) {
	e.guarded(func() {
		e.connected = b
	})
}

func (e *TestDriver) SetMessenger(m messenger.Messenger) {
	e.messenger = m
}

func (e *TestDriver) Started() <-chan struct{} {
	return e.started
}

func (e *TestDriver) guarded(f func()) {
	e.lock.Lock()
	defer e.lock.Unlock()
	f()
}

func (e *TestDriver) Context() context.Context {
	return e.context()
}

func (e *TestDriver) StatusUpdateAcknowledgement(ctx context.Context, from *upid.UPID, msg proto.Message) {
	e.guarded(func() {
		e.statusUpdateAcknowledgement(ctx, from, msg)
	})
}