#!./cloyster include_cmd_dir '_netgraph.sh' awkk=$(cat </dev/null) assert_exited $? 0 "mock input does not contains banner" (echo "$input" | grep "ng0_" >/dev/null) assert_exited $? 0 "mock input does not contains ng0_" reformatted=$(_netgraph_list_reformat "${input}") (echo "$reformatted" | grep "There are 66 total nodes" >/dev/null); s=$? assert_exited "$s" 1 "reformat output contains banner" (echo "$reformatted" | grep "ng0" > /dev/null); s=$? assert_exited $s 0 "reformat output does not contains ng0" json=$(_netgraph_list_to_json "${reformatted}") (echo "${json}" | jq >/dev/null) assert_exited $? 0 "json couldn't get parsed by jq" # shellcheck disable=SC2034 count=$(echo "${json}" | jq '[.nodes[].node] | length') assert_exited $? 0 "json query failed" assert "echo \"\${count}\"" "67" "should contain 67 nodes" # assert "$(echo ${json}) | jq '[.nodes[].node] | length'" "67" "should contain 67 nodes" ENDT _test "runs on freebsd" .tag:integration .if:freebsd .skip:FIXME TEST # ( /bin/su -l $(whoami) /bin/sh ${CLOYSTER_COMMAND_FILE} ) exit 1 ENDT _test "doesnt run on freebsd" .tag:integration .not:freebsd .refute TEST ( ${CLOYSTER_COMMAND_FILE} ) ENDT