compose/internal/progress/progress_test.go
Nicolas De Loof 89ff984452 refactor(relay): move the provider relay management to internal/relay
The relay container and the relay link networks that stand in for a
provider service need three things from the engine: the Docker API, the
event bus and whether Docker Desktop is the engine.

They now live in internal/relay behind a Backend interface that
composeService implements in pkg/compose/relay.go, which keeps the names
the lifecycle code calls (ensureServiceRelay, isRelayContainer,
checkRelayTarget...) as one-line forwarders, so none of its callers change.
The one down-specific piece, turning the relay link networks into down
operations gated on the shared limiter, stays in pkg/compose together with
its tests; the other relay tests move with the code, assertions unchanged.

The progress events and the container name the package needs come from two
small shared packages, internal/progress and internal/naming, which the
following moves reuse. pkg/compose keeps its own copies until the shared
kernel is extracted.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 09:10:05 +02:00

35 lines
1.5 KiB
Go

/*
Copyright 2020 Docker Compose CLI authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package progress
import (
"testing"
"gotest.tools/v3/assert"
"github.com/docker/compose/v5/pkg/api"
)
func TestEvents(t *testing.T) {
assert.DeepEqual(t, Creating("web"), api.Resource{ID: "web", Status: api.Working, Text: api.StatusCreating})
assert.DeepEqual(t, Created("web"), api.Resource{ID: "web", Status: api.Done, Text: api.StatusCreated})
assert.DeepEqual(t, Removing("web"), api.Resource{ID: "web", Status: api.Working, Text: api.StatusRemoving})
assert.DeepEqual(t, Removed("web"), api.Resource{ID: "web", Status: api.Done, Text: api.StatusRemoved})
assert.DeepEqual(t, Error("web", "boom"), api.Resource{ID: "web", Status: api.Error, Text: api.StatusError, Details: "boom"})
assert.DeepEqual(t, New("web", api.Warning, "Skipped", "why"), api.Resource{ID: "web", Status: api.Warning, Text: "Skipped", Details: "why"})
assert.DeepEqual(t, New("web", api.Warning, "Skipped"), api.Resource{ID: "web", Status: api.Warning, Text: "Skipped"})
}