Skip to content

Commit 7d59d5a

Browse files
author
Jason Yellick
committed
[FAB-5446] Fix orderer metadata local test
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 <[email protected]>
1 parent 26317e3 commit 7d59d5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

orderer/common/metadata/metadata_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ import (
1717
)
1818

1919
func TestGetVersionInfo(t *testing.T) {
20+
// This test would always fail for development versions because if
21+
// common.Version is not set, the string returned is "development version"
22+
// Set it here for this test to avoid this.
23+
if common.Version == "" {
24+
common.Version = "testVersion"
25+
}
26+
2027
expected := fmt.Sprintf("%s:\n Version: %s\n Go version: %s\n OS/Arch: %s",
2128
metadata.ProgramName, common.Version, runtime.Version(),
2229
fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH))

0 commit comments

Comments
 (0)