diff --git a/test/sharness/t0026-id.sh b/test/sharness/t0026-id.sh new file mode 100755 index 000000000000..d0a0a2943996 --- /dev/null +++ b/test/sharness/t0026-id.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +test_description="Test to make sure our identity information looks sane" + +. lib/test-lib.sh + +test_init_ipfs + +test_expect_success "checking AgentVersion" ' + VERSION="$(ipfs version --number)" && + COMMIT="$(ipfs version --number --commit)" && + COMMIT="${COMMIT##$VERSION-}" && + echo "go-ipfs/$VERSION/$COMMIT" > expected-agent-version && + ipfs id -f "\n" > actual-agent-version && + test_cmp expected-agent-version actual-agent-version +' + +test_expect_success "checking ProtocolVersion" ' + echo "ipfs/0.1.0" > expected-protocol-version && + ipfs id -f "\n" > actual-protocol-version && + test_cmp expected-protocol-version actual-protocol-version +' + +test_expect_success "checking ID" ' + ipfs config Identity.PeerID > expected-id && + ipfs id -f "\n" > actual-id && + test_cmp expected-id actual-id +' + +test_done diff --git a/version.go b/version.go index 5ad2408d1f7b..39a5d692fbab 100644 --- a/version.go +++ b/version.go @@ -9,4 +9,6 @@ const CurrentVersionNumber = "0.5.0-dev" const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/" // UserAgent is the libp2p user agent used by go-ipfs. -var UserAgent = ApiVersion + CurrentCommit +// +// Note: This will end in `/` when no commit is available. This is expected. +var UserAgent = "go-ipfs/" + CurrentVersionNumber + "/" + CurrentCommit