mirror of https://github.com/docker/compose.git
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
|
@ -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"
|
||||
)
|
||||
|
||||
const backendType = store.AciContextType
|
||||
|
||||
const (
|
||||
backendType = store.AciContextType
|
||||
singleContainerTag = "docker-single-container"
|
||||
composeContainerTag = "docker-compose-application"
|
||||
composeContainerSeparator = "_"
|
||||
|
|
|
@ -33,7 +33,7 @@ import (
|
|||
|
||||
type contextCreateACIHelper struct {
|
||||
selector prompt.UI
|
||||
resourceGroupHelper ACIResourceGroupHelper
|
||||
resourceGroupHelper ResourceGroupHelper
|
||||
}
|
||||
|
||||
func newContextCreateHelper() contextCreateACIHelper {
|
||||
|
|
|
@ -26,8 +26,8 @@ import (
|
|||
"github.com/docker/api/errdefs"
|
||||
)
|
||||
|
||||
// ACIResourceGroupHelper interface to manage resource groups and subscription IDs
|
||||
type ACIResourceGroupHelper interface {
|
||||
// ResourceGroupHelper interface to manage resource groups and subscription IDs
|
||||
type ResourceGroupHelper interface {
|
||||
GetSubscriptionIDs(ctx context.Context) ([]subscription.Model, error)
|
||||
ListGroups(ctx context.Context, subscriptionID 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 {
|
||||
}
|
||||
|
||||
// NewACIResourceGroupHelper create a new ACIResourceGroupHelper
|
||||
func NewACIResourceGroupHelper() ACIResourceGroupHelper {
|
||||
// NewACIResourceGroupHelper create a new ResourceGroupHelper
|
||||
func NewACIResourceGroupHelper() ResourceGroupHelper {
|
||||
return aciResourceGroupHelperImpl{}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
. "github.com/onsi/gomega"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/tests/framework"
|
||||
)
|
||||
|
||||
|
@ -14,9 +15,24 @@ type MobyExecSuite struct {
|
|||
}
|
||||
|
||||
func (sut *MobyExecSuite) TestDelegateContextTypeToMoby() {
|
||||
Expect(mustDelegateToMoby("moby")).To(BeTrue())
|
||||
Expect(mustDelegateToMoby("aws")).To(BeFalse())
|
||||
Expect(mustDelegateToMoby("aci")).To(BeFalse())
|
||||
|
||||
isDelegated := func(val string) bool {
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue