@@ -92,7 +92,7 @@ func New(ctx context.Context, cfg *Config, dbCfg *resources.DB, docker *client.C
9292 pm : pm ,
9393 networkID : networkID ,
9494 instanceID : instanceID ,
95- ports : make ([]bool , cfg .PortPool .To - cfg .PortPool .From ),
95+ ports : make ([]bool , cfg .PortPool .To - cfg .PortPool .From + 1 ),
9696 }
9797
9898 return p , nil
@@ -114,7 +114,7 @@ func isValidConfigModeLocal(config Config) error {
114114 return errors .New (`"portPool.to" must be defined and be greater than 0` )
115115 }
116116
117- if portPool .To <= portPool .From {
117+ if portPool .To < portPool .From {
118118 return errors .New (`"portPool" must include at least one port` )
119119 }
120120
@@ -444,7 +444,7 @@ func (p *Provisioner) RevisePortPool() error {
444444
445445 availablePorts := 0
446446
447- for port := p .config .PortPool .From ; port < p .config .PortPool .To ; port ++ {
447+ for port := p .config .PortPool .From ; port <= p .config .PortPool .To ; port ++ {
448448 if err := p .portChecker .checkPortAvailability (host , port ); err != nil {
449449 log .Msg (fmt .Sprintf ("port %d is not available, marking as busy" , port ))
450450
@@ -533,7 +533,7 @@ func (p *Provisioner) FreePort(port uint) error {
533533func (p * Provisioner ) setPortStatus (port uint , bind bool ) error {
534534 portOpts := p .config .PortPool
535535
536- if port < portOpts .From || port >= portOpts .To {
536+ if port < portOpts .From || port > portOpts .To {
537537 return errors .Errorf ("port %d is out of bounds of the port pool" , port )
538538 }
539539
0 commit comments