| 497 | } |
| 498 | |
| 499 | func TestClientReconnect(t *testing.T) { |
| 500 | t.Parallel() |
| 501 | |
| 502 | ctx, cancel := testContext(t) |
| 503 | defer cancel() |
| 504 | |
| 505 | client, err := newClient(t, address) |
| 506 | if err != nil { |
| 507 | t.Fatal(err) |
| 508 | } |
| 509 | if client == nil { |
| 510 | t.Fatal("New() returned nil client") |
| 511 | } |
| 512 | ok, err := client.IsServing(ctx) |
| 513 | if err != nil { |
| 514 | t.Fatal(err) |
| 515 | } |
| 516 | if !ok { |
| 517 | t.Fatal("containerd is not serving") |
| 518 | } |
| 519 | if err := client.Reconnect(); err != nil { |
| 520 | t.Fatal(err) |
| 521 | } |
| 522 | if ok, err = client.IsServing(ctx); err != nil { |
| 523 | t.Fatal(err) |
| 524 | } |
| 525 | if !ok { |
| 526 | t.Fatal("containerd is not serving") |
| 527 | } |
| 528 | if err := client.Close(); err != nil { |
| 529 | t.Errorf("client closed returned error %v", err) |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | func TestDefaultRuntimeWithNamespaceLabels(t *testing.T) { |
| 534 | client, err := newClient(t, address) |