feat(portforwarding): allow running script upon port forwarding success (#2399)

This commit is contained in:
Alex Lavallee
2024-11-10 03:49:02 -05:00
committed by GitHub
parent e69966381d
commit a035a151bd
15 changed files with 480 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
//go:build linux
package service
import (
"context"
"testing"
gomock "github.com/golang/mock/gomock"
"github.com/qdm12/gluetun/internal/command"
"github.com/stretchr/testify/require"
)
func Test_Service_runUpCommand(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
ctx := context.Background()
cmder := command.New()
const commandTemplate = `/bin/sh -c "echo {{PORTS}}"`
ports := []uint16{1234, 5678}
logger := NewMockLogger(ctrl)
logger.EXPECT().Info("1234,5678")
err := runUpCommand(ctx, cmder, logger, commandTemplate, ports)
require.NoError(t, err)
}