@@ -92,53 +92,53 @@ target_file_size=2097152`
9292 {"path=/mnt/hda1,attrs=hdd,attrs=ssd" , "attrs field was used twice in store definition" , StoreSpec {}},
9393
9494 // size
95- {"path=/mnt/hda1,size=671088640" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Bytes : 671088640 } }},
96- {"path=/mnt/hda1,size=20GB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Bytes : 20000000000 } }},
97- {"size=20GiB,path=/mnt/hda1" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Bytes : 21474836480 } }},
98- {"size=0.1TiB,path=/mnt/hda1" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Bytes : 109951162777 } }},
99- {"path=/mnt/hda1,size=.1TiB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Bytes : 109951162777 } }},
100- {"path=/mnt/hda1,size=123TB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Bytes : 123000000000000 } }},
101- {"path=/mnt/hda1,size=123TiB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Bytes : 135239930216448 } }},
95+ {"path=/mnt/hda1,size=671088640" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . BytesSize ( 671088640 ) }},
96+ {"path=/mnt/hda1,size=20GB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . BytesSize ( 20000000000 ) }},
97+ {"size=20GiB,path=/mnt/hda1" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . BytesSize ( 21474836480 ) }},
98+ {"size=0.1TiB,path=/mnt/hda1" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . BytesSize ( 109951162778 ) }},
99+ {"path=/mnt/hda1,size=.1TiB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . BytesSize ( 109951162778 ) }},
100+ {"path=/mnt/hda1,size=123TB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . BytesSize ( 123000000000000 ) }},
101+ {"path=/mnt/hda1,size=123TiB" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . BytesSize ( 135239930216448 ) }},
102102 // %
103- {"path=/mnt/hda1,size=50.5%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 50.5 } }},
104- {"path=/mnt/hda1,size=100%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 100 } }},
105- {"path=/mnt/hda1,size=1%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 1 } }},
106- {"path=/mnt/hda1,size=0.999999%" , "size (0.999999%) must be between 1% and 100 %" , StoreSpec {}},
107- {"path=/mnt/hda1,size=100.0001%" , "size (100.0001%) must be between 1 % and 100%" , StoreSpec {}},
103+ {"path=/mnt/hda1,size=50.5%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 50.5 ) }},
104+ {"path=/mnt/hda1,size=100%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 100 ) }},
105+ {"path=/mnt/hda1,size=1%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 1 ) }},
106+ {"path=/mnt/hda1,size=0.999999%" , "store size (0.999999%) must be at least 1 %" , StoreSpec {}},
107+ {"path=/mnt/hda1,size=100.0001%" , "size (100.0001%) must be between 0 % and 100%" , StoreSpec {}},
108108 // 0.xxx
109- {"path=/mnt/hda1,size=0.99" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 99 } }},
110- {"path=/mnt/hda1,size=0.5000000" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 50 } }},
111- {"path=/mnt/hda1,size=0.01" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 1 } }},
112- {"path=/mnt/hda1,size=0.009999" , "size (0.009999 ) must be between 1% and 100 %" , StoreSpec {}},
109+ {"path=/mnt/hda1,size=0.99" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 99 ) }},
110+ {"path=/mnt/hda1,size=0.5000000" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 50 ) }},
111+ {"path=/mnt/hda1,size=0.01" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 1 ) }},
112+ {"path=/mnt/hda1,size=0.009999" , "store size (0.9999% ) must be at least 1 %" , StoreSpec {}},
113113 // .xxx
114- {"path=/mnt/hda1,size=.999" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 99.9 } }},
115- {"path=/mnt/hda1,size=.5000000" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 50 } }},
116- {"path=/mnt/hda1,size=.01" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec { Percent : 1 } }},
117- {"path=/mnt/hda1,size=.009999" , "size (.009999 ) must be between 1% and 100 %" , StoreSpec {}},
114+ {"path=/mnt/hda1,size=.999" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 99.9 ) }},
115+ {"path=/mnt/hda1,size=.5000000" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 50 ) }},
116+ {"path=/mnt/hda1,size=.01" , "" , StoreSpec {Path : "/mnt/hda1" , Size : storageconfig . PercentSize ( 1 ) }},
117+ {"path=/mnt/hda1,size=.009999" , "store size (0.9999% ) must be at least 1 %" , StoreSpec {}},
118118 // errors
119- {"path=/mnt/hda1,size=0" , "size (0) must be at least 640 MiB" , StoreSpec {}},
120- {"path=/mnt/hda1,size=abc" , "could not parse size (abc): strconv.ParseFloat: parsing \" \" : invalid syntax " , StoreSpec {}},
119+ {"path=/mnt/hda1,size=0" , "store size (0 B ) must be at least 640 MiB" , StoreSpec {}},
120+ {"path=/mnt/hda1,size=abc" , "could not parse size (abc): cannot parse number from \" abc \" " , StoreSpec {}},
121121 {"path=/mnt/hda1,size=" , "no value specified for size" , StoreSpec {}},
122122 {"size=20GiB,path=/mnt/hda1,size=20GiB" , "size field was used twice in store definition" , StoreSpec {}},
123123 {"size=123TB" , "no path specified" , StoreSpec {}},
124124
125125 // ballast size
126- {"path=/mnt/hda1,ballast-size=671088640" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : & SizeSpec { Bytes : 671088640 } }},
127- {"path=/mnt/hda1,ballast-size=20GB" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : & SizeSpec { Bytes : 20000000000 } }},
128- {"path=/mnt/hda1,ballast-size=1%" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : & SizeSpec { Percent : 1 } }},
129- {"path=/mnt/hda1,ballast-size=100.000%" , "ballast: size (100.000 %) must be between 0% and 50%" , StoreSpec {}},
126+ {"path=/mnt/hda1,ballast-size=671088640" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : storageconfig . BytesSize ( 671088640 ) }},
127+ {"path=/mnt/hda1,ballast-size=20GB" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : storageconfig . BytesSize ( 20000000000 ) }},
128+ {"path=/mnt/hda1,ballast-size=1%" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : storageconfig . PercentSize ( 1 ) }},
129+ {"path=/mnt/hda1,ballast-size=100.000%" , "ballast size (100%) must be at most 50%" , StoreSpec {}},
130130 {"ballast-size=20GiB,path=/mnt/hda1,ballast-size=20GiB" , "ballast-size field was used twice in store definition" , StoreSpec {}},
131131
132132 // type
133- {"type=mem,size=20GiB" , "" , StoreSpec {Size : SizeSpec { Bytes : 21474836480 } , InMemory : true }},
134- {"size=20GiB,type=mem" , "" , StoreSpec {Size : SizeSpec { Bytes : 21474836480 } , InMemory : true }},
135- {"size=20.5GiB,type=mem" , "" , StoreSpec {Size : SizeSpec { Bytes : 22011707392 } , InMemory : true }},
133+ {"type=mem,size=20GiB" , "" , StoreSpec {Size : storageconfig . BytesSize ( 21474836480 ) , InMemory : true }},
134+ {"size=20GiB,type=mem" , "" , StoreSpec {Size : storageconfig . BytesSize ( 21474836480 ) , InMemory : true }},
135+ {"size=20.5GiB,type=mem" , "" , StoreSpec {Size : storageconfig . BytesSize ( 22011707392 ) , InMemory : true }},
136136 {"size=20GiB,type=mem,attrs=mem" , "" , StoreSpec {
137- Size : SizeSpec { Bytes : 21474836480 } ,
137+ Size : storageconfig . BytesSize ( 21474836480 ) ,
138138 InMemory : true ,
139139 Attributes : []string {"mem" },
140140 }},
141- {"type=mem,size=20" , "size (20) must be at least 640 MiB" , StoreSpec {}},
141+ {"type=mem,size=20" , "store size (20 B ) must be at least 640 MiB" , StoreSpec {}},
142142 {"type=mem,size=" , "no value specified for size" , StoreSpec {}},
143143 {"type=mem,attrs=ssd" , "size must be specified for an in memory store" , StoreSpec {}},
144144 {"path=/mnt/hda1,type=mem" , "path specified for in memory store" , StoreSpec {}},
@@ -148,9 +148,9 @@ target_file_size=2097152`
148148 // provisioned rate
149149 {"path=/mnt/hda1,provisioned-rate=bandwidth=200MiB/s" , "" ,
150150 StoreSpec {Path : "/mnt/hda1" , ProvisionedRate : storageconfig.ProvisionedRate {ProvisionedBandwidth : 200 << 20 }}},
151- {"path=/mnt/hda1,provisioned-rate=bandwidth=200MiB" , "provisioned-rate field does not have bandwidth sub-field 200MiB ending in /s " , StoreSpec {}},
152- {"path=/mnt/hda1,provisioned-rate=200MiB/s" , "provisioned-rate field has invalid value 200MiB/s" , StoreSpec {}},
153- {"path=/mnt/hda1,provisioned-rate=bandwidth=0B/s" , "provisioned-rate field is trying to set bandwidth to 0 " , StoreSpec {}},
151+ {"path=/mnt/hda1,provisioned-rate=bandwidth=200MiB" , "provisioned-rate has invalid bandwidth value \" 200MiB\" " , StoreSpec {}},
152+ {"path=/mnt/hda1,provisioned-rate=200MiB/s" , "provisioned-rate has invalid value \" 200MiB/s\" " , StoreSpec {}},
153+ {"path=/mnt/hda1,provisioned-rate=bandwidth=0B/s" , "provisioned-rate has invalid bandwidth value \" 0B/s \" " , StoreSpec {}},
154154
155155 // Pebble
156156 {"path=/,pebble=[Options] l0_compaction_threshold=2 l0_stop_writes_threshold=10" , "" , StoreSpec {Path : "/" ,
@@ -161,11 +161,11 @@ target_file_size=2097152`
161161 // all together
162162 {"path=/mnt/hda1,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {
163163 Path : "/mnt/hda1" ,
164- Size : SizeSpec { Bytes : 21474836480 } ,
164+ Size : storageconfig . BytesSize ( 21474836480 ) ,
165165 Attributes : []string {"hdd" , "ssd" },
166166 }},
167167 {"type=mem,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {
168- Size : SizeSpec { Bytes : 21474836480 } ,
168+ Size : storageconfig . BytesSize ( 21474836480 ) ,
169169 InMemory : true ,
170170 Attributes : []string {"hdd" , "ssd" },
171171 }},
@@ -204,7 +204,7 @@ target_file_size=2097152`
204204 storeSpecString := base .StoreSpecCmdLineString (storeSpec )
205205 storeSpec2 , err := base .NewStoreSpec (storeSpecString )
206206 if err != nil {
207- t .Errorf ("%d(%s): error parsing String() result: %s" , i , testCase .value , err )
207+ t .Errorf ("%d(%s): error parsing String() result: %s\n %s " , i , testCase .value , err , storeSpecString )
208208 continue
209209 }
210210 // Compare strings to deal with floats not matching exactly.
@@ -218,9 +218,6 @@ target_file_size=2097152`
218218// StoreSpec aliases base.StoreSpec for convenience.
219219type StoreSpec = base.StoreSpec
220220
221- // Size aliases storageconfig.Size for convenience.
222- type SizeSpec = storageconfig.Size
223-
224221func TestStoreSpecListPreventedStartupMessage (t * testing.T ) {
225222 defer leaktest .AfterTest (t )()
226223
0 commit comments