| 1 | #!/usr/bin/env bash |
| 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 | grep "online" output |
| 22 | ' |
| 23 | |
| 24 | test_expect_success "uname succeeds" ' |
| 25 | UOUT=$(uname) |
| 26 | ' |
| 27 | |
| 28 | test_expect_success "output is similar to uname" ' |
| 29 | case $UOUT in |
| 30 | Linux) |
| 31 | grep linux output > /dev/null |
| 32 | ;; |
| 33 | Darwin) |
| 34 | grep darwin output > /dev/null |
| 35 | ;; |
| 36 | FreeBSD) |
| 37 | grep freebsd output > /dev/null |
| 38 | ;; |
| 39 | CYGWIN*) |
| 40 | grep windows output > /dev/null |
| 41 | ;; |
| 42 | *) |
| 43 | test_fsh echo system check for $UOUT failed, unsupported system? |
| 44 | ;; |
| 45 | esac |
| 46 | ' |
| 47 | |
| 48 | test_done |