@cryptotaxi247 / kubo / commits / 1cef17024

add small sharness test to make sure output happens

License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>

Jeromy committed Oct 14, 2015 at 14:41 UTC 1cef170243b6a23bf23b5fc646fb738321169c46
2 files changed +50
core/commands/sysdiag.go
+3
@@ -6,6 +6,7 @@ import (
6 "runtime"
7
8 cmds "github.com/ipfs/go-ipfs/commands"
9 + config "github.com/ipfs/go-ipfs/repo/config"
10
11 manet "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
12 psud "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/shirou/gopsutil/disk"
@@ -51,6 +52,8 @@ Prints out information about your computer to aid in easier debugging.
52 return
53 }
54
55 + info["ipfs_version"] = config.CurrentVersionNumber
56 + info["ipfs_git_sha"] = config.CurrentCommit
57 res.SetOutput(info)
58 },
59 }
test/sharness/t0151-sysdiag.sh new
+47
@@ -0,0 +1,47 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2015 Jeromy Johnson
4 +# MIT Licensed; see the LICENSE file in this repository.
5 +#
6 +
7 +test_description="test output of sysdiag command"
8 +
9 +. lib/test-lib.sh
10 +
11 +test_init_ipfs
12 +
13 +test_expect_success "ipfs diag sys succeeds" '
14 + ipfs diag sys > output
15 +'
16 +
17 +test_expect_success "output contains some expected keys" '
18 + grep "virt" output &&
19 + grep "interface_addresses" output &&
20 + grep "arch" output
21 +'
22 +
23 +test_expect_success "uname succeeds" '
24 + UOUT=$(uname)
25 +'
26 +
27 +test_expect_success "output is similar to uname" '
28 + case $UOUT in
29 + Linux)
30 + grep linux output > /dev/null
31 + ;;
32 + Darwin)
33 + grep darwin output > /dev/null
34 + ;;
35 + FreeBSD)
36 + grep freebsd output > /dev/null
37 + ;;
38 + CYGWIN*)
39 + grep windows output > /dev/null
40 + ;;
41 + *)
42 + test_fsh echo system check for $UOUT failed, unsupported system?
43 + ;;
44 + esac
45 +'
46 +
47 +test_done