Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aeon: connect implementation #1065

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dmyger
Copy link
Collaborator

@dmyger dmyger commented Dec 12, 2024

Mock server Implement some base methods for integration tests.

Part of #1050

@oleg-jukovec oleg-jukovec marked this pull request as draft December 13, 2024 10:13
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch from e743db4 to 4e6f784 Compare December 13, 2024 11:31
@dmyger dmyger force-pushed the dmyger/gh-1048-aeon-connect-dummy-implementation branch from ba43ee0 to 7c44fea Compare December 13, 2024 12:49
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch from 4e6f784 to 90c3018 Compare December 13, 2024 12:51
@dmyger dmyger force-pushed the dmyger/gh-1048-aeon-connect-dummy-implementation branch from 7c44fea to 6f2cdc8 Compare December 13, 2024 13:08
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch from 90c3018 to f6a666b Compare December 13, 2024 13:09
Base automatically changed from dmyger/gh-1048-aeon-connect-dummy-implementation to master December 16, 2024 07:02
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch 10 times, most recently from 8a3c46a to 4151819 Compare December 23, 2024 15:07
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch 2 times, most recently from 75ee5c5 to 81f879f Compare December 26, 2024 13:26
@oleg-jukovec oleg-jukovec added the full-ci Enables full ci tests label Dec 27, 2024
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch from 81f879f to 243e95c Compare December 27, 2024 13:46
@dmyger dmyger marked this pull request as ready for review December 27, 2024 13:47
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch 3 times, most recently from 40a246a to b09a2db Compare December 27, 2024 16:45
@dmyger dmyger removed the full-ci Enables full ci tests label Dec 27, 2024
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch 2 times, most recently from 903da6a to 543f89a Compare December 27, 2024 16:53
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch 5 times, most recently from 9890383 to 84a305e Compare December 27, 2024 18:07
Mock server Implement some base methods for integration tests.

Part of #1050, #1049
The ‘Console’ module has been separate from the ‘Connect’ abstraction,
to allow it being used independently of the transport layer.

Part of #1050
Update aeon-api-protos module and adjust code for it requirements.
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch from 84a305e to 75fc2c9 Compare December 28, 2024 12:29
@dmyger dmyger added the full-ci Enables full ci tests label Dec 28, 2024
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch from 75fc2c9 to 344b475 Compare December 28, 2024 12:39
prepare-[ce|ee]-test-env - fixed preparing test requirements.
static-code-check - removed extra steps what was did on previous steps.

Changes are needed to adjust the CI/CD settings to match
their step name. Which in turn allows you to properly manage the order
of actions during the build testing.
@dmyger dmyger force-pushed the dmyger/gh-1050-aeon-connect-implementation branch from 344b475 to 3cc50af Compare December 28, 2024 12:40
[submodule "cli/aeon/protos"]
path = cli/aeon/protos
url = [email protected]:tarantool/aeon-api-protos.git
branch = master
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify a branch here? Or just a commit would be enough.

@@ -16,4 +16,8 @@ type ConnectCtx struct {
Ssl Ssl
// Transport is a connection mode.
Transport Transport
// Network is kind of transport layer.
Network string
// Address is a connection Url, unix socket address and etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Address is a connection Url, unix socket address and etc.
// Address is a connection URL, unix socket address and etc.

Comment on lines +13 to +19
if [ ! -x "$(command -v protoc-gen-go)" ]; then
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
fi

if [ ! -x "$(command -v protoc-gen-go-grpc)" ]; then
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not install it automatically. It's better to add requirements here:
https://github.com/tarantool/tt?tab=readme-ov-file#build-from-source

And install it by mage (I'm not sure about the current approach) or on CI manually.

Suggested change
if [ ! -x "$(command -v protoc-gen-go)" ]; then
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
fi
if [ ! -x "$(command -v protoc-gen-go-grpc)" ]; then
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
fi
if [ ! -x "$(command -v protoc-gen-go)" ]; then
echo "foo"
exit 1
fi
if [ ! -x "$(command -v protoc-gen-go-grpc)" ]; then
echo "foo"
exit 1
fi

it also a good idea to add a target into magefile.go to generate the code or update a some exists target.

Motivation: it's a bad idea to install some software for a user in a background.

IP = 127.0.0.1
EOF

### Server .key&.crt and ca.crt required for Server-Side TLS mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Server .key&.crt and ca.crt required for Server-Side TLS mode.
### Server .key.crt and ca.crt required for Server-Side TLS mode.

Comment on lines +64 to +74
func getTlsConfig(args cmd.Ssl) *tls.Config {
if args.CaFile == "" {
return &tls.Config{
ClientAuth: tls.NoClientCert,
}
}

ca, err := os.ReadFile(args.CaFile)
if err != nil {
log.Fatalf("Failed to read CA file: %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, avoid an error processing in that manner:

  1. It is harder to test.
  2. It is harder to understand which parts of the code may result an error.
Suggested change
func getTlsConfig(args cmd.Ssl) *tls.Config {
if args.CaFile == "" {
return &tls.Config{
ClientAuth: tls.NoClientCert,
}
}
ca, err := os.ReadFile(args.CaFile)
if err != nil {
log.Fatalf("Failed to read CA file: %v", err)
}
func getTlsConfig(args cmd.Ssl) (*tls.Config, error) {
if args.CaFile == "" {
return &tls.Config{
ClientAuth: tls.NoClientCert,
}
}
ca, err := os.ReadFile(args.CaFile)
if err != nil {
fmt.Errorf("Failed to read CA file: %w", err)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add tests.

Comment on lines +5 to +23
// Handler is a auxiliary abstraction to isolate the console from
// the implementation of a particular instruction processor.
type Handler interface {
// Title return name of instruction processor instance.
Title() string

// Validate the input string.
Validate(input string) bool

// Complete checks the input and return available variants to continue typing.
Complete(input prompt.Document) []prompt.Suggest

// Execute accept input to perform actions defined by client implementation.
// Expecting that result type implements Formatter interface.
Execute(input string) any

// Close notify handler to terminate execution and close any opened streams.
Close()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Handler is a auxiliary abstraction to isolate the console from
// the implementation of a particular instruction processor.
type Handler interface {
// Title return name of instruction processor instance.
Title() string
// Validate the input string.
Validate(input string) bool
// Complete checks the input and return available variants to continue typing.
Complete(input prompt.Document) []prompt.Suggest
// Execute accept input to perform actions defined by client implementation.
// Expecting that result type implements Formatter interface.
Execute(input string) any
// Close notify handler to terminate execution and close any opened streams.
Close()
}
// Handler is a auxiliary abstraction to isolate the console from
// the implementation of a particular instruction processor.
type Handler interface {
// Title return name of instruction processor instance.
Title() string
// Validate the input string.
Validate(input string) bool
// Complete checks the input and return available variants to continue typing.
Complete(input prompt.Document) []prompt.Suggest
// Execute accept input to perform actions defined by client implementation.
// Expecting that result type implements Formatter interface.
Execute(input string) any
// Close notify handler to terminate execution and close any opened streams.
Close()
}

Complete(input prompt.Document) []prompt.Suggest

// Execute accept input to perform actions defined by client implementation.
// Expecting that result type implements Formatter interface.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why does it return any?

Comment on lines +16 to +21
const (
DefaultHistoryFileName = ".tarantool_history"
DefaultHistoryLines = 10000
)

type History struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And missed tests.

@oleg-jukovec
Copy link
Contributor

Please, add a CHANGELOG.md entry and a TarantoolBot comment too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-ci Enables full ci tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants