mirror of
https://github.com/moby/moby.git
synced 2026-08-10 17:15:06 +00:00
daemon/events: remove tests for deprecated API fields
These fields were deprecated in [moby@72f188] (docker v1.10, API v1.22),
and we shouldn't test for them.
[moby@72f188]: 72f1881df1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -12,19 +12,6 @@ import (
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
// validateLegacyFields validates that the legacy "Status", "ID", and "From"
|
||||
// fields are set to the same value as their "current" (non-legacy) fields.
|
||||
//
|
||||
// These fields were deprecated since v1.10 (https://github.com/moby/moby/pull/18888).
|
||||
//
|
||||
// TODO remove this once we removed the deprecated `ID`, `Status`, and `From` fields.
|
||||
func validateLegacyFields(t *testing.T, msg events.Message) {
|
||||
t.Helper()
|
||||
assert.Check(t, is.Equal(msg.Status, string(msg.Action)), "Legacy Status field does not match Action") //nolint:staticcheck // ignore SA1019: field is deprecated but set for backward compatibility.
|
||||
assert.Check(t, is.Equal(msg.ID, msg.Actor.ID), "Legacy ID field does not match Actor.ID") //nolint:staticcheck // ignore SA1019: field is deprecated but set for backward compatibility.
|
||||
assert.Check(t, is.Equal(msg.From, msg.Actor.Attributes["image"]), "Legacy From field does not match Actor.Attributes.image") //nolint:staticcheck // ignore SA1019: field is deprecated but set for backward compatibility.
|
||||
}
|
||||
|
||||
func TestEventsLog(t *testing.T) {
|
||||
e := New()
|
||||
_, l1, _ := e.Subscribe()
|
||||
@@ -44,7 +31,6 @@ func TestEventsLog(t *testing.T) {
|
||||
|
||||
jmsg, ok := msg.(events.Message)
|
||||
assert.Assert(t, ok, "unexpected type: %T", msg)
|
||||
validateLegacyFields(t, jmsg)
|
||||
assert.Check(t, is.Equal(jmsg.Action, events.Action("test")))
|
||||
assert.Check(t, is.Equal(jmsg.Actor.ID, "cont"))
|
||||
assert.Check(t, is.Equal(jmsg.Actor.Attributes["image"], "image"))
|
||||
@@ -57,7 +43,6 @@ func TestEventsLog(t *testing.T) {
|
||||
|
||||
jmsg, ok := msg.(events.Message)
|
||||
assert.Assert(t, ok, "unexpected type: %T", msg)
|
||||
validateLegacyFields(t, jmsg)
|
||||
assert.Check(t, is.Equal(jmsg.Action, events.Action("test")))
|
||||
assert.Check(t, is.Equal(jmsg.Actor.ID, "cont"))
|
||||
assert.Check(t, is.Equal(jmsg.Actor.Attributes["image"], "image"))
|
||||
@@ -120,7 +105,6 @@ func TestLogEvents(t *testing.T) {
|
||||
assert.Assert(t, is.Len(current, eventsLimit))
|
||||
|
||||
first := current[0]
|
||||
validateLegacyFields(t, first)
|
||||
assert.Check(t, is.Equal(first.Action, events.Action("action_16")))
|
||||
|
||||
last := current[len(current)-1]
|
||||
|
||||
Reference in New Issue
Block a user