Skip to content

Commit d1e939f

Browse files
author
Jason Yellick
committed
[FAB-1956] Automatically generate orderer template
https://jira.hyperledger.org/browse/FAB-1956 It's easy to accidentally let the orderer template get out of sync, so this CR causes the orderer unit tests to update the orderer.template file in common/configtx/test. Other automatic template generation coming in the near future. Change-Id: I5709bff35b724e4751c01d6e04392698afcf9c7a Signed-off-by: Jason Yellick <[email protected]>
1 parent a8486dc commit d1e939f

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

orderer/tools/configtemplate/main.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ var logger = logging.MustGetLogger("orderer/tools/baseconfig")
3333

3434
const defaultOutputFile = "orderer.template"
3535

36-
func main() {
37-
var outputFile string
38-
flag.StringVar(&outputFile, "outputFile", defaultOutputFile, "The file to write the configuration templatee to")
39-
flag.Parse()
40-
36+
func writeTemplate(outputFile string) {
4137
conf := config.Load()
4238
flogging.InitFromSpec(conf.General.LogLevel)
4339

@@ -54,5 +50,12 @@ func main() {
5450

5551
logger.Debugf("Writing configuration to disk")
5652
ioutil.WriteFile(outputFile, outputData, 0644)
53+
}
54+
55+
func main() {
56+
var outputFile string
57+
flag.StringVar(&outputFile, "outputFile", defaultOutputFile, "The file to write the configuration templatee to")
58+
flag.Parse()
5759

60+
writeTemplate(outputFile)
5861
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Copyright IBM Corp. 2017 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package main
18+
19+
import (
20+
"testing"
21+
)
22+
23+
func TestUpdateTemplate(t *testing.T) {
24+
writeTemplate("../../../common/configtx/test/orderer.template")
25+
}

0 commit comments

Comments
 (0)