Skip to content

Commit 55d5daa

Browse files
committed
[FAB-10643] implement a new world
- clear definition of a fabric network - separation of runners and sessions - grouped runner to start and stop network - structured config layout ... and more Change-Id: I7214e81a3dc907dec0e5d515dd22efd80094ebd6 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent 2534299 commit 55d5daa

33 files changed

+3956
-14
lines changed

Gopkg.lock

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/helpers/images.go

+9
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ SPDX-License-Identifier: Apache-2.0
77
package helpers
88

99
import (
10+
"encoding/base32"
1011
"fmt"
12+
"strings"
1113

14+
"github.com/hyperledger/fabric/common/util"
1215
. "github.com/onsi/ginkgo"
1316
. "github.com/onsi/gomega"
1417

@@ -30,3 +33,9 @@ func AssertImagesExist(imageNames ...string) {
3033
}
3134
}
3235
}
36+
37+
// UniqueName generates base-32 enocded UUIDs for container names.
38+
func UniqueName() string {
39+
name := base32.StdEncoding.WithPadding(base32.NoPadding).EncodeToString(util.GenerateBytesUUID())
40+
return strings.ToLower(name)
41+
}

integration/nwo/command.go

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package nwo
8+
9+
import (
10+
"os"
11+
"os/exec"
12+
)
13+
14+
type Command interface {
15+
Args() []string
16+
SessionName() string
17+
}
18+
19+
type Enver interface {
20+
Env() []string
21+
}
22+
23+
type WorkingDirer interface {
24+
WorkingDir() string
25+
}
26+
27+
func NewCommand(path string, command Command) *exec.Cmd {
28+
cmd := exec.Command(path, command.Args()...)
29+
cmd.Env = os.Environ()
30+
if ce, ok := command.(Enver); ok {
31+
cmd.Env = append(cmd.Env, ce.Env()...)
32+
}
33+
if wd, ok := command.(WorkingDirer); ok {
34+
cmd.Dir = wd.WorkingDir()
35+
}
36+
return cmd
37+
}
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package commands
8+
9+
type OutputBlock struct {
10+
ChannelID string
11+
Profile string
12+
ConfigPath string
13+
OutputBlock string
14+
}
15+
16+
func (o OutputBlock) SessionName() string {
17+
return "configtxgen-output-block"
18+
}
19+
20+
func (o OutputBlock) Args() []string {
21+
return []string{
22+
"-channelID", o.ChannelID,
23+
"-profile", o.Profile,
24+
"-configPath", o.ConfigPath,
25+
"-outputBlock", o.OutputBlock,
26+
}
27+
}
28+
29+
type CreateChannelTx struct {
30+
ChannelID string
31+
Profile string
32+
ConfigPath string
33+
OutputCreateChannelTx string
34+
}
35+
36+
func (c CreateChannelTx) SessionName() string {
37+
return "configtxgen-create-channel-tx"
38+
}
39+
40+
func (c CreateChannelTx) Args() []string {
41+
return []string{
42+
"-channelID", c.ChannelID,
43+
"-profile", c.Profile,
44+
"-configPath", c.ConfigPath,
45+
"-outputCreateChannelTx", c.OutputCreateChannelTx,
46+
}
47+
}

integration/nwo/commands/cryptogen.go

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package commands
8+
9+
type Generate struct {
10+
Config string
11+
Output string
12+
}
13+
14+
func (c Generate) SessionName() string {
15+
return "cryptogen-generate"
16+
}
17+
18+
func (c Generate) Args() []string {
19+
return []string{
20+
"generate",
21+
"--config", c.Config,
22+
"--output", c.Output,
23+
}
24+
}

0 commit comments

Comments
 (0)