Skip to content

Commit

Permalink
add small sharness test to make sure output happens
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Oct 19, 2015
1 parent 11104d4 commit 1cef170
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/commands/sysdiag.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"runtime"

cmds "github.com/ipfs/go-ipfs/commands"
config "github.com/ipfs/go-ipfs/repo/config"

manet "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
psud "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/shirou/gopsutil/disk"
Expand Down Expand Up @@ -51,6 +52,8 @@ Prints out information about your computer to aid in easier debugging.
return
}

info["ipfs_version"] = config.CurrentVersionNumber
info["ipfs_git_sha"] = config.CurrentCommit
res.SetOutput(info)
},
}
Expand Down
47 changes: 47 additions & 0 deletions test/sharness/t0151-sysdiag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/sh
#
# Copyright (c) 2015 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#

test_description="test output of sysdiag command"

. lib/test-lib.sh

test_init_ipfs

test_expect_success "ipfs diag sys succeeds" '
ipfs diag sys > output
'

test_expect_success "output contains some expected keys" '
grep "virt" output &&
grep "interface_addresses" output &&
grep "arch" output
'

test_expect_success "uname succeeds" '
UOUT=$(uname)
'

test_expect_success "output is similar to uname" '
case $UOUT in
Linux)
grep linux output > /dev/null
;;
Darwin)
grep darwin output > /dev/null
;;
FreeBSD)
grep freebsd output > /dev/null
;;
CYGWIN*)
grep windows output > /dev/null
;;
*)
test_fsh echo system check for $UOUT failed, unsupported system?
;;
esac
'

test_done

0 comments on commit 1cef170

Please sign in to comment.