Fix events test

k3s-v1.14.6
wojtekt 2019-08-14 08:21:22 +02:00
parent 6c69654047
commit 15d1365cfe
1 changed files with 31 additions and 31 deletions

View File

@ -153,7 +153,7 @@ func TestEventf(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[2]",
},
Reason: "Started",
@ -162,7 +162,7 @@ func TestEventf(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: false,
},
{
@ -181,7 +181,7 @@ func TestEventf(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
},
Reason: "Killed",
Message: "some other verbose message: 1",
@ -189,7 +189,7 @@ func TestEventf(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,
expectUpdate: false,
},
{
@ -208,7 +208,7 @@ func TestEventf(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[2]",
},
Reason: "Started",
@ -217,7 +217,7 @@ func TestEventf(t *testing.T) {
Count: 2,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: true,
},
{
@ -236,7 +236,7 @@ func TestEventf(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "differentUid",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[3]",
},
Reason: "Started",
@ -245,7 +245,7 @@ func TestEventf(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: false,
},
{
@ -264,7 +264,7 @@ func TestEventf(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[2]",
},
Reason: "Started",
@ -273,7 +273,7 @@ func TestEventf(t *testing.T) {
Count: 3,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: true,
},
{
@ -292,7 +292,7 @@ func TestEventf(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "differentUid",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[3]",
},
Reason: "Stopped",
@ -301,7 +301,7 @@ func TestEventf(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectUpdate: false,
},
{
@ -320,7 +320,7 @@ func TestEventf(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "differentUid",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[3]",
},
Reason: "Stopped",
@ -329,7 +329,7 @@ func TestEventf(t *testing.T) {
Count: 2,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectUpdate: true,
},
}
@ -509,7 +509,7 @@ func TestLotsOfEvents(t *testing.T) {
Name: fmt.Sprintf("foo-%v", i),
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
}
// we need to vary the reason to prevent aggregation
go recorder.Eventf(ref, v1.EventTypeNormal, "Reason-"+string(i), strconv.Itoa(i))
@ -567,7 +567,7 @@ func TestEventfNoNamespace(t *testing.T) {
Name: "foo",
Namespace: "",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[2]",
},
Reason: "Started",
@ -576,7 +576,7 @@ func TestEventfNoNamespace(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: false,
},
}
@ -677,7 +677,7 @@ func TestMultiSinkCache(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[2]",
},
Reason: "Started",
@ -686,7 +686,7 @@ func TestMultiSinkCache(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: false,
},
{
@ -705,7 +705,7 @@ func TestMultiSinkCache(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
},
Reason: "Killed",
Message: "some other verbose message: 1",
@ -713,7 +713,7 @@ func TestMultiSinkCache(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 1`,
expectUpdate: false,
},
{
@ -732,7 +732,7 @@ func TestMultiSinkCache(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[2]",
},
Reason: "Started",
@ -741,7 +741,7 @@ func TestMultiSinkCache(t *testing.T) {
Count: 2,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: true,
},
{
@ -760,7 +760,7 @@ func TestMultiSinkCache(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "differentUid",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[3]",
},
Reason: "Started",
@ -769,7 +769,7 @@ func TestMultiSinkCache(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: false,
},
{
@ -788,7 +788,7 @@ func TestMultiSinkCache(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "bar",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[2]",
},
Reason: "Started",
@ -797,7 +797,7 @@ func TestMultiSinkCache(t *testing.T) {
Count: 3,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[2]"}): type: 'Normal' reason: 'Started' some verbose message: 1`,
expectUpdate: true,
},
{
@ -816,7 +816,7 @@ func TestMultiSinkCache(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "differentUid",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[3]",
},
Reason: "Stopped",
@ -825,7 +825,7 @@ func TestMultiSinkCache(t *testing.T) {
Count: 1,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectUpdate: false,
},
{
@ -844,7 +844,7 @@ func TestMultiSinkCache(t *testing.T) {
Name: "foo",
Namespace: "baz",
UID: "differentUid",
APIVersion: "version",
APIVersion: "v1",
FieldPath: "spec.containers[3]",
},
Reason: "Stopped",
@ -853,7 +853,7 @@ func TestMultiSinkCache(t *testing.T) {
Count: 2,
Type: v1.EventTypeNormal,
},
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectLog: `Event(v1.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"v1", ResourceVersion:"", FieldPath:"spec.containers[3]"}): type: 'Normal' reason: 'Stopped' some verbose message: 1`,
expectUpdate: true,
},
}