mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: ExecCreateResult: define local type with ID field
The `ExecCreateResult` was embedding the `container.ExecCreateRespons`,
which in itself was an alias for `common.IDResponse`. This type has a
single field (`ID`) currently, but the embedding made it awkward to use,
for example, when mocking a `ExecCreateResult` using struct-literals:
func execCreateWithID(_ string, _ client.ExecCreateOptions) (client.ExecCreateResult, error) {
return client.ExecCreateResult{ExecCreateResponse: container.ExecCreateResponse{ID: "execid"}}, nil
}
This patch defines it as a local type with the `ID` as field.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -68,11 +68,11 @@ func TestExecCreate(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
r, err := client.ExecCreate(context.Background(), "container_id", ExecCreateOptions{
|
||||
res, err := client.ExecCreate(context.Background(), "container_id", ExecCreateOptions{
|
||||
User: "user",
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(r.ID, "exec_id"))
|
||||
assert.Check(t, is.Equal(res.ID, "exec_id"))
|
||||
}
|
||||
|
||||
func TestExecStartError(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user