Skip to content

Commit

Permalink
Merge pull request #11211 from ndeloof/Services
Browse files Browse the repository at this point in the history
avoir use of []types.ServiceConfig
  • Loading branch information
glours authored Nov 21, 2023
2 parents f557220 + 5e77ae9 commit 0ab21a2
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/compose/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func TestFilterServices(t *testing.T) {
p := &types.Project{
Services: []types.ServiceConfig{
Services: types.Services{
{
Name: "foo",
Links: []string{"bar"},
Expand Down
6 changes: 3 additions & 3 deletions cmd/compose/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion cmd/compose/pullOptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/compose/up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func TestApplyScaleOpt(t *testing.T) {
p := types.Project{
Services: []types.ServiceConfig{
Services: types.Services{
{
Name: "foo",
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/compose/convergence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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},
Expand Down
4 changes: 2 additions & 2 deletions pkg/compose/dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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++ {
Expand Down
4 changes: 2 additions & 2 deletions pkg/compose/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/compose/viz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pkg/compose/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestWatch_Sync(t *testing.T) {
t.Cleanup(cancelFunc)

proj := types.Project{
Services: []types.ServiceConfig{
Services: types.Services{
{
Name: "test",
},
Expand Down

0 comments on commit 0ab21a2

Please sign in to comment.