-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple SipTransactionManager UT to expose issue in the PR#17.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package sippy | ||
|
||
import ( | ||
"testing" | ||
"runtime" | ||
|
||
"github.com/sippy/go-b2bua/sippy/conf" | ||
"github.com/sippy/go-b2bua/sippy/log" | ||
) | ||
|
||
func Test_SipTransactionManager(t *testing.T) { | ||
var err error | ||
|
||
error_logger := sippy_log.NewErrorLogger() | ||
sip_logger := NewTestSipLogger() | ||
config := sippy_conf.NewConfig(error_logger, sip_logger) | ||
config.SetSipAddress(config.GetMyAddress()) | ||
config.SetSipPort(config.GetMyPort()) | ||
cmap := NewTestCallMap(config) | ||
tfactory := NewTestSipTransportFactory() | ||
config.SetSipTransportFactory(tfactory) | ||
numGoroutinesBefore := runtime.NumGoroutine() | ||
cmap.sip_tm, err = NewSipTransactionManager(config, cmap) | ||
if err != nil { | ||
t.Fatal("Cannot create SIP transaction manager: " + err.Error()) | ||
} | ||
go cmap.sip_tm.Run() | ||
cmap.sip_tm.Shutdown() | ||
numGoroutinesAfter := runtime.NumGoroutine() | ||
if numGoroutinesBefore != numGoroutinesAfter { | ||
t.Fatalf("numGoroutinesBefore = %d, numGoroutinesAfter = %d\n", numGoroutinesBefore, numGoroutinesAfter) | ||
} | ||
} |