Rename Event.Status to Event.Condition to match v1beta3 agreement

Question - should this be a phase?  Seems like no, since phase implies
defined lifecycle and this field is explicitly not defined.
This commit is contained in:
Clayton Coleman
2014-12-12 16:27:25 -05:00
parent 61e8baeef9
commit 88715cc6ef
14 changed files with 133 additions and 60 deletions

View File

@@ -106,7 +106,8 @@ func (rs *REST) getAttrs(obj runtime.Object) (objLabels, objFields labels.Set, e
"involvedObject.apiVersion": event.InvolvedObject.APIVersion,
"involvedObject.resourceVersion": fmt.Sprintf("%s", event.InvolvedObject.ResourceVersion),
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
"status": event.Status,
"condition": event.Condition,
"status": event.Condition, // TODO: remove me when we version fields
"reason": event.Reason,
"source": event.Source,
}, nil

View File

@@ -143,9 +143,9 @@ func TestRESTgetAttrs(t *testing.T) {
ResourceVersion: "0",
FieldPath: "",
},
Status: "tested",
Reason: "forTesting",
Source: "test",
Condition: "Tested",
Reason: "ForTesting",
Source: "test",
}
label, field, err := rest.getAttrs(eventA)
if err != nil {
@@ -162,8 +162,9 @@ func TestRESTgetAttrs(t *testing.T) {
"involvedObject.apiVersion": testapi.Version(),
"involvedObject.resourceVersion": "0",
"involvedObject.fieldPath": "",
"status": "tested",
"reason": "forTesting",
"condition": "Tested",
"status": "Tested",
"reason": "ForTesting",
"source": "test",
}
if e, a := expect, field; !reflect.DeepEqual(e, a) {
@@ -196,8 +197,8 @@ func TestRESTList(t *testing.T) {
ResourceVersion: "0",
FieldPath: "",
},
Status: "tested",
Reason: "forTesting",
Condition: "Tested",
Reason: "ForTesting",
}
eventB := &api.Event{
InvolvedObject: api.ObjectReference{
@@ -208,8 +209,8 @@ func TestRESTList(t *testing.T) {
ResourceVersion: "0",
FieldPath: "",
},
Status: "tested",
Reason: "forTesting",
Condition: "Tested",
Reason: "ForTesting",
}
eventC := &api.Event{
InvolvedObject: api.ObjectReference{
@@ -220,13 +221,13 @@ func TestRESTList(t *testing.T) {
ResourceVersion: "0",
FieldPath: "",
},
Status: "untested",
Reason: "forTesting",
Condition: "Untested",
Reason: "ForTesting",
}
reg.ObjectList = &api.EventList{
Items: []api.Event{*eventA, *eventB, *eventC},
}
got, err := rest.List(api.NewContext(), labels.Everything(), labels.Set{"status": "tested"}.AsSelector())
got, err := rest.List(api.NewContext(), labels.Everything(), labels.Set{"status": "Tested"}.AsSelector())
if err != nil {
t.Fatalf("Unexpected error %v", err)
}
@@ -248,8 +249,8 @@ func TestRESTWatch(t *testing.T) {
ResourceVersion: "0",
FieldPath: "",
},
Status: "tested",
Reason: "forTesting",
Condition: "Tested",
Reason: "ForTesting",
}
reg, rest := NewTestREST()
wi, err := rest.Watch(api.NewContext(), labels.Everything(), labels.Everything(), "0")