mirror of https://github.com/docker/compose.git
Merge pull request #11211 from ndeloof/Services
avoir use of []types.ServiceConfig
This commit is contained in:
commit
0ab21a2080
|
@ -25,7 +25,7 @@ import (
|
||||||
|
|
||||||
func TestFilterServices(t *testing.T) {
|
func TestFilterServices(t *testing.T) {
|
||||||
p := &types.Project{
|
p := &types.Project{
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Links: []string{"bar"},
|
Links: []string{"bar"},
|
||||||
|
|
|
@ -26,7 +26,7 @@ import (
|
||||||
func TestApplyPlatforms_InferFromRuntime(t *testing.T) {
|
func TestApplyPlatforms_InferFromRuntime(t *testing.T) {
|
||||||
makeProject := func() *types.Project {
|
makeProject := func() *types.Project {
|
||||||
return &types.Project{
|
return &types.Project{
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Image: "foo",
|
Image: "foo",
|
||||||
|
@ -64,7 +64,7 @@ func TestApplyPlatforms_DockerDefaultPlatform(t *testing.T) {
|
||||||
Environment: map[string]string{
|
Environment: map[string]string{
|
||||||
"DOCKER_DEFAULT_PLATFORM": "linux/amd64",
|
"DOCKER_DEFAULT_PLATFORM": "linux/amd64",
|
||||||
},
|
},
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Image: "foo",
|
Image: "foo",
|
||||||
|
@ -100,7 +100,7 @@ func TestApplyPlatforms_UnsupportedPlatform(t *testing.T) {
|
||||||
Environment: map[string]string{
|
Environment: map[string]string{
|
||||||
"DOCKER_DEFAULT_PLATFORM": "commodore/64",
|
"DOCKER_DEFAULT_PLATFORM": "commodore/64",
|
||||||
},
|
},
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Image: "foo",
|
Image: "foo",
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
|
|
||||||
func TestApplyPullOptions(t *testing.T) {
|
func TestApplyPullOptions(t *testing.T) {
|
||||||
project := &types.Project{
|
project := &types.Project{
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "must-build",
|
Name: "must-build",
|
||||||
// No image, local build only
|
// No image, local build only
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
|
|
||||||
func TestApplyScaleOpt(t *testing.T) {
|
func TestApplyScaleOpt(t *testing.T) {
|
||||||
p := types.Project{
|
p := types.Project{
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
},
|
},
|
||||||
|
|
|
@ -224,7 +224,7 @@ func TestWaitDependencies(t *testing.T) {
|
||||||
t.Run("should skip dependencies with scale 0", func(t *testing.T) {
|
t.Run("should skip dependencies with scale 0", func(t *testing.T) {
|
||||||
dbService := types.ServiceConfig{Name: "db", Scale: 0}
|
dbService := types.ServiceConfig{Name: "db", Scale: 0}
|
||||||
redisService := types.ServiceConfig{Name: "redis", 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{
|
dependencies := types.DependsOnConfig{
|
||||||
"db": {Condition: ServiceConditionRunningOrHealthy},
|
"db": {Condition: ServiceConditionRunningOrHealthy},
|
||||||
"redis": {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) {
|
t.Run("should skip dependencies with condition service_started", func(t *testing.T) {
|
||||||
dbService := types.ServiceConfig{Name: "db", Scale: 1}
|
dbService := types.ServiceConfig{Name: "db", Scale: 1}
|
||||||
redisService := types.ServiceConfig{Name: "redis", 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{
|
dependencies := types.DependsOnConfig{
|
||||||
"db": {Condition: types.ServiceConditionStarted, Required: true},
|
"db": {Condition: types.ServiceConditionStarted, Required: true},
|
||||||
"redis": {Condition: types.ServiceConditionStarted, Required: true},
|
"redis": {Condition: types.ServiceConditionStarted, Required: true},
|
||||||
|
|
|
@ -32,7 +32,7 @@ import (
|
||||||
|
|
||||||
func createTestProject() *types.Project {
|
func createTestProject() *types.Project {
|
||||||
return &types.Project{
|
return &types.Project{
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "test1",
|
Name: "test1",
|
||||||
DependsOn: map[string]types.ServiceDependency{
|
DependsOn: map[string]types.ServiceDependency{
|
||||||
|
@ -59,7 +59,7 @@ func TestTraversalWithMultipleParents(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
project := types.Project{
|
project := types.Project{
|
||||||
Services: []types.ServiceConfig{dependent},
|
Services: types.Services{dependent},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 1; i <= 100; i++ {
|
for i := 1; i <= 100; i++ {
|
||||||
|
|
|
@ -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 {
|
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 {
|
for _, service := range project.Services {
|
||||||
if service.Image == "" {
|
if service.Image == "" {
|
||||||
continue
|
continue
|
||||||
|
@ -308,7 +308,7 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
|
||||||
}, s.stdinfo())
|
}, s.stdinfo())
|
||||||
}
|
}
|
||||||
|
|
||||||
func isServiceImageToBuild(service types.ServiceConfig, services []types.ServiceConfig) bool {
|
func isServiceImageToBuild(service types.ServiceConfig, services types.Services) bool {
|
||||||
if service.Build != nil {
|
if service.Build != nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ func TestViz(t *testing.T) {
|
||||||
project := types.Project{
|
project := types.Project{
|
||||||
Name: "viz-test",
|
Name: "viz-test",
|
||||||
WorkingDir: "/home",
|
WorkingDir: "/home",
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "service1",
|
Name: "service1",
|
||||||
Image: "image-for-service1",
|
Image: "image-for-service1",
|
||||||
|
|
|
@ -105,7 +105,7 @@ func TestWatch_Sync(t *testing.T) {
|
||||||
t.Cleanup(cancelFunc)
|
t.Cleanup(cancelFunc)
|
||||||
|
|
||||||
proj := types.Project{
|
proj := types.Project{
|
||||||
Services: []types.ServiceConfig{
|
Services: types.Services{
|
||||||
{
|
{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue