From 5e77ae924763062b4856aa204e39bb993b8de4b8 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 21 Nov 2023 12:06:46 +0100 Subject: [PATCH] avoir use of []types.ServiceConfig Signed-off-by: Nicolas De Loof --- cmd/compose/compose_test.go | 2 +- cmd/compose/options_test.go | 6 +++--- cmd/compose/pullOptions_test.go | 2 +- cmd/compose/up_test.go | 2 +- pkg/compose/convergence_test.go | 4 ++-- pkg/compose/dependencies_test.go | 4 ++-- pkg/compose/pull.go | 4 ++-- pkg/compose/viz_test.go | 2 +- pkg/compose/watch_test.go | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/compose/compose_test.go b/cmd/compose/compose_test.go index 1bbf4218..c999ab3d 100644 --- a/cmd/compose/compose_test.go +++ b/cmd/compose/compose_test.go @@ -25,7 +25,7 @@ import ( func TestFilterServices(t *testing.T) { p := &types.Project{ - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "foo", Links: []string{"bar"}, diff --git a/cmd/compose/options_test.go b/cmd/compose/options_test.go index 7ee5f4b9..66c72db7 100644 --- a/cmd/compose/options_test.go +++ b/cmd/compose/options_test.go @@ -26,7 +26,7 @@ import ( func TestApplyPlatforms_InferFromRuntime(t *testing.T) { makeProject := func() *types.Project { return &types.Project{ - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "test", Image: "foo", @@ -64,7 +64,7 @@ func TestApplyPlatforms_DockerDefaultPlatform(t *testing.T) { Environment: map[string]string{ "DOCKER_DEFAULT_PLATFORM": "linux/amd64", }, - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "test", Image: "foo", @@ -100,7 +100,7 @@ func TestApplyPlatforms_UnsupportedPlatform(t *testing.T) { Environment: map[string]string{ "DOCKER_DEFAULT_PLATFORM": "commodore/64", }, - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "test", Image: "foo", diff --git a/cmd/compose/pullOptions_test.go b/cmd/compose/pullOptions_test.go index db8c24a5..cb14c472 100644 --- a/cmd/compose/pullOptions_test.go +++ b/cmd/compose/pullOptions_test.go @@ -25,7 +25,7 @@ import ( func TestApplyPullOptions(t *testing.T) { project := &types.Project{ - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "must-build", // No image, local build only diff --git a/cmd/compose/up_test.go b/cmd/compose/up_test.go index ab1858e9..951b1189 100644 --- a/cmd/compose/up_test.go +++ b/cmd/compose/up_test.go @@ -25,7 +25,7 @@ import ( func TestApplyScaleOpt(t *testing.T) { p := types.Project{ - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "foo", }, diff --git a/pkg/compose/convergence_test.go b/pkg/compose/convergence_test.go index ebb904bd..260898c8 100644 --- a/pkg/compose/convergence_test.go +++ b/pkg/compose/convergence_test.go @@ -224,7 +224,7 @@ func TestWaitDependencies(t *testing.T) { t.Run("should skip dependencies with scale 0", func(t *testing.T) { dbService := types.ServiceConfig{Name: "db", Scale: 0} redisService := types.ServiceConfig{Name: "redis", Scale: 0} - project := types.Project{Name: strings.ToLower(testProject), Services: []types.ServiceConfig{dbService, redisService}} + project := types.Project{Name: strings.ToLower(testProject), Services: types.Services{dbService, redisService}} dependencies := types.DependsOnConfig{ "db": {Condition: ServiceConditionRunningOrHealthy}, "redis": {Condition: ServiceConditionRunningOrHealthy}, @@ -234,7 +234,7 @@ func TestWaitDependencies(t *testing.T) { t.Run("should skip dependencies with condition service_started", func(t *testing.T) { dbService := types.ServiceConfig{Name: "db", Scale: 1} redisService := types.ServiceConfig{Name: "redis", Scale: 1} - project := types.Project{Name: strings.ToLower(testProject), Services: []types.ServiceConfig{dbService, redisService}} + project := types.Project{Name: strings.ToLower(testProject), Services: types.Services{dbService, redisService}} dependencies := types.DependsOnConfig{ "db": {Condition: types.ServiceConditionStarted, Required: true}, "redis": {Condition: types.ServiceConditionStarted, Required: true}, diff --git a/pkg/compose/dependencies_test.go b/pkg/compose/dependencies_test.go index b668f4ad..a43b22e1 100644 --- a/pkg/compose/dependencies_test.go +++ b/pkg/compose/dependencies_test.go @@ -32,7 +32,7 @@ import ( func createTestProject() *types.Project { return &types.Project{ - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "test1", DependsOn: map[string]types.ServiceDependency{ @@ -59,7 +59,7 @@ func TestTraversalWithMultipleParents(t *testing.T) { } project := types.Project{ - Services: []types.ServiceConfig{dependent}, + Services: types.Services{dependent}, } for i := 1; i <= 100; i++ { diff --git a/pkg/compose/pull.go b/pkg/compose/pull.go index 247be85a..75fd3375 100644 --- a/pkg/compose/pull.go +++ b/pkg/compose/pull.go @@ -260,7 +260,7 @@ func encodedAuth(ref reference.Named, configFile driver.Auth) (string, error) { } func (s *composeService) pullRequiredImages(ctx context.Context, project *types.Project, images map[string]string, quietPull bool) error { - var needPull []types.ServiceConfig + var needPull types.Services for _, service := range project.Services { if service.Image == "" { continue @@ -308,7 +308,7 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types. }, s.stdinfo()) } -func isServiceImageToBuild(service types.ServiceConfig, services []types.ServiceConfig) bool { +func isServiceImageToBuild(service types.ServiceConfig, services types.Services) bool { if service.Build != nil { return true } diff --git a/pkg/compose/viz_test.go b/pkg/compose/viz_test.go index cf9452c5..9e5fb731 100644 --- a/pkg/compose/viz_test.go +++ b/pkg/compose/viz_test.go @@ -33,7 +33,7 @@ func TestViz(t *testing.T) { project := types.Project{ Name: "viz-test", WorkingDir: "/home", - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "service1", Image: "image-for-service1", diff --git a/pkg/compose/watch_test.go b/pkg/compose/watch_test.go index 678a2ef8..4f8d674d 100644 --- a/pkg/compose/watch_test.go +++ b/pkg/compose/watch_test.go @@ -105,7 +105,7 @@ func TestWatch_Sync(t *testing.T) { t.Cleanup(cancelFunc) proj := types.Project{ - Services: []types.ServiceConfig{ + Services: types.Services{ { Name: "test", },