Fix stop not cleaning up WireGuard interface (#286)

This commit is contained in:
Givi Khojanashvili
2022-03-25 16:21:04 +04:00
committed by GitHub
parent a15d52b263
commit 2aaeeac7f6
10 changed files with 101 additions and 125 deletions

View File

@@ -2,12 +2,13 @@ package cmd
import (
"context"
"github.com/wiretrustee/wiretrustee/util"
"net"
"path/filepath"
"testing"
"time"
"github.com/wiretrustee/wiretrustee/util"
clientProto "github.com/wiretrustee/wiretrustee/client/proto"
client "github.com/wiretrustee/wiretrustee/client/server"
mgmtProto "github.com/wiretrustee/wiretrustee/management/proto"
@@ -85,7 +86,6 @@ func startManagement(t *testing.T, config *mgmt.Config) (*grpc.Server, net.Liste
func startClientDaemon(
t *testing.T, ctx context.Context, managementURL, configPath string,
stopCh chan int, cleanupCh chan<- struct{},
) (*grpc.Server, net.Listener) {
lis, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
@@ -93,13 +93,7 @@ func startClientDaemon(
}
s := grpc.NewServer()
server := client.New(
ctx,
managementURL,
configPath,
stopCh,
cleanupCh,
)
server := client.New(ctx, managementURL, configPath)
if err := server.Start(); err != nil {
t.Fatal(err)
}