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

triple test #2391

Closed
wants to merge 1 commit into from
Closed

triple test #2391

wants to merge 1 commit into from

Conversation

Axkea
Copy link
Contributor

@Axkea Axkea commented Aug 22, 2023

Unit testing of the triple protocol is completed

@sonarcloud
Copy link

sonarcloud bot commented Aug 22, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@DMwangnima DMwangnima left a comment

Choose a reason for hiding this comment

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

Please do not modify any files other than /protocol/triple

@Axkea
Copy link
Contributor Author

Axkea commented Aug 22, 2023

The rest of these changes appear to be ide one-click changes. I would pull it back, make changes in the specified package, and then remove the unused code

@Axkea Axkea closed this by deleting the head repository Aug 23, 2023
// *http.Client!
var httpClient = examplePingServer.Client()

// By default, clients use the Connect protocol. Add triple.WithGRPC() or
Copy link
Contributor

Choose a reason for hiding this comment

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

By default, clients use the Triple protocol.

examplePingServer.URL(),
)
response := tri.NewResponse(&pingv1.PingResponse{})
err := client.Ping(
Copy link
Contributor

Choose a reason for hiding this comment

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

if err := client.Ping... err != nil
There is no need to declare a var in the func scope when it would not be used anymore.

validateExpectedError := func(t *testing.T, err error) {
t.Helper()
assert.NotNil(t, err)
var connectErr *triple.Error
Copy link
Contributor

Choose a reason for hiding this comment

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

var tripleErr *triple.Error

)
ctx := context.Background()
// unary
//err := client.Ping(ctx, triple.NewRequest(nil), triple.NewResponse(&pingv1.PingResponse{}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Please think about this case.

//assert.Nil(t, err)
text := strings.Repeat(".", 256)
msg := &pingv1.PingResponse{}
err1 := client.Ping(ctx, triple.NewRequest(&pingv1.PingRequest{Text: text}), triple.NewResponse(msg))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use err.

res := NewResponse(pingv1.PingResponse{})
assert.True(t, stream.Receive(res))
first := fmt.Sprintf("%p", stream.Msg())
res1 := NewResponse(pingv1.PingResponse{})
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto.

func TestServerStreamForClient(t *testing.T) {
t.Parallel()
stream := &ServerStreamForClient{conn: &nopStreamingClientConn{}}
// Ensure that each call to Receive allocates a new message. This helps
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this comment cause it has nothing to do with triple.

bidiStream := &BidiStreamForClient{err: initErr}
res := NewResponse(pingv1.CumSumResponse{})
err := bidiStream.Receive(res)
//assert.Nil(t, res)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this statement.

t.Parallel()
initErr := errors.New("client init failure")
bidiStream := &BidiStreamForClient{err: initErr}
res := NewResponse(pingv1.CumSumResponse{})
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto.

@@ -220,7 +220,7 @@ func (m *codecMap) Names() []string {

func errNotProto(message any) error {
if _, ok := message.(protoiface.MessageV1); ok {
return fmt.Errorf("%T uses github.com/golang/protobuf, but connect-go only supports google.golang.org/protobuf: see https://go.dev/blog/protobuf-apiv2", message)
return fmt.Errorf("%T uses github.com/golang/protobuf, but triple-go only supports google.golang.org/protobuf: see https://go.dev/blog/protobuf-apiv2", message)
Copy link
Contributor

Choose a reason for hiding this comment

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

use triple not triple-go

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

Successfully merging this pull request may close these issues.

2 participants