mirror of
https://github.com/docker/compose.git
synced 2025-07-28 16:14:06 +02:00
update delegation test to check all context types
Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
parent
87245ef727
commit
5f7c284d58
19
.vscode/launch.json
vendored
19
.vscode/launch.json
vendored
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Launch",
|
|
||||||
"type": "go",
|
|
||||||
"request": "launch",
|
|
||||||
"mode": "auto",
|
|
||||||
"program": "${workspaceRoot}/cli/main.go",
|
|
||||||
"env": {},
|
|
||||||
"cwd": "${workspaceRoot}/test/",
|
|
||||||
//"args": ["context", "create", "aws", "ecs", --profile", "sandbox.devtools.developer", "--region", "eu-west-3", "--description", "My ECS account"]
|
|
||||||
"args":["compose", "up"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -41,9 +41,8 @@ import (
|
|||||||
"github.com/docker/api/errdefs"
|
"github.com/docker/api/errdefs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const backendType = store.AciContextType
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
backendType = store.AciContextType
|
||||||
singleContainerTag = "docker-single-container"
|
singleContainerTag = "docker-single-container"
|
||||||
composeContainerTag = "docker-compose-application"
|
composeContainerTag = "docker-compose-application"
|
||||||
composeContainerSeparator = "_"
|
composeContainerSeparator = "_"
|
||||||
|
@ -33,7 +33,7 @@ import (
|
|||||||
|
|
||||||
type contextCreateACIHelper struct {
|
type contextCreateACIHelper struct {
|
||||||
selector prompt.UI
|
selector prompt.UI
|
||||||
resourceGroupHelper ACIResourceGroupHelper
|
resourceGroupHelper ResourceGroupHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
func newContextCreateHelper() contextCreateACIHelper {
|
func newContextCreateHelper() contextCreateACIHelper {
|
||||||
|
@ -26,8 +26,8 @@ import (
|
|||||||
"github.com/docker/api/errdefs"
|
"github.com/docker/api/errdefs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ACIResourceGroupHelper interface to manage resource groups and subscription IDs
|
// ResourceGroupHelper interface to manage resource groups and subscription IDs
|
||||||
type ACIResourceGroupHelper interface {
|
type ResourceGroupHelper interface {
|
||||||
GetSubscriptionIDs(ctx context.Context) ([]subscription.Model, error)
|
GetSubscriptionIDs(ctx context.Context) ([]subscription.Model, error)
|
||||||
ListGroups(ctx context.Context, subscriptionID string) ([]resources.Group, error)
|
ListGroups(ctx context.Context, subscriptionID string) ([]resources.Group, error)
|
||||||
GetGroup(ctx context.Context, subscriptionID string, groupName string) (resources.Group, error)
|
GetGroup(ctx context.Context, subscriptionID string, groupName string) (resources.Group, error)
|
||||||
@ -38,8 +38,8 @@ type ACIResourceGroupHelper interface {
|
|||||||
type aciResourceGroupHelperImpl struct {
|
type aciResourceGroupHelperImpl struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewACIResourceGroupHelper create a new ACIResourceGroupHelper
|
// NewACIResourceGroupHelper create a new ResourceGroupHelper
|
||||||
func NewACIResourceGroupHelper() ACIResourceGroupHelper {
|
func NewACIResourceGroupHelper() ResourceGroupHelper {
|
||||||
return aciResourceGroupHelperImpl{}
|
return aciResourceGroupHelperImpl{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/docker/api/context/store"
|
||||||
"github.com/docker/api/tests/framework"
|
"github.com/docker/api/tests/framework"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,9 +15,24 @@ type MobyExecSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sut *MobyExecSuite) TestDelegateContextTypeToMoby() {
|
func (sut *MobyExecSuite) TestDelegateContextTypeToMoby() {
|
||||||
Expect(mustDelegateToMoby("moby")).To(BeTrue())
|
|
||||||
Expect(mustDelegateToMoby("aws")).To(BeFalse())
|
isDelegated := func(val string) bool {
|
||||||
Expect(mustDelegateToMoby("aci")).To(BeFalse())
|
for _, ctx := range delegatedContextTypes {
|
||||||
|
if ctx == val {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
allCtx := []string{store.AciContextType, store.EcsContextType, store.AwsContextType, store.DefaultContextType}
|
||||||
|
for _, ctx := range allCtx {
|
||||||
|
if isDelegated(ctx) {
|
||||||
|
Expect(mustDelegateToMoby(ctx)).To(BeTrue())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
Expect(mustDelegateToMoby(ctx)).To(BeFalse())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExec(t *testing.T) {
|
func TestExec(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user