Merge pull request #2893 from brendandburns/pd3

Make it easier to update nodes, make it possible to update capacity.
This commit is contained in:
Brendan Burns
2014-12-18 10:18:54 -08:00
4 changed files with 79 additions and 1 deletions

View File

@@ -1178,6 +1178,64 @@ func TestValidateMinionUpdate(t *testing.T) {
Labels: map[string]string{"foo": "baz"},
},
}, true},
{api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(10000),
"memory": util.NewIntOrStringFromInt(100),
},
},
}, api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(100),
"memory": util.NewIntOrStringFromInt(10000),
},
},
}, true},
{api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "foo"},
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(10000),
"memory": util.NewIntOrStringFromInt(100),
},
},
}, api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "fooobaz"},
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(100),
"memory": util.NewIntOrStringFromInt(10000),
},
},
}, true},
{api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "foo"},
},
}, api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "fooobaz"},
},
Status: api.NodeStatus{
HostIP: "1.2.3.4",
},
}, false},
}
for _, test := range tests {
errs := ValidateMinionUpdate(&test.oldMinion, &test.minion)