Skip to content

Commit

Permalink
[FAB-5446] Fix orderer metadata local test
Browse files Browse the repository at this point in the history
The orderer metadata test only works if the development environment is
setup to set common.Version, because if this is not set, the version is
returned as "development version" and compared to the unset empty
string.

This is very annoying when trying to do development locally as this test
always fails.

This CR simply overrides the common.Version value for the purpose of
testing this package.

Change-Id: I6bc7a1de5a2730f4dd3fe17f1e5c7ff6bd81d4af
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Jul 24, 2017
1 parent 26317e3 commit 7d59d5a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions orderer/common/metadata/metadata_test.go
Expand Up @@ -17,6 +17,13 @@ import (
)

func TestGetVersionInfo(t *testing.T) {
// This test would always fail for development versions because if
// common.Version is not set, the string returned is "development version"
// Set it here for this test to avoid this.
if common.Version == "" {
common.Version = "testVersion"
}

expected := fmt.Sprintf("%s:\n Version: %s\n Go version: %s\n OS/Arch: %s",
metadata.ProgramName, common.Version, runtime.Version(),
fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH))
Expand Down

0 comments on commit 7d59d5a

Please sign in to comment.