Skip to content

Commit 5e0f9d8

Browse files
authored
Removed the duplicated functionality in the integration tests (hyperledger#5250)
Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com>
1 parent 40f0a2d commit 5e0f9d8

File tree

2 files changed

+7
-96
lines changed

2 files changed

+7
-96
lines changed

integration/e2e/e2e_test.go

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"os"
1919
"path"
2020
"path/filepath"
21-
"sort"
2221
"strings"
2322
"syscall"
2423
"time"
@@ -158,40 +157,15 @@ var _ = Describe("EndToEnd", func() {
158157
orderer := network.Orderer("orderer")
159158

160159
By("listing channels with osnadmin, no channels yet")
161-
tlsdir := network.OrdererLocalTLSDir(orderer)
162-
sess, err := network.Osnadmin(commands.ChannelList{
163-
OrdererAddress: network.OrdererAddress(orderer, nwo.AdminPort),
164-
CAFile: filepath.Join(tlsdir, "ca.crt"),
165-
ClientCert: filepath.Join(tlsdir, "server.crt"),
166-
ClientKey: filepath.Join(tlsdir, "server.key"),
167-
})
168-
Expect(err).NotTo(HaveOccurred())
169-
Eventually(sess).Should(gexec.Exit(0))
170-
var channelList nwo.ChannelList
171-
err = json.Unmarshal(sess.Out.Contents(), &channelList)
172-
Expect(err).NotTo(HaveOccurred())
173-
Expect(channelList).To(Equal(nwo.ChannelList{}))
160+
cl := nwo.List(network, orderer)
161+
Expect(cl).To(Equal(nwo.ChannelList{}))
174162

175163
By("setting up the channel")
176164
nwo.JoinOrdererJoinPeersAppChannel(network, "testchannel", orderer, ordererRunner)
177165

178166
By("listing channels with osnadmin")
179-
sess, err = network.Osnadmin(commands.ChannelList{
180-
OrdererAddress: network.OrdererAddress(orderer, nwo.AdminPort),
181-
CAFile: filepath.Join(tlsdir, "ca.crt"),
182-
ClientCert: filepath.Join(tlsdir, "server.crt"),
183-
ClientKey: filepath.Join(tlsdir, "server.key"),
184-
})
185-
Expect(err).NotTo(HaveOccurred())
186-
Eventually(sess).Should(gexec.Exit(0))
187-
err = json.Unmarshal(sess.Out.Contents(), &channelList)
188-
Expect(err).NotTo(HaveOccurred())
189-
Expect(channelList).To(Equal(nwo.ChannelList{
190-
Channels: []nwo.ChannelInfoShort{{
191-
Name: "testchannel",
192-
URL: "/participation/v1/channels/testchannel",
193-
}},
194-
}))
167+
cl = nwo.List(network, orderer)
168+
nwo.ChannelListMatcher(cl, []string{"testchannel"})
195169

196170
By("enabling capabilities V2_5")
197171
nwo.EnableCapabilities(network, "testchannel", "Application", "V2_5", orderer, network.Peer("Org1", "peer0"), network.Peer("Org2", "peer0"))
@@ -203,7 +177,7 @@ var _ = Describe("EndToEnd", func() {
203177
badCC.PackageFile = filepath.Join(testDir, "unsupported-type.tar.gz")
204178
nwo.PackageChaincodeBinary(badCC)
205179
badCC.SetPackageIDFromPackageFile()
206-
sess, err = network.PeerAdminSession(
180+
sess, err := network.PeerAdminSession(
207181
network.Peer("Org1", "peer0"),
208182
commands.ChaincodeInstall{
209183
PackageFile: badCC.PackageFile,
@@ -244,31 +218,8 @@ var _ = Describe("EndToEnd", func() {
244218
nwo.JoinOrdererJoinPeersAppChannel(network, "another-testchannel", orderer, ordererRunner)
245219

246220
By("listing channels with osnadmin")
247-
sess, err = network.Osnadmin(commands.ChannelList{
248-
OrdererAddress: network.OrdererAddress(orderer, nwo.AdminPort),
249-
CAFile: filepath.Join(tlsdir, "ca.crt"),
250-
ClientCert: filepath.Join(tlsdir, "server.crt"),
251-
ClientKey: filepath.Join(tlsdir, "server.key"),
252-
})
253-
Expect(err).NotTo(HaveOccurred())
254-
Eventually(sess).Should(gexec.Exit(0))
255-
err = json.Unmarshal(sess.Out.Contents(), &channelList)
256-
Expect(err).NotTo(HaveOccurred())
257-
sort.Slice(channelList.Channels, func(i, j int) bool {
258-
return channelList.Channels[i].Name < channelList.Channels[j].Name
259-
})
260-
Expect(channelList).To(Equal(nwo.ChannelList{
261-
Channels: []nwo.ChannelInfoShort{
262-
{
263-
Name: "another-testchannel",
264-
URL: "/participation/v1/channels/another-testchannel",
265-
},
266-
{
267-
Name: "testchannel",
268-
URL: "/participation/v1/channels/testchannel",
269-
},
270-
},
271-
}))
221+
cl = nwo.List(network, orderer)
222+
nwo.ChannelListMatcher(cl, []string{"testchannel", "another-testchannel"})
272223
})
273224
})
274225

integration/nwo/commands/osnadmin.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)