@@ -1079,7 +1079,7 @@ func TestStartContainerWithContext(t *testing.T) {
10791079
10801080 startError := make (chan error )
10811081 go func () {
1082- startError <- client .StartContainerWithContext (id , & HostConfig {}, ctx )
1082+ startError <- client .StartContainerWithContext (ctx , id , & HostConfig {})
10831083 }()
10841084 select {
10851085 case err := <- startError :
@@ -1154,7 +1154,7 @@ func TestStopContainerWithContext(t *testing.T) {
11541154
11551155 stopError := make (chan error )
11561156 go func () {
1157- stopError <- client .StopContainerWithContext (id , 10 , ctx )
1157+ stopError <- client .StopContainerWithContext (ctx , id , 10 )
11581158 }()
11591159 select {
11601160 case err := <- stopError :
@@ -2473,7 +2473,8 @@ func TestStats(t *testing.T) {
24732473 "total_usage" : 36488948,
24742474 "usage_in_kernelmode" : 20000000
24752475 },
2476- "system_cpu_usage" : 20091722000000000
2476+ "system_cpu_usage" : 20091722000000000,
2477+ "online_cpus": 4
24772478 },
24782479 "precpu_stats" : {
24792480 "cpu_usage" : {
@@ -2487,7 +2488,8 @@ func TestStats(t *testing.T) {
24872488 "total_usage" : 36488948,
24882489 "usage_in_kernelmode" : 20000000
24892490 },
2490- "system_cpu_usage" : 20091722000000000
2491+ "system_cpu_usage" : 20091722000000000,
2492+ "online_cpus": 4
24912493 }
24922494 }`
24932495 // 1 second later, cache is 100
@@ -2591,7 +2593,8 @@ func TestStats(t *testing.T) {
25912593 "total_usage" : 36488948,
25922594 "usage_in_kernelmode" : 20000000
25932595 },
2594- "system_cpu_usage" : 20091722000000000
2596+ "system_cpu_usage" : 20091722000000000,
2597+ "online_cpus": 4
25952598 },
25962599 "precpu_stats" : {
25972600 "cpu_usage" : {
@@ -2605,7 +2608,8 @@ func TestStats(t *testing.T) {
26052608 "total_usage" : 36488948,
26062609 "usage_in_kernelmode" : 20000000
26072610 },
2608- "system_cpu_usage" : 20091722000000000
2611+ "system_cpu_usage" : 20091722000000000,
2612+ "online_cpus": 4
26092613 }
26102614 }`
26112615 var expected1 Stats
@@ -2725,7 +2729,7 @@ func TestInspectContainerWhenContextTimesOut(t *testing.T) {
27252729 ctx , cancel := context .WithTimeout (context .TODO (), 100 * time .Millisecond )
27262730 defer cancel ()
27272731
2728- _ , err := client .InspectContainerWithContext ("id" , ctx )
2732+ _ , err := client .InspectContainerWithContext (ctx , "id" )
27292733 if err != context .DeadlineExceeded {
27302734 t .Errorf ("Expected 'DeadlineExceededError', got: %v" , err )
27312735 }
@@ -2740,7 +2744,7 @@ func TestStartContainerWhenContextTimesOut(t *testing.T) {
27402744 ctx , cancel := context .WithTimeout (context .TODO (), 100 * time .Millisecond )
27412745 defer cancel ()
27422746
2743- err := client .StartContainerWithContext ("id" , nil , ctx )
2747+ err := client .StartContainerWithContext (ctx , "id" , nil )
27442748 if err != context .DeadlineExceeded {
27452749 t .Errorf ("Expected 'DeadlineExceededError', got: %v" , err )
27462750 }
@@ -2755,7 +2759,7 @@ func TestStopContainerWhenContextTimesOut(t *testing.T) {
27552759 ctx , cancel := context .WithTimeout (context .TODO (), 50 * time .Millisecond )
27562760 defer cancel ()
27572761
2758- err := client .StopContainerWithContext ("id" , 10 , ctx )
2762+ err := client .StopContainerWithContext (ctx , "id" , 10 )
27592763 if err != context .DeadlineExceeded {
27602764 t .Errorf ("Expected 'DeadlineExceededError', got: %v" , err )
27612765 }
0 commit comments