Skip to content

Commit c22b874

Browse files
author
Alistair McLean
committed
Unsetting trustzone for spec version < 1.5
Signed-off-by: Alistair McLean <alistair.mclean@netrise.io>
1 parent 7af49c7 commit c22b874

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

convert.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ func serviceConverter(specVersion SpecVersion) func(*Service) {
461461
s.ReleaseNotes = nil
462462
}
463463

464+
if specVersion < SpecVersion1_5 {
465+
s.TrustZone = ""
466+
}
467+
464468
convertOrganizationalEntity(s.Provider, specVersion)
465469
convertExternalReferences(s.ExternalReferences, specVersion)
466470
}

convert_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,33 @@ func Test_convertAuthors(t *testing.T) {
245245
assert.Nil(t, (*bom.Components)[0].Authors)
246246
})
247247
}
248+
249+
func Test_convertTrustZone(t *testing.T) {
250+
t.Run("spec 1.4 and lower", func(t *testing.T) {
251+
bom := NewBOM()
252+
bom.Services = &[]Service{
253+
{
254+
Name: "Payment API",
255+
TrustZone: "trusted",
256+
},
257+
}
258+
259+
bom.convert(SpecVersion1_4)
260+
261+
assert.Empty(t, (*bom.Services)[0].TrustZone)
262+
})
263+
264+
t.Run("spec 1.5 and higher", func(t *testing.T) {
265+
bom := NewBOM()
266+
bom.Services = &[]Service{
267+
{
268+
Name: "Payment API",
269+
TrustZone: "trusted",
270+
},
271+
}
272+
273+
bom.convert(SpecVersion1_5)
274+
275+
assert.Equal(t, "trusted", (*bom.Services)[0].TrustZone)
276+
})
277+
}

0 commit comments

Comments
 (0)