@@ -34,49 +34,49 @@ func TestNewStoreSpec(t *testing.T) {
3434 expected StoreSpec
3535 }{
3636 // path
37- {"path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false , nil }},
38- {",path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false , nil }},
39- {"path=/mnt/hda1," , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false , nil }},
40- {",,,path=/mnt/hda1,,," , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false , nil }},
41- {"/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false , nil }},
37+ {"path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false }},
38+ {",path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false }},
39+ {"path=/mnt/hda1," , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false }},
40+ {",,,path=/mnt/hda1,,," , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false }},
41+ {"/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {}, false }},
4242 {"path=" , "no value specified for path" , StoreSpec {}},
4343 {"path=/mnt/hda1,path=/mnt/hda2" , "path field was used twice in store definition" , StoreSpec {}},
4444 {"/mnt/hda1,path=/mnt/hda2" , "path field was used twice in store definition" , StoreSpec {}},
4545
4646 // attributes
47- {"path=/mnt/hda1,attrs=ssd" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"ssd" }}, false , nil }},
48- {"path=/mnt/hda1,attrs=ssd:hdd" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false , nil }},
49- {"path=/mnt/hda1,attrs=hdd:ssd" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false , nil }},
50- {"attrs=ssd:hdd,path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false , nil }},
51- {"attrs=hdd:ssd,path=/mnt/hda1," , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false , nil }},
47+ {"path=/mnt/hda1,attrs=ssd" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"ssd" }}, false }},
48+ {"path=/mnt/hda1,attrs=ssd:hdd" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false }},
49+ {"path=/mnt/hda1,attrs=hdd:ssd" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false }},
50+ {"attrs=ssd:hdd,path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false }},
51+ {"attrs=hdd:ssd,path=/mnt/hda1," , "" , StoreSpec {"/mnt/hda1" , 0 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false }},
5252 {"attrs=hdd:ssd" , "no path specified" , StoreSpec {}},
5353 {"path=/mnt/hda1,attrs=" , "no value specified for attrs" , StoreSpec {}},
5454 {"path=/mnt/hda1,attrs=hdd:hdd" , "duplicate attribute given for store: hdd" , StoreSpec {}},
5555 {"path=/mnt/hda1,attrs=hdd,attrs=ssd" , "attrs field was used twice in store definition" , StoreSpec {}},
5656
5757 // size
58- {"path=/mnt/hda1,size=671088640" , "" , StoreSpec {"/mnt/hda1" , 671088640 , 0 , false , roachpb.Attributes {}, false , nil }},
59- {"path=/mnt/hda1,size=20GB" , "" , StoreSpec {"/mnt/hda1" , 20000000000 , 0 , false , roachpb.Attributes {}, false , nil }},
60- {"size=20GiB,path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 21474836480 , 0 , false , roachpb.Attributes {}, false , nil }},
61- {"size=0.1TiB,path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 109951162777 , 0 , false , roachpb.Attributes {}, false , nil }},
62- {"path=/mnt/hda1,size=.1TiB" , "" , StoreSpec {"/mnt/hda1" , 109951162777 , 0 , false , roachpb.Attributes {}, false , nil }},
63- {"path=/mnt/hda1,size=123TB" , "" , StoreSpec {"/mnt/hda1" , 123000000000000 , 0 , false , roachpb.Attributes {}, false , nil }},
64- {"path=/mnt/hda1,size=123TiB" , "" , StoreSpec {"/mnt/hda1" , 135239930216448 , 0 , false , roachpb.Attributes {}, false , nil }},
58+ {"path=/mnt/hda1,size=671088640" , "" , StoreSpec {"/mnt/hda1" , 671088640 , 0 , false , roachpb.Attributes {}, false }},
59+ {"path=/mnt/hda1,size=20GB" , "" , StoreSpec {"/mnt/hda1" , 20000000000 , 0 , false , roachpb.Attributes {}, false }},
60+ {"size=20GiB,path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 21474836480 , 0 , false , roachpb.Attributes {}, false }},
61+ {"size=0.1TiB,path=/mnt/hda1" , "" , StoreSpec {"/mnt/hda1" , 109951162777 , 0 , false , roachpb.Attributes {}, false }},
62+ {"path=/mnt/hda1,size=.1TiB" , "" , StoreSpec {"/mnt/hda1" , 109951162777 , 0 , false , roachpb.Attributes {}, false }},
63+ {"path=/mnt/hda1,size=123TB" , "" , StoreSpec {"/mnt/hda1" , 123000000000000 , 0 , false , roachpb.Attributes {}, false }},
64+ {"path=/mnt/hda1,size=123TiB" , "" , StoreSpec {"/mnt/hda1" , 135239930216448 , 0 , false , roachpb.Attributes {}, false }},
6565 // %
66- {"path=/mnt/hda1,size=50.5%" , "" , StoreSpec {"/mnt/hda1" , 0 , 50.5 , false , roachpb.Attributes {}, false , nil }},
67- {"path=/mnt/hda1,size=100%" , "" , StoreSpec {"/mnt/hda1" , 0 , 100 , false , roachpb.Attributes {}, false , nil }},
68- {"path=/mnt/hda1,size=1%" , "" , StoreSpec {"/mnt/hda1" , 0 , 1 , false , roachpb.Attributes {}, false , nil }},
66+ {"path=/mnt/hda1,size=50.5%" , "" , StoreSpec {"/mnt/hda1" , 0 , 50.5 , false , roachpb.Attributes {}, false }},
67+ {"path=/mnt/hda1,size=100%" , "" , StoreSpec {"/mnt/hda1" , 0 , 100 , false , roachpb.Attributes {}, false }},
68+ {"path=/mnt/hda1,size=1%" , "" , StoreSpec {"/mnt/hda1" , 0 , 1 , false , roachpb.Attributes {}, false }},
6969 {"path=/mnt/hda1,size=0.999999%" , "store size (0.999999%) must be between 1% and 100%" , StoreSpec {}},
7070 {"path=/mnt/hda1,size=100.0001%" , "store size (100.0001%) must be between 1% and 100%" , StoreSpec {}},
7171 // 0.xxx
72- {"path=/mnt/hda1,size=0.99" , "" , StoreSpec {"/mnt/hda1" , 0 , 99 , false , roachpb.Attributes {}, false , nil }},
73- {"path=/mnt/hda1,size=0.5000000" , "" , StoreSpec {"/mnt/hda1" , 0 , 50 , false , roachpb.Attributes {}, false , nil }},
74- {"path=/mnt/hda1,size=0.01" , "" , StoreSpec {"/mnt/hda1" , 0 , 1 , false , roachpb.Attributes {}, false , nil }},
72+ {"path=/mnt/hda1,size=0.99" , "" , StoreSpec {"/mnt/hda1" , 0 , 99 , false , roachpb.Attributes {}, false }},
73+ {"path=/mnt/hda1,size=0.5000000" , "" , StoreSpec {"/mnt/hda1" , 0 , 50 , false , roachpb.Attributes {}, false }},
74+ {"path=/mnt/hda1,size=0.01" , "" , StoreSpec {"/mnt/hda1" , 0 , 1 , false , roachpb.Attributes {}, false }},
7575 {"path=/mnt/hda1,size=0.009999" , "store size (0.009999) must be between 1% and 100%" , StoreSpec {}},
7676 // .xxx
77- {"path=/mnt/hda1,size=.999" , "" , StoreSpec {"/mnt/hda1" , 0 , 99.9 , false , roachpb.Attributes {}, false , nil }},
78- {"path=/mnt/hda1,size=.5000000" , "" , StoreSpec {"/mnt/hda1" , 0 , 50 , false , roachpb.Attributes {}, false , nil }},
79- {"path=/mnt/hda1,size=.01" , "" , StoreSpec {"/mnt/hda1" , 0 , 1 , false , roachpb.Attributes {}, false , nil }},
77+ {"path=/mnt/hda1,size=.999" , "" , StoreSpec {"/mnt/hda1" , 0 , 99.9 , false , roachpb.Attributes {}, false }},
78+ {"path=/mnt/hda1,size=.5000000" , "" , StoreSpec {"/mnt/hda1" , 0 , 50 , false , roachpb.Attributes {}, false }},
79+ {"path=/mnt/hda1,size=.01" , "" , StoreSpec {"/mnt/hda1" , 0 , 1 , false , roachpb.Attributes {}, false }},
8080 {"path=/mnt/hda1,size=.009999" , "store size (.009999) must be between 1% and 100%" , StoreSpec {}},
8181 // errors
8282 {"path=/mnt/hda1,size=0" , "store size (0) must be larger than 640 MiB" , StoreSpec {}},
@@ -86,10 +86,10 @@ func TestNewStoreSpec(t *testing.T) {
8686 {"size=123TB" , "no path specified" , StoreSpec {}},
8787
8888 // type
89- {"type=mem,size=20GiB" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {}, false , nil }},
90- {"size=20GiB,type=mem" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {}, false , nil }},
91- {"size=20.5GiB,type=mem" , "" , StoreSpec {"" , 22011707392 , 0 , true , roachpb.Attributes {}, false , nil }},
92- {"size=20GiB,type=mem,attrs=mem" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {Attrs : []string {"mem" }}, false , nil }},
89+ {"type=mem,size=20GiB" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {}, false }},
90+ {"size=20GiB,type=mem" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {}, false }},
91+ {"size=20.5GiB,type=mem" , "" , StoreSpec {"" , 22011707392 , 0 , true , roachpb.Attributes {}, false }},
92+ {"size=20GiB,type=mem,attrs=mem" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {Attrs : []string {"mem" }}, false }},
9393 {"type=mem,size=20" , "store size (20) must be larger than 640 MiB" , StoreSpec {}},
9494 {"type=mem,size=" , "no value specified for size" , StoreSpec {}},
9595 {"type=mem,attrs=ssd" , "size must be specified for an in memory store" , StoreSpec {}},
@@ -98,8 +98,8 @@ func TestNewStoreSpec(t *testing.T) {
9898 {"path=/mnt/hda1,type=mem,size=20GiB" , "path specified for in memory store" , StoreSpec {}},
9999
100100 // all together
101- {"path=/mnt/hda1,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {"/mnt/hda1" , 21474836480 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false , nil }},
102- {"type=mem,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false , nil }},
101+ {"path=/mnt/hda1,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {"/mnt/hda1" , 21474836480 , 0 , false , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false }},
102+ {"type=mem,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {"" , 21474836480 , 0 , true , roachpb.Attributes {Attrs : []string {"hdd" , "ssd" }}, false }},
103103
104104 // other error cases
105105 {"" , "no value specified" , StoreSpec {}},
0 commit comments