SEBA-688 implement mock gRPC server and unit test the version command
Change-Id: Ia10a8ea5b00ce5d5100f8fffbefba96f234d4b32
diff --git a/commands/version.go b/commands/version.go
index 1941589..38d2f7a 100644
--- a/commands/version.go
+++ b/commands/version.go
@@ -101,26 +101,20 @@
const DefaultFormat = ClientFormat + ServerFormat
func (options *VersionOpts) Execute(args []string) error {
-
if !options.ClientOnly {
- conn, err := NewConnection()
+ conn, descriptor, err := InitReflectionClient()
if err != nil {
return err
}
defer conn.Close()
- descriptor, method, err := GetReflectionMethod(conn, "xos.utility.GetVersion")
- if err != nil {
- return err
- }
-
ctx, cancel := context.WithTimeout(context.Background(), GlobalConfig.Grpc.Timeout)
defer cancel()
headers := GenerateHeaders()
h := &RpcEventHandler{}
- err = grpcurl.InvokeRPC(ctx, descriptor, conn, method, headers, h, h.GetParams)
+ err = grpcurl.InvokeRPC(ctx, descriptor, conn, "xos.utility.GetVersion", headers, h, h.GetParams)
if err != nil {
return err
}