@@ -49,6 +49,9 @@ type CommonFlags struct {
49
49
// KeyFormatName is the name of the KeyFormat to use. Defaults to "testkeys".
50
50
// Acceptable values are "testkeys" and "cockroachkvs".
51
51
KeyFormatName string
52
+ // InitialStatePath is the path to a database data directory from a previous
53
+ // run. See the "initial-state" flag below.
54
+ InitialStatePath string
52
55
}
53
56
54
57
// KeyFormat returns the KeyFormat indicated by the flags KeyFormatName.
@@ -105,6 +108,10 @@ func initCommonFlags() *CommonFlags {
105
108
flag .StringVar (& c .KeyFormatName , "key-format" , "testkeys" ,
106
109
"name of the key format to use" )
107
110
111
+ flag .StringVar (& c .InitialStatePath , "initial-state" , "" ,
112
+ `path to a database's data directory, used to prepopulate the test run's databases.
113
+ Must be used in conjunction with --previous-ops (unless --run or --compare is used).` )
114
+
108
115
return c
109
116
}
110
117
@@ -161,9 +168,6 @@ type RunFlags struct {
161
168
// PreviousOps is the path to the ops file of a previous run. See the
162
169
// "previous-ops" flag below.
163
170
PreviousOps string
164
- // InitialStatePath is the path to a database data directory from a previous
165
- // run. See the "initial-state" flag below.
166
- InitialStatePath string
167
171
// InitialStateDesc is a human-readable description of the initial database
168
172
// state. See "initial-state-desc" flag below.
169
173
InitialStateDesc string
@@ -202,10 +206,6 @@ with --run-dir or --compare`)
202
206
`path to an ops file, used to prepopulate the set of keys operations draw from." +
203
207
Must be used in conjunction with --initial-state` )
204
208
205
- flag .StringVar (& r .InitialStatePath , "initial-state" , "" ,
206
- `path to a database's data directory, used to prepopulate the test run's databases.
207
- Must be used in conjunction with --previous-ops.` )
208
-
209
209
flag .StringVar (& r .InitialStateDesc , "initial-state-desc" , "" ,
210
210
`a human-readable description of the initial database state.
211
211
If set this parameter is written to the OPTIONS to aid in
@@ -247,6 +247,9 @@ func (ro *RunOnceFlags) MakeRunOnceOptions() []metamorphic.RunOnceOption {
247
247
if ro .NumInstances > 1 {
248
248
onceOpts = append (onceOpts , metamorphic .MultiInstance (ro .NumInstances ))
249
249
}
250
+ if ro .InitialStatePath != "" {
251
+ onceOpts = append (onceOpts , metamorphic .RunOnceInitialStatePath (ro .InitialStatePath ))
252
+ }
250
253
return onceOpts
251
254
}
252
255
0 commit comments