fix linting errors
Some checks failed
Lint / golangci-lint (push) Failing after 10m14s
Declarative Tests / test (push) Successful in 1m0s

This commit is contained in:
Matthew Rich 2024-04-03 14:23:57 -07:00
parent 6ba3a8f0f8
commit ae8e129ce7
4 changed files with 8 additions and 10 deletions

View File

@ -27,7 +27,7 @@ import (
type ContainerClient interface {
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error
ContainerList(context.Context, types.ContainerListOptions) ([]types.Container, error)
ContainerList(context.Context, container.ListOptions) ([]types.Container, error)
ContainerInspect(context.Context, string) (types.ContainerJSON, error)
ContainerRemove(context.Context, string, container.RemoveOptions) error
Close() error
@ -163,7 +163,7 @@ func (c *Container) Create(ctx context.Context) error {
}
*/
if startErr := c.apiClient.ContainerStart(ctx, c.Id, types.ContainerStartOptions{}); startErr != nil {
if startErr := c.apiClient.ContainerStart(ctx, c.Id, container.StartOptions{}); startErr != nil {
return startErr
}
return err
@ -175,7 +175,7 @@ func (c *Container) Read(ctx context.Context) ([]byte, error) {
var containerID string
filterArgs := filters.NewArgs()
filterArgs.Add("name", "/"+c.Name)
containers, err := c.apiClient.ContainerList(ctx, types.ContainerListOptions{
containers, err := c.apiClient.ContainerList(ctx, container.ListOptions{
All: true,
Filters: filterArgs,
})
@ -219,7 +219,7 @@ func (c *Container) Read(ctx context.Context) ([]byte, error) {
}
func (c *Container) Delete(ctx context.Context) error {
err := c.apiClient.ContainerRemove(ctx, c.Id, types.ContainerRemoveOptions{
err := c.apiClient.ContainerRemove(ctx, c.Id, container.RemoveOptions{
RemoveVolumes: true,
Force: false,
})
@ -235,7 +235,7 @@ func (c *Container) Type() string { return "container" }
func (c *Container) ResolveId(ctx context.Context) string {
filterArgs := filters.NewArgs()
filterArgs.Add("name", "/"+c.Name)
containers, err := c.apiClient.ContainerList(ctx, types.ContainerListOptions{
containers, err := c.apiClient.ContainerList(ctx, container.ListOptions{
All: true,
Filters: filterArgs,
})

View File

@ -349,8 +349,6 @@ func (n *NetworkRouteProto) UnmarshalYAML(value *yaml.Node) error {
}
func (n *NetworkRoute) UnmarshalJSON(data []byte) error {
fmt.Printf("UnmarshalJSON %#v\n", string(data))
panic(data)
if err := json.Unmarshal(data, n); err != nil {
return err
}

View File

@ -12,7 +12,7 @@ import (
type MockContainerClient struct {
InjectContainerStart func(ctx context.Context, containerID string, options container.StartOptions) error
InjectContainerCreate func(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
InjectContainerList func(context.Context, types.ContainerListOptions) ([]types.Container, error)
InjectContainerList func(context.Context, container.ListOptions) ([]types.Container, error)
InjectContainerInspect func(context.Context, string) (types.ContainerJSON, error)
InjectContainerRemove func(context.Context, string, container.RemoveOptions) error
InjectClose func() error
@ -29,7 +29,7 @@ func (m *MockContainerClient) ContainerStart(ctx context.Context, containerID st
return m.InjectContainerStart(ctx, containerID, options)
}
func (m *MockContainerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
func (m *MockContainerClient) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error) {
return m.InjectContainerList(ctx, options)
}

View File

@ -22,7 +22,7 @@ func (m *MockResource) URI() string {
}
func (m *MockResource) ResolveId(ctx context.Context) string {
return m.ResolveId(ctx)
return m.InjectResolveId(ctx)
}
func (m *MockResource) LoadDecl(yamlResourceDeclaration string) error {