mirror of https://github.com/docker/docs.git
add test and remove unused funcs
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
d1d8bd5356
commit
c6815ee1fe
|
|
@ -239,11 +239,6 @@ func (n *Node) ReservedMemory() int64 {
|
|||
return r
|
||||
}
|
||||
|
||||
// Return the memory availalble on this node.
|
||||
func (n *Node) AvailableMemory() int64 {
|
||||
return n.Memory - n.ReservedMemory()
|
||||
}
|
||||
|
||||
// Return the sum of CPUs reserved by containers.
|
||||
func (n *Node) ReservedCpus() int64 {
|
||||
var r int64 = 0
|
||||
|
|
@ -255,10 +250,6 @@ func (n *Node) ReservedCpus() int64 {
|
|||
return r
|
||||
}
|
||||
|
||||
func (n *Node) AvailalbleCpus() int64 {
|
||||
return n.Cpus - n.ReservedCpus()
|
||||
}
|
||||
|
||||
func (n *Node) Create(config *dockerclient.ContainerConfig, name string, pullImage bool) (*Container, error) {
|
||||
var (
|
||||
err error
|
||||
|
|
|
|||
|
|
@ -50,6 +50,25 @@ func TestOutdatedNode(t *testing.T) {
|
|||
client.Mock.AssertExpectations(t)
|
||||
}
|
||||
|
||||
func TestNodeCpusMemory(t *testing.T) {
|
||||
node := NewNode("test")
|
||||
assert.False(t, node.IsConnected())
|
||||
|
||||
client := dockerclient.NewMockClient()
|
||||
client.On("Info").Return(mockInfo, nil)
|
||||
client.On("ListContainers", true, false, "").Return([]dockerclient.Container{}, nil)
|
||||
client.On("StartMonitorEvents", mock.Anything, mock.Anything).Return()
|
||||
|
||||
assert.NoError(t, node.connectClient(client))
|
||||
assert.True(t, node.IsConnected())
|
||||
assert.True(t, node.IsHealthy())
|
||||
|
||||
assert.Equal(t, node.ReservedCpus(), 0)
|
||||
assert.Equal(t, node.ReservedMemory(), 0)
|
||||
|
||||
client.Mock.AssertExpectations(t)
|
||||
}
|
||||
|
||||
func TestNodeSpecs(t *testing.T) {
|
||||
node := NewNode("test")
|
||||
assert.False(t, node.IsConnected())
|
||||
|
|
|
|||
Loading…
Reference in New Issue