forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing.go
42 lines (34 loc) · 794 Bytes
/
testing.go
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/messenger"
"github.com/mesos/mesos-go/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)
})
}