Internal rename api.Minion -> api.Node

This commit is contained in:
Clayton Coleman
2014-12-07 22:44:27 -05:00
parent 650aead4c4
commit 19379b5a38
38 changed files with 212 additions and 213 deletions

View File

@@ -28,28 +28,28 @@ import (
func TestMinionREST(t *testing.T) {
ms := NewREST(registrytest.NewMinionRegistry([]string{"foo", "bar"}, api.NodeResources{}))
ctx := api.NewContext()
if obj, err := ms.Get(ctx, "foo"); err != nil || obj.(*api.Minion).Name != "foo" {
if obj, err := ms.Get(ctx, "foo"); err != nil || obj.(*api.Node).Name != "foo" {
t.Errorf("missing expected object")
}
if obj, err := ms.Get(ctx, "bar"); err != nil || obj.(*api.Minion).Name != "bar" {
if obj, err := ms.Get(ctx, "bar"); err != nil || obj.(*api.Node).Name != "bar" {
t.Errorf("missing expected object")
}
if _, err := ms.Get(ctx, "baz"); err != ErrDoesNotExist {
t.Errorf("has unexpected object")
}
c, err := ms.Create(ctx, &api.Minion{ObjectMeta: api.ObjectMeta{Name: "baz"}})
c, err := ms.Create(ctx, &api.Node{ObjectMeta: api.ObjectMeta{Name: "baz"}})
if err != nil {
t.Errorf("insert failed")
}
obj := <-c
if !api.HasObjectMetaSystemFieldValues(&obj.Object.(*api.Minion).ObjectMeta) {
if !api.HasObjectMetaSystemFieldValues(&obj.Object.(*api.Node).ObjectMeta) {
t.Errorf("storage did not populate object meta field values")
}
if m, ok := obj.Object.(*api.Minion); !ok || m.Name != "baz" {
if m, ok := obj.Object.(*api.Node); !ok || m.Name != "baz" {
t.Errorf("insert return value was weird: %#v", obj)
}
if obj, err := ms.Get(ctx, "baz"); err != nil || obj.(*api.Minion).Name != "baz" {
if obj, err := ms.Get(ctx, "baz"); err != nil || obj.(*api.Node).Name != "baz" {
t.Errorf("insert didn't actually insert")
}
@@ -74,14 +74,14 @@ func TestMinionREST(t *testing.T) {
if err != nil {
t.Errorf("got error calling List")
}
expect := []api.Minion{
expect := []api.Node{
{
ObjectMeta: api.ObjectMeta{Name: "foo"},
}, {
ObjectMeta: api.ObjectMeta{Name: "baz"},
},
}
nodeList := list.(*api.MinionList)
nodeList := list.(*api.NodeList)
if len(expect) != len(nodeList.Items) || !contains(nodeList, "foo") || !contains(nodeList, "baz") {
t.Errorf("Unexpected list value: %#v", list)
}
@@ -97,12 +97,12 @@ func TestMinionStorageWithHealthCheck(t *testing.T) {
ms := NewREST(&minionHealthRegistry)
ctx := api.NewContext()
c, err := ms.Create(ctx, &api.Minion{ObjectMeta: api.ObjectMeta{Name: "m1"}})
c, err := ms.Create(ctx, &api.Node{ObjectMeta: api.ObjectMeta{Name: "m1"}})
if err != nil {
t.Errorf("insert failed")
}
result := <-c
if m, ok := result.Object.(*api.Minion); !ok || m.Name != "m1" {
if m, ok := result.Object.(*api.Node); !ok || m.Name != "m1" {
t.Errorf("insert return value was weird: %#v", result)
}
if _, err := ms.Get(ctx, "m1"); err == nil {
@@ -110,7 +110,7 @@ func TestMinionStorageWithHealthCheck(t *testing.T) {
}
}
func contains(nodes *api.MinionList, nodeID string) bool {
func contains(nodes *api.NodeList, nodeID string) bool {
for _, node := range nodes.Items {
if node.Name == nodeID {
return true
@@ -126,7 +126,7 @@ func TestMinionStorageInvalidUpdate(t *testing.T) {
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
minion, ok := obj.(*api.Minion)
minion, ok := obj.(*api.Node)
if !ok {
t.Fatalf("Object is not a minion: %#v", obj)
}
@@ -143,7 +143,7 @@ func TestMinionStorageValidUpdate(t *testing.T) {
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
minion, ok := obj.(*api.Minion)
minion, ok := obj.(*api.Node)
if !ok {
t.Fatalf("Object is not a minion: %#v", obj)
}
@@ -161,7 +161,7 @@ func TestMinionStorageValidatesCreate(t *testing.T) {
ctx := api.NewContext()
validSelector := map[string]string{"a": "b"}
invalidSelector := map[string]string{"NoUppercaseOrSpecialCharsLike=Equals": "b"}
failureCases := map[string]api.Minion{
failureCases := map[string]api.Node{
"zero-length Name": {
ObjectMeta: api.ObjectMeta{
Name: "",