Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions cmd/compose/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ type configOptions struct {
lockImageDigests bool
}

func (o *configOptions) ToProject(ctx context.Context, dockerCli command.Cli, backend api.Compose, services []string) (*types.Project, error) {
project, _, err := o.ProjectOptions.ToProject(ctx, dockerCli, backend, services, o.toProjectOptionsFns()...)
func (o *configOptions) ToProject(ctx context.Context, dockerCli command.Cli, backend api.Compose, services []string, po ...cli.ProjectOptionsFn) (*types.Project, error) {
po = append(po, o.toProjectOptionsFns()...)
project, _, err := o.ProjectOptions.ToProject(ctx, dockerCli, backend, services, po...)
return project, err
}

Expand Down Expand Up @@ -491,7 +492,7 @@ func runServices(ctx context.Context, dockerCli command.Cli, opts configOptions)
return err
}

project, _, err := opts.ProjectOptions.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
project, err := opts.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
if err != nil {
return err
}
Expand All @@ -509,7 +510,7 @@ func runVolumes(ctx context.Context, dockerCli command.Cli, opts configOptions)
return err
}

project, _, err := opts.ProjectOptions.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
project, err := opts.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
if err != nil {
return err
}
Expand All @@ -525,7 +526,7 @@ func runNetworks(ctx context.Context, dockerCli command.Cli, opts configOptions)
return err
}

project, _, err := opts.ProjectOptions.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
project, err := opts.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
if err != nil {
return err
}
Expand All @@ -541,7 +542,7 @@ func runModels(ctx context.Context, dockerCli command.Cli, opts configOptions) e
return err
}

project, _, err := opts.ProjectOptions.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
project, err := opts.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
if err != nil {
return err
}
Expand All @@ -564,7 +565,7 @@ func runHash(ctx context.Context, dockerCli command.Cli, opts configOptions) err
return err
}

project, _, err := opts.ProjectOptions.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
project, err := opts.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
if err != nil {
return err
}
Expand Down
30 changes: 30 additions & 0 deletions pkg/e2e/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,34 @@ func TestLocalComposeConfig(t *testing.T) {
Out: `PORT`,
})
})

t.Run("--no-consistency --services", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/no-consistency.yaml", "--project-name", projectName, "config", "--no-consistency", "--services")
res.Assert(t, icmd.Expected{Out: `incomplete`})
})

t.Run("--no-consistency --volumes", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/no-consistency.yaml", "--project-name", projectName, "config", "--no-consistency", "--volumes")
res.Assert(t, icmd.Expected{Out: `data`})
})

t.Run("--no-consistency --networks", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/no-consistency.yaml", "--project-name", projectName, "config", "--no-consistency", "--networks")
res.Assert(t, icmd.Expected{Out: `internal`})
})

t.Run("--no-consistency --models", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/no-consistency.yaml", "--project-name", projectName, "config", "--no-consistency", "--models")
res.Assert(t, icmd.Expected{Out: `ai/example`})
})

t.Run("--no-consistency --hash", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/no-consistency.yaml", "--project-name", projectName, "config", "--no-consistency", "--hash", "*")
res.Assert(t, icmd.Expected{Out: `incomplete `})
})

t.Run("--profile --no-consistency --services", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/no-consistency.yaml", "--project-name", projectName, "--profile", "extra", "config", "--no-consistency", "--services")
res.Assert(t, icmd.Expected{Out: `gated`})
})
}
17 changes: 17 additions & 0 deletions pkg/e2e/fixtures/config/no-consistency.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
incomplete:
volumes:
- data:/data
networks:
- internal
models:
llm:
gated:
profiles: ["extra"]
volumes:
data:
networks:
internal:
models:
llm:
model: ai/example
Loading