Fix typo (and refactor the method name)

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Ulysses Souza 2020-05-18 14:56:32 +02:00
parent 7cbbab1739
commit 872e81862a
2 changed files with 6 additions and 6 deletions

View File

@ -177,7 +177,7 @@ func (cs *aciContainerService) Run(ctx context.Context, r containers.ContainerCo
return createACIContainers(ctx, cs.ctx, groupDefinition)
}
func getGrouNameContainername(containerID string) (groupName string, containerName string) {
func getGroupAndContainerName(containerID string) (groupName string, containerName string) {
tokens := strings.Split(containerID, "_")
groupName = tokens[0]
if len(tokens) > 1 {
@ -190,7 +190,7 @@ func getGrouNameContainername(containerID string) (groupName string, containerNa
}
func (cs *aciContainerService) Exec(ctx context.Context, name string, command string, reader io.Reader, writer io.Writer) error {
groupName, containerAciName := getGrouNameContainername(name)
groupName, containerAciName := getGroupAndContainerName(name)
containerExecResponse, err := execACIContainer(ctx, cs.ctx, command, groupName, containerAciName)
if err != nil {
return err
@ -206,7 +206,7 @@ func (cs *aciContainerService) Exec(ctx context.Context, name string, command st
}
func (cs *aciContainerService) Logs(ctx context.Context, containerName string, req containers.LogsRequest) error {
groupName, containerAciName := getGrouNameContainername(containerName)
groupName, containerAciName := getGroupAndContainerName(containerName)
logs, err := getACIContainerLogs(ctx, cs.ctx, groupName, containerAciName)
if err != nil {
return err

View File

@ -10,15 +10,15 @@ import (
func TestGetContainerName(t *testing.T) {
RegisterTestingT(t)
group, container := getGrouNameContainername("docker1234")
group, container := getGroupAndContainerName("docker1234")
Expect(group).To(Equal("docker1234"))
Expect(container).To(Equal(singleContainerName))
group, container = getGrouNameContainername("compose_service1")
group, container = getGroupAndContainerName("compose_service1")
Expect(group).To(Equal("compose"))
Expect(container).To(Equal("service1"))
group, container = getGrouNameContainername("compose_stack_service1")
group, container = getGroupAndContainerName("compose_stack_service1")
Expect(group).To(Equal("compose_stack"))
Expect(container).To(Equal("service1"))
}