Add Server.Version and cmd/client test code
Signed-off-by: Haiyan Meng <hmeng@redhat.com>
This commit is contained in:
parent
0fc314456a
commit
5c4a79543f
20 changed files with 4643 additions and 3 deletions
27
server/utils.go
Normal file
27
server/utils.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func getGPRCVersion() (string, error) {
|
||||
_, file, _, ok := runtime.Caller(0)
|
||||
if !ok {
|
||||
return "", errors.New("Failed to recover the caller information.")
|
||||
}
|
||||
|
||||
ocidRoot := filepath.Dir(filepath.Dir(file))
|
||||
p := filepath.Join(ocidRoot, "Godeps/Godeps.json")
|
||||
|
||||
grepCmd := fmt.Sprintf(`grep -r "\"google.golang.org/grpc\"" %s -A 1 | grep "\"Rev\"" | cut -d: -f2 | tr -d ' "\n'`, p)
|
||||
|
||||
out, err := execCmd("bash", "-c", grepCmd)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue