11//
22// (C) Copyright 2021-2022 Intel Corporation.
3+ // (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34// (C) Copyright 2025 Google LLC
45//
56// SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -201,13 +202,13 @@ func TestDaos_ContainerProperty_RedunLevel(t *testing.T) {
201202 var expStr string
202203 switch inputKey {
203204 case "1" :
204- expStr = "rank (1) "
205+ expStr = "rank"
205206 case "2" :
206- expStr = "node (2) "
207+ expStr = "node"
207208 case "rank" :
208- expStr = "rank (1) "
209+ expStr = "rank"
209210 case "node" :
210- expStr = "node (2) "
211+ expStr = "node"
211212 default :
212213 t .Fatalf ("untested key %q" , inputKey )
213214 }
@@ -218,7 +219,7 @@ func TestDaos_ContainerProperty_RedunLevel(t *testing.T) {
218219 t .Run ("unexpected level" , func (t * testing.T ) {
219220 testProp := newTestContainerProperty (ContainerPropRedunLevel )
220221 testProp .SetValue (42 )
221- test .AssertEqual (t , "(42)" , testProp .StringValue (), "unexpected string value" )
222+ test .AssertEqual (t , fmt . Sprintf ( "property %q: invalid value 0x2a" , testProp . Name ) , testProp .StringValue (), "unexpected string value" )
222223 })
223224}
224225
@@ -233,15 +234,15 @@ func TestDaos_ContainerProperty_RedunFactor(t *testing.T) {
233234 var expStr string
234235 switch inputKey {
235236 case "0" :
236- expStr = "rd_fac0 "
237+ expStr = "0 "
237238 case "1" :
238- expStr = "rd_fac1 "
239+ expStr = "1 "
239240 case "2" :
240- expStr = "rd_fac2 "
241+ expStr = "2 "
241242 case "3" :
242- expStr = "rd_fac3 "
243+ expStr = "3 "
243244 case "4" :
244- expStr = "rd_fac4 "
245+ expStr = "4 "
245246 default :
246247 t .Fatalf ("untested key %q" , inputKey )
247248 }
@@ -323,19 +324,64 @@ func testReadOnlyContainerProperty(t *testing.T, propType ContainerPropType) {
323324 test .CmpErr (t , errors .Errorf ("property %q is read-only" , testProp .Name ), testProp .Set ("whoops" ))
324325}
325326
326- func TestDaos_ContainerProperty_Layout (t * testing.T ) {
327+ func TestDaos_ContainerProperty_LayoutValues (t * testing.T ) {
327328 testReadOnlyContainerProperty (t , ContainerPropLayoutType )
328329
329- t .Run ("valid layout" , func (t * testing.T ) {
330- testProp := newTestContainerProperty (ContainerPropLayoutType )
331- testProp .SetValue (uint64 (ContainerLayoutPOSIX ))
332- test .AssertEqual (t , testProp .StringValue (), fmt .Sprintf ("%s (%d)" , ContainerLayoutPOSIX , ContainerLayoutPOSIX ), "unexpected string value" )
333- })
334- t .Run ("unknown layout" , func (t * testing.T ) {
335- testProp := newTestContainerProperty (ContainerPropLayoutType )
336- testProp .SetValue (uint64 (ContainerLayoutUnknown ))
337- test .AssertEqual (t , testProp .StringValue (), "unknown (0)" , "unexpected string value" )
338- })
330+ for name , tc := range map [string ]struct {
331+ propVal uint64
332+ expStr string
333+ }{
334+ "Valid unknown layout" : {
335+ propVal : uint64 (ContainerLayoutUnknown ),
336+ expStr : "unknown" ,
337+ },
338+ "Valid POSIX layout" : {
339+ propVal : uint64 (ContainerLayoutPOSIX ),
340+ expStr : "POSIX" ,
341+ },
342+ "Valid HDF5 layout" : {
343+ propVal : uint64 (ContainerLayoutHDF5 ),
344+ expStr : "HDF5" ,
345+ },
346+ "Valid PYTHON layout" : {
347+ propVal : uint64 (ContainerLayoutPython ),
348+ expStr : "PYTHON" ,
349+ },
350+ "Valid SPARK layout" : {
351+ propVal : uint64 (ContainerLayoutSpark ),
352+ expStr : "SPARK" ,
353+ },
354+ "Valid DATABASE layout" : {
355+ propVal : uint64 (ContainerLayoutDatabase ),
356+ expStr : "DATABASE" ,
357+ },
358+ "Valid ROOT layout" : {
359+ propVal : uint64 (ContainerLayoutRoot ),
360+ expStr : "ROOT" ,
361+ },
362+ "Valid SEISMIC layout" : {
363+ propVal : uint64 (ContainerLayoutSeismic ),
364+ expStr : "SEISMIC" ,
365+ },
366+ "Valid METEO layout" : {
367+ propVal : uint64 (ContainerLayoutMeteo ),
368+ expStr : "METEO" ,
369+ },
370+ } {
371+ t .Run (name , func (t * testing.T ) {
372+ testProp := newTestContainerProperty (ContainerPropLayoutType )
373+ testProp .SetValue (tc .propVal )
374+
375+ test .AssertEqual (t , tc .expStr , testProp .StringValue (), "unexpected string value" )
376+ })
377+ }
378+ }
379+
380+ func TestDaos_ContainerProperty_LayoutDescription (t * testing.T ) {
381+ testReadOnlyContainerProperty (t , ContainerPropLayoutType )
382+
383+ testProp := newTestContainerProperty (ContainerPropLayoutType )
384+ test .AssertEqual (t , testProp .Description , "Layout Type (unknown, POSIX, HDF5, PYTHON, SPARK, DATABASE, ROOT, SEISMIC, METEO)" , "unexpected description" )
339385}
340386
341387func TestDaos_ContainerProperty_ACL (t * testing.T ) {
0 commit comments