对接
This commit is contained in:
@@ -3,6 +3,7 @@ package live
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
@@ -480,3 +481,29 @@ func TestClosedSupersededPeerConnectionDoesNotRemovePeer(t *testing.T) {
|
||||
}
|
||||
|
||||
var _ platformws.Hub = (*liveHubStub)(nil)
|
||||
|
||||
func TestNewPionAPIRejectsConflictingUDPConfiguration(t *testing.T) {
|
||||
t.Setenv("KRA_LIVE_UDP_PORT", "40000")
|
||||
t.Setenv("KRA_LIVE_UDP_MIN_PORT", "40000")
|
||||
t.Setenv("KRA_LIVE_UDP_MAX_PORT", "40010")
|
||||
|
||||
_, closer, err := newPionAPI()
|
||||
if closer != nil {
|
||||
_ = closer.Close()
|
||||
}
|
||||
if err == nil || !strings.Contains(err.Error(), "cannot be combined") {
|
||||
t.Fatalf("newPionAPI error = %v, want conflicting UDP configuration", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewPionAPIRejectsInvalidPublicIP(t *testing.T) {
|
||||
t.Setenv("KRA_LIVE_PUBLIC_IP", "live.example.com")
|
||||
|
||||
_, closer, err := newPionAPI()
|
||||
if closer != nil {
|
||||
_ = closer.Close()
|
||||
}
|
||||
if err == nil || !strings.Contains(err.Error(), "invalid KRA_LIVE_PUBLIC_IP") {
|
||||
t.Fatalf("newPionAPI error = %v, want invalid public IP", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user