integration-cli: inline filters in tests

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-04-25 15:14:27 +02:00
parent 5bc0832766
commit 1bc0d7080a
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 9 additions and 25 deletions

View file

@ -102,14 +102,9 @@ func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, string) {
cli := d.NewClientT(c)
defer cli.Close()
filterArgs := filters.NewArgs()
filterArgs.Add("desired-state", "running")
options := types.TaskListOptions{
Filters: filterArgs,
}
tasks, err := cli.TaskList(context.Background(), options)
tasks, err := cli.TaskList(context.Background(), types.TaskListOptions{
Filters: filters.NewArgs(filters.Arg("desired-state", "running")),
})
assert.NilError(c, err)
result := make(map[string]int)
@ -126,14 +121,9 @@ func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, string) {
cli := d.NewClientT(c)
defer cli.Close()
filterArgs := filters.NewArgs()
filterArgs.Add("desired-state", "running")
options := types.TaskListOptions{
Filters: filterArgs,
}
tasks, err := cli.TaskList(context.Background(), options)
tasks, err := cli.TaskList(context.Background(), types.TaskListOptions{
Filters: filters.NewArgs(filters.Arg("desired-state", "running")),
})
assert.NilError(c, err)
result := make(map[string]int)

View file

@ -28,11 +28,9 @@ func (s *DockerAPISuite) TestAPIImagesFilter(c *testing.T) {
dockerCmd(c, "tag", "busybox", n)
}
getImages := func(filter string) []types.ImageSummary {
fltrs := filters.NewArgs()
fltrs.Add("reference", filter)
options := types.ImageListOptions{
All: false,
Filters: fltrs,
Filters: filters.NewArgs(filters.Arg("reference", filter)),
}
images, err := apiClient.ImageList(context.Background(), options)
assert.NilError(c, err)

View file

@ -286,13 +286,9 @@ func isNetworkAvailable(c *testing.T, name string) bool {
}
func getNetworkIDByName(c *testing.T, name string) string {
var (
v = url.Values{}
filterArgs = filters.NewArgs()
)
filterArgs.Add("name", name)
filterJSON, err := filters.ToJSON(filterArgs)
filterJSON, err := filters.ToJSON(filters.NewArgs(filters.Arg("name", name)))
assert.NilError(c, err)
v := url.Values{}
v.Set("filters", filterJSON)
resp, body, err := request.Get("/networks?" + v.Encode())