mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-24 15:30:24 +08:00
阶段性提交
This commit is contained in:
@@ -3,9 +3,9 @@ package tests
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
pb2 "github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/rpc/services"
|
||||
pb "github.com/TeaOSLab/EdgeAPI/internal/tests/helloworld"
|
||||
pb2 "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/metadata"
|
||||
@@ -75,30 +75,6 @@ func TestTCPClient(t *testing.T) {
|
||||
t.Log(time.Since(before).Seconds()*1000, "ms")
|
||||
}
|
||||
|
||||
func TestTCPClient_Node(t *testing.T) {
|
||||
conn, err := grpc.Dial("127.0.0.1:8001", grpc.WithInsecure())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
_ = conn.Close()
|
||||
}()
|
||||
|
||||
c := pb2.NewNodeServiceClient(conn)
|
||||
|
||||
before := time.Now()
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = metadata.AppendToOutgoingContext(ctx, "name", "liu", "age", "20")
|
||||
reply, err := c.Config(ctx, &pb2.ConfigRequest{
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(reply)
|
||||
t.Log(time.Since(before).Seconds()*1000, "ms")
|
||||
}
|
||||
|
||||
func TestTLSServer(t *testing.T) {
|
||||
listener, err := net.Listen("tcp", ":8001")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user