mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client/service: use gotest.tools-style asserts
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -64,12 +64,8 @@ func TestServiceCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
r, err := client.ServiceCreate(context.Background(), swarm.ServiceSpec{}, types.ServiceCreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if r.ID != "service_id" {
|
||||
t.Fatalf("expected `service_id`, got %s", r.ID)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(r.ID, "service_id"))
|
||||
}
|
||||
|
||||
func TestServiceCreateCompatiblePlatforms(t *testing.T) {
|
||||
@@ -127,7 +123,7 @@ func TestServiceCreateCompatiblePlatforms(t *testing.T) {
|
||||
spec := swarm.ServiceSpec{TaskTemplate: swarm.TaskSpec{ContainerSpec: &swarm.ContainerSpec{Image: "foobar:1.0"}}}
|
||||
|
||||
r, err := client.ServiceCreate(context.Background(), spec, types.ServiceCreateOptions{QueryRegistry: true})
|
||||
assert.Check(t, err)
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal("service_linux_amd64", r.ID))
|
||||
}
|
||||
|
||||
@@ -206,16 +202,10 @@ func TestServiceCreateDigestPinning(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}, types.ServiceCreateOptions{QueryRegistry: true})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
|
||||
if r.ID != "service_id" {
|
||||
t.Fatalf("expected `service_id`, got %s", r.ID)
|
||||
}
|
||||
assert.Check(t, is.Equal(r.ID, "service_id"))
|
||||
|
||||
if p.expected != serviceCreateImage {
|
||||
t.Fatalf("expected image %s, got %s", p.expected, serviceCreateImage)
|
||||
}
|
||||
assert.Check(t, is.Equal(p.expected, serviceCreateImage))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,10 +72,6 @@ func TestServiceInspect(t *testing.T) {
|
||||
}
|
||||
|
||||
serviceInspect, _, err := client.ServiceInspectWithRaw(context.Background(), "service_id", types.ServiceInspectOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if serviceInspect.ID != "service_id" {
|
||||
t.Fatalf("expected `service_id`, got %s", serviceInspect.ID)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(serviceInspect.ID, "service_id"))
|
||||
}
|
||||
|
||||
@@ -84,11 +84,7 @@ func TestServiceList(t *testing.T) {
|
||||
}
|
||||
|
||||
services, err := client.ServiceList(context.Background(), listCase.options)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(services) != 2 {
|
||||
t.Fatalf("expected 2 services, got %v", services)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Len(services, 2))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,5 @@ func TestServiceRemove(t *testing.T) {
|
||||
}
|
||||
|
||||
err := client.ServiceRemove(context.Background(), "service_id")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
@@ -90,8 +90,6 @@ func TestServiceUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
_, err := client.ServiceUpdate(context.Background(), "service_id", updateCase.swarmVersion, swarm.ServiceSpec{}, types.ServiceUpdateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user