Skip to content

Commit

Permalink
aeon: added the ability to connect from the config
Browse files Browse the repository at this point in the history
Closes #TNTP-1073
  • Loading branch information
AlexandrLitkevich committed Feb 1, 2025
1 parent 5a3a88e commit 47a20b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion cli/aeon/cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ type ConnectCtx struct {
Network string
// Address is a connection URL, unix socket address and etc.
Address string

}
8 changes: 3 additions & 5 deletions cli/cmd/aeon.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"encoding/json"
"errors"
"fmt"
"os"
Expand All @@ -28,7 +27,6 @@ var connectCtx = aeoncmd.ConnectCtx{
Transport: aeoncmd.TransportPlain,
}

// Определяем переменные для флагов
var configPath string
var instance string

Expand All @@ -38,7 +36,8 @@ func newAeonConnectCmd() *cobra.Command {
Short: "Connect to the aeon instance",
Long: `Connect to the aeon instance.
tt aeon connect localhost:50051
tt aeon connect unix://<socket-path>`,
tt aeon connect unix://<socket-path>
tt aeon connect -c path instanceName>`,
PreRunE: func(cmd *cobra.Command, args []string) error {
err := aeonConnectValidateArgs(cmd, args)
util.HandleCmdErr(cmd, err)
Expand All @@ -50,7 +49,6 @@ tt aeon connect unix://<socket-path>`,
internalAeonConnect, args)
util.HandleCmdErr(cmd, err)
},
// Args: cobra.ExactArgs(1),
}

aeonCmd.Flags().StringVar(&connectCtx.Ssl.KeyFile, "sslkeyfile", "",
Expand Down Expand Up @@ -120,7 +118,7 @@ func aeonConnectValidateArgs(cmd *cobra.Command, args []string) error {

us, ok := uri.(string)
if !ok {
return fmt.Errorf("fail to conver string")
return fmt.Errorf("it is impossible to result in a string")
}

re := regexp.MustCompile("^https?://")
Expand Down
6 changes: 1 addition & 5 deletions test/integration/aeon/test_aeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ def test_cli_ssl_arguments_success(tt_cmd, aeon_ssl, certificates):
@pytest.mark.parametrize(
"args, error",
[
((), "Error: accepts 1 arg(s), received 0"),
(
("localhost:50051", "@aeon_unix_socket"),
"Error: accepts 1 arg(s), received 2",
),
(
(
"--transport",
Expand Down Expand Up @@ -184,6 +179,7 @@ def test_cli_ssl_arguments_success(tt_cmd, aeon_ssl, certificates):
),
],
)

def test_cli_arguments_fail(tt_cmd, certificates, args, error):
cmd = [str(tt_cmd), *AeonConnectCommand]
cmd += (a.format(**certificates) for a in args)
Expand Down

0 comments on commit 47a20b7

Please sign in to comment.