Skip to content

Commit

Permalink
Use ports outside of the Linux default ephemeral port range
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandros Filios <[email protected]>
  • Loading branch information
alexandrosfilios committed Sep 9, 2024
1 parent 79f3889 commit 64c6d3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/IBM/idemix/bccsp/types v0.0.0-20240816143710-3dce4618d760
github.com/IBM/mathlib v0.0.3-0.20231011094432-44ee0eb539da
github.com/hashicorp/go-uuid v1.0.3
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240902111918-657d39e795fe
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240906110529-b91207af4d1e
github.com/hyperledger-labs/orion-sdk-go v0.2.10
github.com/hyperledger-labs/orion-server v0.2.10
github.com/hyperledger/fabric v1.4.0-rc1.0.20230405174026-695dd57e01c2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,8 @@ github.com/hidal-go/hidalgo v0.0.0-20201109092204-05749a6d73df/go.mod h1:bPkrxDl
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240902111918-657d39e795fe h1:jSNYc0PaqvkxIPswJv/LPL97ixdee+fDqXGz4sllhEo=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240902111918-657d39e795fe/go.mod h1:9AELIfs/eawIhoHNKMSmYALaunmpDbs9bdWKyHuJs88=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240906110529-b91207af4d1e h1:34g3yH95u+VZ2BzUqVUKP3fbSnBYEix//HsaWPcYKc8=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240906110529-b91207af4d1e/go.mod h1:9AELIfs/eawIhoHNKMSmYALaunmpDbs9bdWKyHuJs88=
github.com/hyperledger-labs/orion-sdk-go v0.2.10 h1:lFgWgxyvngIhWnIqymYGBmtmq9D6uC5d0uLG9cbyh5s=
github.com/hyperledger-labs/orion-sdk-go v0.2.10/go.mod h1:iN2xZB964AqwVJwL+EnwPOs8z1EkMEbbIg/qYeC7gDY=
github.com/hyperledger-labs/orion-server v0.2.10 h1:G4zbQEL5Egk0Oj+TwHCZWdTOLDBHOjaAEvYOT4G7ozw=
Expand Down
26 changes: 3 additions & 23 deletions integration/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@ SPDX-License-Identifier: Apache-2.0
package integration

import (
"fmt"
"os"

"github.com/hyperledger-labs/fabric-smart-client/integration"
"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fsc"
"github.com/hyperledger-labs/fabric-token-sdk/integration/token"
"github.com/onsi/ginkgo/v2"
)

// TestPortRange represents a port range
type TestPortRange int
type TestPortRange integration.TestPortRange

const (
basePort = 20000
portsPerNode = 150
portsPerSuite = 10 * portsPerNode

SimpleTokenSelector = "simple"
SherdLockTokenSelector = "sherdlock"
)
Expand Down Expand Up @@ -72,7 +66,7 @@ var (
)

const (
BasePort TestPortRange = basePort + portsPerSuite*iota
BasePort integration.TestPortRange = integration.BasePort + integration.PortsPerSuite*iota

ZKATDLogFungible
ZKATDLogFungibleStress
Expand Down Expand Up @@ -106,17 +100,3 @@ const (

Mixed
)

// StartPortForNode On linux, the default ephemeral port range is 32768-60999 and can be
// allocated by the system for the client side of TCP connections or when
// programs explicitly request one. Given linux is our default CI system,
// we want to try avoid ports in that range.
func (t TestPortRange) StartPortForNode() int {
const startEphemeral, endEphemeral = 32768, 60999

port := int(t) + portsPerNode*(ginkgo.GinkgoParallelProcess()-1)
if port >= startEphemeral-portsPerNode && port <= endEphemeral-portsPerNode {
fmt.Fprintf(os.Stderr, "WARNING: port %d is part of the default ephemeral port range on linux", port)
}
return port
}

0 comments on commit 64c6d3c

Please sign in to comment.