forked from Hyperledger-TWGC/tape
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sam Yuan <yy19902439@126.com>
- Loading branch information
1 parent
73c1c81
commit 59df782
Showing
6 changed files
with
118 additions
and
12 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,75 @@ | ||
package e2e | ||
|
||
import ( | ||
"io/ioutil" | ||
"os/exec" | ||
|
||
"tape/e2e/mock" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
. "github.com/onsi/gomega/gbytes" | ||
"github.com/onsi/gomega/gexec" | ||
) | ||
|
||
var _ = Describe("Mock test for good path", func() { | ||
|
||
Context("E2E with multi mocked Fabric", func() { | ||
When("traffic and observer mode", func() { | ||
|
||
It("should work properly", func() { | ||
server, err := mock.NewServer(2, nil) | ||
server.Start() | ||
defer server.Stop() | ||
|
||
config, err := ioutil.TempFile("", "endorsement-only-config-*.yaml") | ||
paddrs, oaddr := server.Addresses() | ||
configValue := Values{ | ||
PrivSk: mtlsKeyFile.Name(), | ||
SignCert: mtlsCertFile.Name(), | ||
Mtls: false, | ||
PeersAddrs: paddrs, | ||
OrdererAddr: oaddr, | ||
CommitThreshold: 1, | ||
} | ||
GenerateConfigFile(config.Name(), configValue) | ||
|
||
cmd0 := exec.Command(tapeBin, "traffic", "-c", config.Name(), "--rate=10") | ||
|
||
//cmd1 := exec.Command(tapeBin, "observer", "-c", config.Name()) | ||
tapeSession, err = gexec.Start(cmd0, nil, nil) | ||
Expect(err).NotTo(HaveOccurred()) | ||
//_, err = gexec.Start(cmd0, nil, nil) | ||
//Expect(err).NotTo(HaveOccurred()) | ||
//Eventually(tapeSession.Out).Should(Say("Time.*Tx.*")) | ||
}) | ||
|
||
PIt("should work properly", func() { | ||
server, err := mock.NewServer(2, nil) | ||
server.Start() | ||
defer server.Stop() | ||
|
||
config, err := ioutil.TempFile("", "endorsement-only-config-*.yaml") | ||
paddrs, oaddr := server.Addresses() | ||
configValue := Values{ | ||
PrivSk: mtlsKeyFile.Name(), | ||
SignCert: mtlsCertFile.Name(), | ||
Mtls: false, | ||
PeersAddrs: paddrs, | ||
OrdererAddr: oaddr, | ||
CommitThreshold: 1, | ||
} | ||
GenerateConfigFile(config.Name(), configValue) | ||
|
||
cmd0 := exec.Command(tapeBin, "traffic", "-c", config.Name()) | ||
|
||
cmd1 := exec.Command(tapeBin, "observer", "-c", config.Name()) | ||
tapeSession, err = gexec.Start(cmd1, nil, nil) | ||
Expect(err).NotTo(HaveOccurred()) | ||
_, err = gexec.Start(cmd0, nil, nil) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Eventually(tapeSession.Out).Should(Say("Time.*Tx.*")) | ||
}) | ||
}) | ||
}) | ||
}) |
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
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