@@ -19,9 +19,11 @@ func TestProcedureRowsCombineConfigStatusAndConsoles(t *testing.T) {
1919 },
2020 },
2121 }}
22- rows := procedureRows (file , map [string ]domain.ScrollLockStatus {
23- "start" : domain .ScrollLockStatusWaiting ,
24- "coldstart" : domain .ScrollLockStatusRunning ,
22+ rows := procedureRows (file , domain.ProcedureStatusMap {
23+ "start" : {
24+ "coldstart" : {Status : domain .ScrollLockStatusRunning },
25+ "start.1" : {Status : domain .ScrollLockStatusWaiting },
26+ },
2527 }, map [string ]domain.Console {
2628 "coldstart" : {},
2729 })
@@ -48,8 +50,10 @@ func TestProcedureRowsDoNotMarkEveryProcedureRunningFromCommandStatus(t *testing
4850 },
4951 },
5052 }}
51- rows := procedureRows (file , map [string ]domain.ScrollLockStatus {
52- "start" : domain .ScrollLockStatusRunning ,
53+ rows := procedureRows (file , domain.ProcedureStatusMap {
54+ "start" : {
55+ "start" : {Status : domain .ScrollLockStatusWaiting },
56+ },
5357 }, map [string ]domain.Console {
5458 "coldstart" : {},
5559 })
@@ -62,38 +66,6 @@ func TestProcedureRowsDoNotMarkEveryProcedureRunningFromCommandStatus(t *testing
6266 }
6367}
6468
65- func TestCommandRunCallsDaemon (t * testing.T ) {
66- daemon := & fakeProcedureDaemon {}
67- withClientConfig (t , Config {Daemon : func () (RuntimeDaemon , error ) { return daemon , nil }})
68-
69- if err := CommandRunCommand .RunE (& cobra.Command {}, []string {"scroll-a" , "start" }); err != nil {
70- t .Fatal (err )
71- }
72- if daemon .runScroll != "scroll-a" || daemon .runCommand != "start" {
73- t .Fatalf ("run scroll=%q command=%q" , daemon .runScroll , daemon .runCommand )
74- }
75- }
76-
77- func TestCommandRowsCombineConfigAndQueue (t * testing.T ) {
78- file := & domain.File {Commands : map [string ]* domain.CommandInstructionSet {
79- "install" : {Run : domain .RunModeOnce , Procedures : []* domain.Procedure {{}}},
80- "start" : {Run : domain .RunModeRestart , Procedures : []* domain.Procedure {{}, {}}},
81- }}
82- rows := commandRows (file , map [string ]domain.ScrollLockStatus {
83- "start" : domain .ScrollLockStatusWaiting ,
84- })
85-
86- if len (rows ) != 2 {
87- t .Fatalf ("rows = %#v" , rows )
88- }
89- if rows [0 ] != (commandRow {command : "install" , status : "-" , runMode : "once" , procedures : 1 }) {
90- t .Fatalf ("row 0 = %#v" , rows [0 ])
91- }
92- if rows [1 ] != (commandRow {command : "start" , status : "waiting" , runMode : "restart" , procedures : 2 }) {
93- t .Fatalf ("row 1 = %#v" , rows [1 ])
94- }
95- }
96-
9769func TestProcedureAttachRequiresActiveConsole (t * testing.T ) {
9870 daemon := & fakeProcedureDaemon {consoles : map [string ]domain.Console {"start" : {}}}
9971 var attachedScroll , attachedConsole string
@@ -125,9 +97,7 @@ func withClientConfig(t *testing.T, cfg Config) {
12597}
12698
12799type fakeProcedureDaemon struct {
128- runScroll string
129- runCommand string
130- consoles map [string ]domain.Console
100+ consoles map [string ]domain.Console
131101}
132102
133103func (f * fakeProcedureDaemon ) CreateScroll (ctx context.Context , name string , artifact string , registryCredentials []api.RegistryCredential ) (* api.RuntimeScroll , error ) {
@@ -150,21 +120,11 @@ func (f *fakeProcedureDaemon) DeleteScroll(ctx context.Context, id string) (*api
150120 return nil , nil
151121}
152122
153- func (f * fakeProcedureDaemon ) RunScrollCommand (ctx context.Context , id string , command string ) (* api.RuntimeScroll , error ) {
154- f .runScroll = id
155- f .runCommand = command
156- return & api.RuntimeScroll {Id : id }, nil
157- }
158-
159123func (f * fakeProcedureDaemon ) GetScrollConfig (ctx context.Context , id string ) (* domain.File , error ) {
160124 return & domain.File {}, nil
161125}
162126
163- func (f * fakeProcedureDaemon ) GetScrollProcedures (ctx context.Context , id string ) (map [string ]domain.ScrollLockStatus , error ) {
164- return nil , nil
165- }
166-
167- func (f * fakeProcedureDaemon ) GetScrollQueue (ctx context.Context , id string ) (map [string ]domain.ScrollLockStatus , error ) {
127+ func (f * fakeProcedureDaemon ) GetScrollQueue (ctx context.Context , id string ) (domain.ProcedureStatusMap , error ) {
168128 return nil , nil
169129}
170130
0 commit comments