Skip to content

Commit

Permalink
Update configtx integration test to use new APIs
Browse files Browse the repository at this point in the history
FAB-17893 #done

Signed-off-by: Will Lahti <[email protected]>
  • Loading branch information
wlahti committed May 14, 2020
1 parent 7473bb6 commit d83ac9b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions integration/configtx/configtx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/onsi/gomega/gexec"
)

var _ = Describe("Config", func() {
var _ = Describe("ConfigTx", func() {
var (
client *docker.Client
testDir string
Expand Down Expand Up @@ -70,7 +70,7 @@ var _ = Describe("Config", func() {
os.RemoveAll(testDir)
})

It("creates channels and updates them using pkg/config", func() {
It("creates channels and updates them using fabric-config/configtx", func() {
orderer := network.Orderer("orderer")
testPeers := network.PeersWithChannel("testchannel")
org1peer0 := network.Peer("Org1", "peer0")
Expand Down Expand Up @@ -115,7 +115,9 @@ var _ = Describe("Config", func() {
}

channelID := "testchannel"
envelope, err := configtx.NewCreateChannelTx(channel, channelID)
createChannelUpdate, err := configtx.NewCreateChannelTx(channel, channelID)
Expect(err).NotTo(HaveOccurred())
envelope, err := configtx.NewEnvelope(createChannelUpdate)
Expect(err).NotTo(HaveOccurred())
envBytes, err := proto.Marshal(envelope)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -149,7 +151,7 @@ var _ = Describe("Config", func() {

By("adding the anchor peer for " + peer.Organization)
host, port := peerHostPort(network, peer)
err = c.AddAnchorPeer(peer.Organization, configtx.Address{Host: host, Port: port})
err = c.Application().Organization(peer.Organization).AddAnchorPeer(configtx.Address{Host: host, Port: port})
Expect(err).NotTo(HaveOccurred())

By("computing the config update")
Expand All @@ -162,11 +164,13 @@ var _ = Describe("Config", func() {
PrivateKey: parsePeerPrivateKey(network, peer, "Admin"),
MSPID: network.Organization(peer.Organization).MSPID,
}
signature, err := signingIdentity.SignConfigUpdate(configUpdate)
signature, err := signingIdentity.CreateConfigSignature(configUpdate)
Expect(err).NotTo(HaveOccurred())

By("creating a signed config update envelope with the detached signature")
configUpdateEnvelope, err := signingIdentity.SignConfigUpdateEnvelope(configUpdate, signature)
configUpdateEnvelope, err := configtx.NewEnvelope(configUpdate, signature)
Expect(err).NotTo(HaveOccurred())
err = signingIdentity.SignEnvelope(configUpdateEnvelope)
Expect(err).NotTo(HaveOccurred())
configUpdateBytes, err := proto.Marshal(configUpdateEnvelope)
Expect(err).NotTo(HaveOccurred())
Expand Down

0 comments on commit d83ac9b

Please sign in to comment.