@@ -13,7 +13,6 @@ import (
13
13
"testing"
14
14
15
15
"github.com/cockroachdb/cockroach/pkg/base"
16
- "github.com/cockroachdb/cockroach/pkg/roachpb"
17
16
"github.com/cockroachdb/cockroach/pkg/storage/storageconfig"
18
17
"github.com/cockroachdb/cockroach/pkg/testutils"
19
18
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
@@ -69,23 +68,23 @@ target_file_size=2097152`
69
68
// attributes
70
69
{"path=/mnt/hda1,attrs=ssd" , "" , StoreSpec {
71
70
Path : "/mnt/hda1" ,
72
- Attributes : roachpb. Attributes { Attrs : []string {"ssd" } },
71
+ Attributes : []string {"ssd" },
73
72
}},
74
73
{"path=/mnt/hda1,attrs=ssd:hdd" , "" , StoreSpec {
75
74
Path : "/mnt/hda1" ,
76
- Attributes : roachpb. Attributes { Attrs : []string {"hdd" , "ssd" } },
75
+ Attributes : []string {"hdd" , "ssd" },
77
76
}},
78
77
{"path=/mnt/hda1,attrs=hdd:ssd" , "" , StoreSpec {
79
78
Path : "/mnt/hda1" ,
80
- Attributes : roachpb. Attributes { Attrs : []string {"hdd" , "ssd" } },
79
+ Attributes : []string {"hdd" , "ssd" },
81
80
}},
82
81
{"attrs=ssd:hdd,path=/mnt/hda1" , "" , StoreSpec {
83
82
Path : "/mnt/hda1" ,
84
- Attributes : roachpb. Attributes { Attrs : []string {"hdd" , "ssd" } },
83
+ Attributes : []string {"hdd" , "ssd" },
85
84
}},
86
85
{"attrs=hdd:ssd,path=/mnt/hda1," , "" , StoreSpec {
87
86
Path : "/mnt/hda1" ,
88
- Attributes : roachpb. Attributes { Attrs : []string {"hdd" , "ssd" } },
87
+ Attributes : []string {"hdd" , "ssd" },
89
88
}},
90
89
{"attrs=hdd:ssd" , "no path specified" , StoreSpec {}},
91
90
{"path=/mnt/hda1,attrs=" , "no value specified for attrs" , StoreSpec {}},
@@ -104,21 +103,21 @@ target_file_size=2097152`
104
103
{"path=/mnt/hda1,size=50.5%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 50.5 }}},
105
104
{"path=/mnt/hda1,size=100%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 100 }}},
106
105
{"path=/mnt/hda1,size=1%" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 1 }}},
107
- {"path=/mnt/hda1,size=0.999999%" , "store size (0.999999%) must be between 1.000000 % and 100.000000 %" , StoreSpec {}},
108
- {"path=/mnt/hda1,size=100.0001%" , "store size (100.0001%) must be between 1.000000 % and 100.000000 %" , StoreSpec {}},
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 {}},
109
108
// 0.xxx
110
109
{"path=/mnt/hda1,size=0.99" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 99 }}},
111
110
{"path=/mnt/hda1,size=0.5000000" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 50 }}},
112
111
{"path=/mnt/hda1,size=0.01" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 1 }}},
113
- {"path=/mnt/hda1,size=0.009999" , "store size (0.009999) must be between 1.000000 % and 100.000000 %" , StoreSpec {}},
112
+ {"path=/mnt/hda1,size=0.009999" , "size (0.009999) must be between 1% and 100%" , StoreSpec {}},
114
113
// .xxx
115
114
{"path=/mnt/hda1,size=.999" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 99.9 }}},
116
115
{"path=/mnt/hda1,size=.5000000" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 50 }}},
117
116
{"path=/mnt/hda1,size=.01" , "" , StoreSpec {Path : "/mnt/hda1" , Size : SizeSpec {Percent : 1 }}},
118
- {"path=/mnt/hda1,size=.009999" , "store size (.009999) must be between 1.000000 % and 100.000000 %" , StoreSpec {}},
117
+ {"path=/mnt/hda1,size=.009999" , "size (.009999) must be between 1% and 100%" , StoreSpec {}},
119
118
// errors
120
- {"path=/mnt/hda1,size=0" , "store size (0) must be larger than 640 MiB" , StoreSpec {}},
121
- {"path=/mnt/hda1,size=abc" , "could not parse store size (abc): strconv.ParseFloat: parsing \" \" : invalid syntax" , StoreSpec {}},
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 {}},
122
121
{"path=/mnt/hda1,size=" , "no value specified for size" , StoreSpec {}},
123
122
{"size=20GiB,path=/mnt/hda1,size=20GiB" , "size field was used twice in store definition" , StoreSpec {}},
124
123
{"size=123TB" , "no path specified" , StoreSpec {}},
@@ -127,7 +126,7 @@ target_file_size=2097152`
127
126
{"path=/mnt/hda1,ballast-size=671088640" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : & SizeSpec {Bytes : 671088640 }}},
128
127
{"path=/mnt/hda1,ballast-size=20GB" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : & SizeSpec {Bytes : 20000000000 }}},
129
128
{"path=/mnt/hda1,ballast-size=1%" , "" , StoreSpec {Path : "/mnt/hda1" , BallastSize : & SizeSpec {Percent : 1 }}},
130
- {"path=/mnt/hda1,ballast-size=100.000%" , "ballast size (100.000%) must be between 0.000000 % and 50.000000 %" , StoreSpec {}},
129
+ {"path=/mnt/hda1,ballast-size=100.000%" , "ballast: size (100.000%) must be between 0% and 50%" , StoreSpec {}},
131
130
{"ballast-size=20GiB,path=/mnt/hda1,ballast-size=20GiB" , "ballast-size field was used twice in store definition" , StoreSpec {}},
132
131
133
132
// type
@@ -137,9 +136,9 @@ target_file_size=2097152`
137
136
{"size=20GiB,type=mem,attrs=mem" , "" , StoreSpec {
138
137
Size : SizeSpec {Bytes : 21474836480 },
139
138
InMemory : true ,
140
- Attributes : roachpb. Attributes { Attrs : []string {"mem" } },
139
+ Attributes : []string {"mem" },
141
140
}},
142
- {"type=mem,size=20" , "store size (20) must be larger than 640 MiB" , StoreSpec {}},
141
+ {"type=mem,size=20" , "size (20) must be at least 640 MiB" , StoreSpec {}},
143
142
{"type=mem,size=" , "no value specified for size" , StoreSpec {}},
144
143
{"type=mem,attrs=ssd" , "size must be specified for an in memory store" , StoreSpec {}},
145
144
{"path=/mnt/hda1,type=mem" , "path specified for in memory store" , StoreSpec {}},
@@ -163,12 +162,12 @@ target_file_size=2097152`
163
162
{"path=/mnt/hda1,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {
164
163
Path : "/mnt/hda1" ,
165
164
Size : SizeSpec {Bytes : 21474836480 },
166
- Attributes : roachpb. Attributes { Attrs : []string {"hdd" , "ssd" } },
165
+ Attributes : []string {"hdd" , "ssd" },
167
166
}},
168
167
{"type=mem,attrs=hdd:ssd,size=20GiB" , "" , StoreSpec {
169
168
Size : SizeSpec {Bytes : 21474836480 },
170
169
InMemory : true ,
171
- Attributes : roachpb. Attributes { Attrs : []string {"hdd" , "ssd" } },
170
+ Attributes : []string {"hdd" , "ssd" },
172
171
}},
173
172
174
173
// other error cases
@@ -202,14 +201,14 @@ target_file_size=2097152`
202
201
}
203
202
204
203
// Now test String() to make sure the result can be parsed.
205
- storeSpecString := storeSpec . String ( )
204
+ storeSpecString := base . StoreSpecCmdLineString ( storeSpec )
206
205
storeSpec2 , err := base .NewStoreSpec (storeSpecString )
207
206
if err != nil {
208
207
t .Errorf ("%d(%s): error parsing String() result: %s" , i , testCase .value , err )
209
208
continue
210
209
}
211
210
// Compare strings to deal with floats not matching exactly.
212
- if ! reflect .DeepEqual (storeSpecString , storeSpec2 . String ( )) {
211
+ if ! reflect .DeepEqual (storeSpecString , base . StoreSpecCmdLineString ( storeSpec2 )) {
213
212
t .Errorf ("%d(%s): actual doesn't match expected\n actual: %#+v\n expected: %#+v" , i , testCase .value ,
214
213
storeSpec , storeSpec2 )
215
214
}
@@ -248,7 +247,7 @@ func TestStoreSpecListPreventedStartupMessage(t *testing.T) {
248
247
err := ssl .PriorCriticalAlertError ()
249
248
require .NoError (t , err )
250
249
251
- require .NoError (t , os .WriteFile (ssl . Specs [ 2 ]. PreventedStartupFile (), []byte ("boom" ), 0644 ))
250
+ require .NoError (t , os .WriteFile (base . PreventedStartupFile (okAuxDir ), []byte ("boom" ), 0644 ))
252
251
253
252
err = ssl .PriorCriticalAlertError ()
254
253
require .Error (t , err )
0 commit comments