-
Notifications
You must be signed in to change notification settings - Fork 9
/
main_test.go
43 lines (30 loc) · 908 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package sfu
import (
"context"
"flag"
"os"
"testing"
"github.com/pion/logging"
"github.com/pion/webrtc/v4"
)
var TestLogger logging.LeveledLogger
var sfuOpts Options
func TestMain(m *testing.M) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
os.Setenv("stderrthreshold", "DEBUG")
// os.Setenv("PIONS_LOG_TRACE", "sfu,vad,ice")
os.Setenv("PIONS_LOG_DEBUG", "sfu,vad")
// os.Setenv("PIONS_LOG_INFO", "sfu,vad")
os.Setenv("PIONS_LOG_WARN", "sfu,vad")
os.Setenv("PIONS_LOG_ERROR", "sfu,vad")
flag.Parse()
TestLogger = logging.NewDefaultLoggerFactory().NewLogger("sfu")
StartStunServer(ctx, "127.0.0.1")
sfuOpts = DefaultOptions()
sfuOpts.IceServers = DefaultTestIceServers()
sfuOpts.SettingEngine.SetNetworkTypes([]webrtc.NetworkType{webrtc.NetworkTypeUDP4})
sfuOpts.SettingEngine.SetIncludeLoopbackCandidate(true)
result := m.Run()
os.Exit(result)
}