mirror of https://github.com/docker/compose.git
avoir use of []types.ServiceConfig
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
f557220140
commit
5e77ae9247
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
func TestFilterServices(t *testing.T) {
|
||||
p := &types.Project{
|
||||
Services: []types.ServiceConfig{
|
||||
Services: types.Services{
|
||||
{
|
||||
Name: "foo",
|
||||
Links: []string{"bar"},
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
func TestApplyScaleOpt(t *testing.T) {
|
||||
p := types.Project{
|
||||
Services: []types.ServiceConfig{
|
||||
Services: types.Services{
|
||||
{
|
||||
Name: "foo",
|
||||
},
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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++ {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -105,7 +105,7 @@ func TestWatch_Sync(t *testing.T) {
|
|||
t.Cleanup(cancelFunc)
|
||||
|
||||
proj := types.Project{
|
||||
Services: []types.ServiceConfig{
|
||||
Services: types.Services{
|
||||
{
|
||||
Name: "test",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue