Maint: do not mock os functions
- Use filepaths with /tmp for tests instead - Only mock functions where filepath can't be specified such as user.Lookup
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
@@ -12,12 +13,18 @@ type PIA struct {
|
||||
randSource rand.Source
|
||||
timeNow func() time.Time
|
||||
activeServer models.PIAServer
|
||||
// Port forwarding
|
||||
portForwardPath string
|
||||
authFilePath string
|
||||
}
|
||||
|
||||
func New(servers []models.PIAServer, randSource rand.Source, timeNow func() time.Time) *PIA {
|
||||
func New(servers []models.PIAServer, randSource rand.Source,
|
||||
timeNow func() time.Time) *PIA {
|
||||
return &PIA{
|
||||
servers: servers,
|
||||
timeNow: timeNow,
|
||||
randSource: randSource,
|
||||
servers: servers,
|
||||
timeNow: timeNow,
|
||||
randSource: randSource,
|
||||
portForwardPath: constants.PIAPortForward,
|
||||
authFilePath: constants.OpenVPNAuthConf,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user