Skip to content

Commit 2746389

Browse files
committed
[release]Adaptive Docker Client API Version
DFSL will automatically configure its docker client with the maximum api version for the server.
1 parent 0b3badb commit 2746389

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

service/test_utils.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package service
22

33
import (
4+
"context"
45
"fmt"
56
"os/exec"
67
"strings"
@@ -23,7 +24,12 @@ func destroyNode(name string) {
2324
func newTestNodeDockerClient(nodeName string) (*client.Client, error) {
2425
host := fmt.Sprintf("tcp://%s:2375", nodeName)
2526
defaultHeaders := map[string]string{"User-Agent": "engine-api-cli-1.0"}
26-
return client.NewClient(host, dockerAPIVersion, nil, defaultHeaders)
27+
cli, err := client.NewClient(host, dockerAPIVersion, nil, defaultHeaders)
28+
if err != nil {
29+
return cli, err
30+
}
31+
cli.NegotiateAPIVersion(context.Background())
32+
return cli, err
2733
}
2834

2935
func getWorkerToken(nodeName string) string {

0 commit comments

Comments
 (0)