From 2711c5f70258632ffd983c6bb757170831a921c6 Mon Sep 17 00:00:00 2001 From: George Blue Date: Tue, 27 Aug 2019 11:38:49 +0100 Subject: [PATCH] MaintenanceInfo Description should be ignored in comparison The Open Service Broker spec says that only the Version should be used when comparing MaintenanceInfo. https://github.com/openservicebrokerapi/servicebroker/pull/665 We retain the off-spec comparisons of Public and Private, but should follow the spec for Version and Description [#167808805] --- domain/maintenance_info.go | 4 +++- domain/maintenance_info_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/domain/maintenance_info.go b/domain/maintenance_info.go index ac7bc332..8399b51c 100644 --- a/domain/maintenance_info.go +++ b/domain/maintenance_info.go @@ -10,5 +10,7 @@ type MaintenanceInfo struct { } func (m *MaintenanceInfo) Equals(input MaintenanceInfo) bool { - return reflect.DeepEqual(*m, input) + return m.Version == input.Version && + m.Private == input.Private && + reflect.DeepEqual(m.Public, input.Public) } diff --git a/domain/maintenance_info_test.go b/domain/maintenance_info_test.go index 00127cc1..b55d47bf 100644 --- a/domain/maintenance_info_test.go +++ b/domain/maintenance_info_test.go @@ -50,10 +50,6 @@ var _ = Describe("MaintenanceInfo", func() { domain.MaintenanceInfo{Version: "1.2.0"}, domain.MaintenanceInfo{Version: "2.2.2"}, ), - Entry("description field is different", - domain.MaintenanceInfo{Description: "amazing"}, - domain.MaintenanceInfo{Description: "terrible"}, - ), Entry( "all properties are missing in one of the objects", domain.MaintenanceInfo{ @@ -92,6 +88,10 @@ var _ = Describe("MaintenanceInfo", func() { "both struct's are nil", nil, nil), + Entry("description field is different", + domain.MaintenanceInfo{Description: "amazing"}, + domain.MaintenanceInfo{Description: "terrible"}, + ), ) }) })