@@ -19,7 +19,6 @@ import (
1919 "path/filepath"
2020 "runtime"
2121 "strconv"
22- "strings"
2322 "time"
2423
2524 "github.com/moby/moby/api/types/container"
@@ -50,14 +49,7 @@ func (e *Extension) launchContainer() {
5049 // get ports
5150 sidecarPort := int (e .network .PeerPort (sidecarPeer , fabric_network .ListenPort ))
5251 queryServicePort := int (e .network .PeerPort (sidecarPeer , fabricx_network .QueryServicePortName ))
53-
54- var orderingServicePorts []int
55- var orderingServiceEndpoints []string
56- for _ , o := range e .network .Orderers {
57- port := int (e .network .OrdererPort (o , fabric_network .ListenPort ))
58- orderingServicePorts = append (orderingServicePorts , port )
59- orderingServiceEndpoints = append (orderingServiceEndpoints , net .JoinHostPort ("" , strconv .Itoa (port )))
60- }
52+ orderingServicePort := int (e .network .OrdererPort (e .network .Orderers [0 ], fabric_network .ListenPort ))
6153
6254 // genesis block
6355 configBlockPath := e .network .OutputBlockPath (e .channel .Name )
@@ -85,7 +77,7 @@ func (e *Extension) launchContainer() {
8577 SidecarMSPID : fmt .Sprintf ("%sMSP" , e .cfg .SidecarOrg ),
8678 SidecarServerEndpoint : net .JoinHostPort ("" , strconv .Itoa (sidecarPort )),
8779 QueryServerEndpoint : net .JoinHostPort ("" , strconv .Itoa (queryServicePort )),
88- OrdererServerEndpoint : strings . Join ( orderingServiceEndpoints , "," ),
80+ OrdererServerEndpoint : net . JoinHostPort ( "" , strconv . Itoa ( orderingServicePort ) ),
8981 TLSEnabled : e .network .TLSEnabled ,
9082 CertsBundle : path .Join ("/root/artifacts/crypto" , "ca-certs.pem" ),
9183 SidecarTLSDir : containerSidecarTLSDir (e .network , sidecarPeer ),
@@ -94,13 +86,9 @@ func (e *Extension) launchContainer() {
9486 EnvVarOverrides : e .cfg .EnvVars ,
9587 }
9688
97- logger .Infof ("Run fabric-x committer test container on %v ports: sidecar=%v query=%v orderers =%v" ,
98- localIP , sidecarPort , queryServicePort , orderingServicePorts )
89+ logger .Infof ("Run fabric-x committer test container on %v ports: sidecar=%v query=%v orderer =%v" ,
90+ localIP , sidecarPort , queryServicePort , orderingServicePort )
9991
100- var exposedPorts []int
101- exposedPorts = append (exposedPorts , sidecarPort , queryServicePort )
102- exposedPorts = append (exposedPorts , orderingServicePorts ... )
103-
10492 cli := utils .MustGet (dcli .New (dcli .FromEnv ))
10593 ctx := context .TODO ()
10694 resp := utils .MustGet (cli .ContainerCreate (
@@ -112,7 +100,7 @@ func (e *Extension) launchContainer() {
112100 Tty : true ,
113101 AttachStdout : true ,
114102 AttachStderr : true ,
115- ExposedPorts : docker .PortSet (exposedPorts ... ),
103+ ExposedPorts : docker .PortSet (sidecarPort , queryServicePort , orderingServicePort ),
116104 Env : containerEnvVars (cfg ),
117105 Cmd : containerCmd (cfg ),
118106 },
@@ -138,7 +126,7 @@ func (e *Extension) launchContainer() {
138126 ReadOnly : true ,
139127 },
140128 },
141- PortBindings : docker .PortBindings (exposedPorts ... ),
129+ PortBindings : docker .PortBindings (sidecarPort , queryServicePort , orderingServicePort ),
142130 },
143131 NetworkingConfig : & network.NetworkingConfig {
144132 EndpointsConfig : map [string ]* network.EndpointSettings {
@@ -207,7 +195,7 @@ func (e *Extension) launchContainer() {
207195
208196 // let's wait until the sidecar is ready
209197 g , ctx := errgroup .WithContext (ctx )
210- for _ , p := range exposedPorts {
198+ for _ , p := range [] int { sidecarPort , orderingServicePort , queryServicePort } {
211199 g .Go (func () error {
212200 addr := net .JoinHostPort ("127.0.0.1" , strconv .Itoa (p ))
213201 return fabric .WaitUntilReadyWithTLS (ctx , addr , tlsConfig )
0 commit comments