@@ -50,7 +50,8 @@ func TestDisplayPipelineUpdate(t *testing.T) {
5050 EventType : "update_progress" ,
5151 },
5252 },
53- expected : `Update for pipeline test-pipeline completed successfully.
53+ expected : `
54+ Update for pipeline test-pipeline completed successfully.
5455Pipeline ID: pipeline-789
5556Update start time: 2022-01-01T00:00:00Z
5657Update end time: 2022-01-01T01:00:00Z.
@@ -72,7 +73,8 @@ Pipeline configurations for this update:
7273 },
7374 pipelineID : "pipeline-789" ,
7475 events : []pipelines.PipelineEvent {},
75- expected : `Update for pipeline completed successfully.
76+ expected : `
77+ Update for pipeline completed successfully.
7678Pipeline configurations for this update:
7779• All tables are refreshed
7880` ,
@@ -91,7 +93,8 @@ Pipeline configurations for this update:
9193 EventType : "update_progress" ,
9294 },
9395 },
94- expected : `Update for pipeline completed successfully.
96+ expected : `
97+ Update for pipeline completed successfully.
9598Pipeline configurations for this update:
9699• Refreshed [table1, table2]
97100• Full refreshed [table3]
@@ -109,7 +112,8 @@ Pipeline configurations for this update:
109112 },
110113 pipelineID : "pipeline-456" ,
111114 events : []pipelines.PipelineEvent {},
112- expected : `Update for pipeline test-pipeline completed successfully.
115+ expected : `
116+ Update for pipeline test-pipeline completed successfully.
113117Pipeline ID: pipeline-789
114118Pipeline configurations for this update:
115119• All tables are refreshed
@@ -124,7 +128,8 @@ Pipeline configurations for this update:
124128 },
125129 pipelineID : "pipeline-456" ,
126130 events : []pipelines.PipelineEvent {},
127- expected : `Update for pipeline completed successfully.
131+ expected : `
132+ Update for pipeline completed successfully.
128133Pipeline configurations for this update:
129134• All tables are refreshed
130135• Classic compute: cluster-123
@@ -267,7 +272,7 @@ func TestReadableDuration(t *testing.T) {
267272 }
268273}
269274
270- func TestDisplayProgressEvents (t * testing.T ) {
275+ func TestDisplayProgressEventsDurations (t * testing.T ) {
271276 tests := []struct {
272277 name string
273278 events []pipelines.PipelineEvent
@@ -342,21 +347,24 @@ WAITING_FOR_RESOURCES 500ms
342347RUNNING 750ms
343348` ,
344349 },
350+
351+ {
352+ name : "edge cases - empty event" ,
353+ events : []pipelines.PipelineEvent {},
354+ expected : "" ,
355+ wantErr : true ,
356+ },
345357 {
346358 name : "edge cases - single event" ,
347359 events : []pipelines.PipelineEvent {
348360 {
349361 Timestamp : "2022-01-01T00:00:00Z" ,
350362 EventType : "update_progress" ,
351- Message : "Update test-update-single is COMPLETED ." ,
363+ Message : "Update test-update-single is RUNNING ." ,
352364 },
353365 },
354366 expected : "" ,
355- },
356- {
357- name : "edge cases - empty event" ,
358- events : []pipelines.PipelineEvent {},
359- expected : "" ,
367+ wantErr : true ,
360368 },
361369 }
362370
@@ -368,9 +376,13 @@ RUNNING 750ms
368376 cmdIO := cmdio .NewIO (ctx , flags .OutputText , nil , & buf , & buf , "" , "" )
369377 ctx = cmdio .InContext (ctx , cmdIO )
370378
371- err := displayProgressEvents (ctx , tt .events )
372- assert .NoError (t , err )
373- assert .Equal (t , tt .expected , buf .String ())
379+ err := displayProgressEventsDurations (ctx , tt .events )
380+ if tt .wantErr {
381+ assert .Error (t , err )
382+ } else {
383+ assert .NoError (t , err )
384+ assert .Equal (t , tt .expected , buf .String ())
385+ }
374386 })
375387 }
376388}
0 commit comments