github.com/darrenli6/fabric-sdk-example@v0.0.0-20220109053535-94b13b56df8c/orderer/metadata/metadata_test.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package metadata_test 8 9 import ( 10 "fmt" 11 "runtime" 12 "testing" 13 14 common "github.com/hyperledger/fabric/common/metadata" 15 "github.com/hyperledger/fabric/orderer/metadata" 16 "github.com/stretchr/testify/assert" 17 ) 18 19 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 27 expected := fmt.Sprintf("%s:\n Version: %s\n Go version: %s\n OS/Arch: %s", 28 metadata.ProgramName, common.Version, runtime.Version(), 29 fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)) 30 assert.Equal(t, expected, metadata.GetVersionInfo()) 31 }