move compose API into pkg/api

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-06-14 16:26:14 +02:00
parent a29d3e6f80
commit d90495e1cd
133 changed files with 864 additions and 893 deletions

View file

@ -29,9 +29,7 @@ import (
"gotest.tools/v3/assert"
"github.com/docker/compose-cli/api/client"
"github.com/docker/compose-cli/api/compose"
"github.com/docker/compose-cli/api/containers"
"github.com/docker/compose-cli/api/errdefs"
"github.com/docker/compose-cli/api/secrets"
"github.com/docker/compose-cli/api/volumes"
"github.com/docker/compose-cli/cli/metrics"
@ -40,6 +38,7 @@ import (
streamsv1 "github.com/docker/compose-cli/cli/server/protos/streams/v1"
volumesv1 "github.com/docker/compose-cli/cli/server/protos/volumes/v1"
"github.com/docker/compose-cli/cli/server/proxy"
"github.com/docker/compose-cli/pkg/api"
)
func TestAllMethodsHaveCorrespondingCliCommand(t *testing.T) {
@ -77,8 +76,8 @@ func TestTrackSFailures(t *testing.T) {
interceptor := metricsServerInterceptor(mockMetrics)
ctx := proxy.WithClient(incomingContext("default"), &newClient)
_, err := interceptor(ctx, nil, containerMethodRoute("Create"), mockHandler(errdefs.ErrLoginRequired))
assert.Assert(t, err == errdefs.ErrLoginRequired)
_, err := interceptor(ctx, nil, containerMethodRoute("Create"), mockHandler(api.ErrLoginRequired))
assert.Assert(t, err == api.ErrLoginRequired)
}
func containerMethodRoute(action string) *grpc.UnaryServerInfo {
@ -115,7 +114,7 @@ func setupServer() *grpc.Server {
type noopService struct{}
func (noopService) ContainerService() containers.Service { return nil }
func (noopService) ComposeService() compose.Service { return nil }
func (noopService) ComposeService() api.Service { return nil }
func (noopService) SecretsService() secrets.Service { return nil }
func (noopService) VolumeService() volumes.Service { return nil }
func (noopService) ResourceService() resources.Service { return nil }