github.com/TeaOSLab/EdgeNode@v1.3.8/internal/monitor/value_queue_test.go (about)

     1  // Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
     2  
     3  package monitor
     4  
     5  import (
     6  	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
     7  	"github.com/TeaOSLab/EdgeNode/internal/rpc"
     8  	"github.com/TeaOSLab/EdgeNode/internal/utils/testutils"
     9  	_ "github.com/iwind/TeaGo/bootstrap"
    10  	"github.com/iwind/TeaGo/logs"
    11  	"google.golang.org/grpc/status"
    12  	"testing"
    13  )
    14  
    15  func TestValueQueue_RPC(t *testing.T) {
    16  	if !testutils.IsSingleTesting() {
    17  		return
    18  	}
    19  
    20  	rpcClient, err := rpc.SharedRPC()
    21  	if err != nil {
    22  		t.Fatal(err)
    23  	}
    24  	_, err = rpcClient.NodeValueRPC.CreateNodeValue(rpcClient.Context(), &pb.CreateNodeValueRequest{})
    25  	if err != nil {
    26  		statusErr, ok := status.FromError(err)
    27  		if ok {
    28  			logs.Println(statusErr.Code())
    29  		}
    30  		t.Fatal(err)
    31  	}
    32  	t.Log("ok")
    33  }