-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-4411] Enable orderer to report version info
The orderer shim currently does not report any version information. The following functionality has been implemented: - Add CLI for orderer which supports "start" and "version" commands. Note that the "start" cmd is the default so need not be specified. This ensures that starting the orderer with ./orderer still works - Version info is also printed at start up - Given the above, removed a duplicate log message from server.go as well Change-Id: Ia4c3a82b9844391823107d10b51dd7136689d4c8 Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
- Loading branch information
1 parent
88d4845
commit ed8864d
Showing
4 changed files
with
94 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package metadata | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
|
||
common "github.com/hyperledger/fabric/common/metadata" | ||
) | ||
|
||
// package-scoped variables | ||
|
||
// Package version | ||
var Version string | ||
|
||
// package-scoped constants | ||
|
||
// Program name | ||
const ProgramName = "orderer" | ||
|
||
func GetVersionInfo() string { | ||
Version = common.Version | ||
if Version == "" { | ||
Version = "development build" | ||
} | ||
|
||
return fmt.Sprintf("%s:\n Version: %s\n Go version: %s\n OS/Arch: %s", | ||
ProgramName, Version, runtime.Version(), | ||
fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package metadata_test | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
"testing" | ||
|
||
"github.com/hyperledger/fabric/common/tools/cryptogen/metadata" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetVersionInfo(t *testing.T) { | ||
testVersion := "TestVersion" | ||
metadata.Version = testVersion | ||
|
||
expected := fmt.Sprintf("%s:\n Version: %s\n Go version: %s\n OS/Arch: %s", | ||
metadata.ProgramName, testVersion, runtime.Version(), | ||
fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)) | ||
assert.Equal(t, expected, metadata.GetVersionInfo()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters