test: cleanup mock consul service client

Updated to hclog.

It exposed fields that required an unexported lock to access. Created a
getter methodn instead. Only old allocrunner currently used this
feature.
This commit is contained in:
Michael Schurter 2018-09-13 17:27:14 -07:00
parent 6f92b04226
commit a977e22028
1 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,7 @@ func NewMockConsulOp(op, allocID, task string) MockConsulOp {
// MockConsulServiceClient implements the ConsulServiceAPI interface to record
// and log task registration/deregistration.
type MockConsulServiceClient struct {
Ops []MockConsulOp
ops []MockConsulOp
mu sync.Mutex
logger log.Logger
@ -85,3 +85,9 @@ func (m *MockConsulServiceClient) AllocRegistrations(allocID string) (*consul.Al
return nil, nil
}
func (m *MockConsulServiceClient) GetOps() []MockConsulOp {
m.mu.Lock()
defer m.mu.Unlock()
return m.ops
}