@@ -92,53 +92,53 @@ target_file_size=2097152`
92
92
{"path=/mnt/hda1,attrs=hdd,attrs=ssd" , "attrs field was used twice in store definition" , StoreSpec {}},
93
93
94
94
// 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 ) }},
102
102
// %
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 {}},
108
108
// 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 {}},
113
113
// .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 {}},
118
118
// 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 {}},
121
121
{"path=/mnt/hda1,size=" , "no value specified for size" , StoreSpec {}},
122
122
{"size=20GiB,path=/mnt/hda1,size=20GiB" , "size field was used twice in store definition" , StoreSpec {}},
123
123
{"size=123TB" , "no path specified" , StoreSpec {}},
124
124
125
125
// 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 {}},
130
130
{"ballast-size=20GiB,path=/mnt/hda1,ballast-size=20GiB" , "ballast-size field was used twice in store definition" , StoreSpec {}},
131
131
132
132
// 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 }},
136
136
{"size=20GiB,type=mem,attrs=mem" , "" , StoreSpec {
137
- Size : SizeSpec { Bytes : 21474836480 } ,
137
+ Size : storageconfig . BytesSize ( 21474836480 ) ,
138
138
InMemory : true ,
139
139
Attributes : []string {"mem" },
140
140
}},
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 {}},
142
142
{"type=mem,size=" , "no value specified for size" , StoreSpec {}},
143
143
{"type=mem,attrs=ssd" , "size must be specified for an in memory store" , StoreSpec {}},
144
144
{"path=/mnt/hda1,type=mem" , "path specified for in memory store" , StoreSpec {}},
@@ -148,9 +148,9 @@ target_file_size=2097152`
148
148
// provisioned rate
149
149
{"path=/mnt/hda1,provisioned-rate=bandwidth=200MiB/s" , "" ,
150
150
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 {}},
154
154
155
155
// Pebble
156
156
{"path=/,pebble=[Options] l0_compaction_threshold=2 l0_stop_writes_threshold=10" , "" , StoreSpec {Path : "/" ,
@@ -161,11 +161,11 @@ target_file_size=2097152`
161
161
// all together
162
162
{"path=/mnt/hda1,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {
163
163
Path : "/mnt/hda1" ,
164
- Size : SizeSpec { Bytes : 21474836480 } ,
164
+ Size : storageconfig . BytesSize ( 21474836480 ) ,
165
165
Attributes : []string {"hdd" , "ssd" },
166
166
}},
167
167
{"type=mem,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {
168
- Size : SizeSpec { Bytes : 21474836480 } ,
168
+ Size : storageconfig . BytesSize ( 21474836480 ) ,
169
169
InMemory : true ,
170
170
Attributes : []string {"hdd" , "ssd" },
171
171
}},
@@ -204,7 +204,7 @@ target_file_size=2097152`
204
204
storeSpecString := base .StoreSpecCmdLineString (storeSpec )
205
205
storeSpec2 , err := base .NewStoreSpec (storeSpecString )
206
206
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 )
208
208
continue
209
209
}
210
210
// Compare strings to deal with floats not matching exactly.
@@ -218,9 +218,6 @@ target_file_size=2097152`
218
218
// StoreSpec aliases base.StoreSpec for convenience.
219
219
type StoreSpec = base.StoreSpec
220
220
221
- // Size aliases storageconfig.Size for convenience.
222
- type SizeSpec = storageconfig.Size
223
-
224
221
func TestStoreSpecListPreventedStartupMessage (t * testing.T ) {
225
222
defer leaktest .AfterTest (t )()
226
223
0 commit comments