Skip to content

Commit f8facd4

Browse files
Add test_position DoCommand as a utility to test the position stages in configuration (#24)
* Add test_position DoCommand as a utility to test the position stages in configuration * better checks * Update vinocart.go
1 parent a835bc0 commit f8facd4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pour/vinocart.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,24 @@ func (vc *VinoCart) DoCommand(ctx context.Context, cmd map[string]interface{}) (
204204
if cmd["demo"] == true {
205205
return nil, vc.FullDemo(ctx)
206206
}
207+
if cmd["test_position"] != nil {
208+
positionCmd, ok := cmd["test_position"].(map[string]interface{})
209+
if !ok {
210+
return nil, fmt.Errorf("test_position must be a map")
211+
}
212+
213+
stage, ok := positionCmd["stage"].(string)
214+
if !ok {
215+
return nil, fmt.Errorf("test_position.stage must be a string")
216+
}
217+
218+
step, ok := positionCmd["step"].(string)
219+
if !ok {
220+
return nil, fmt.Errorf("test_position.step must be a string")
221+
}
222+
223+
return nil, vc.doAll(ctx, stage, step, 50)
224+
}
207225

208226
return nil, fmt.Errorf("need a command")
209227
}

0 commit comments

Comments
 (0)