mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added unit tests for concReq struct methods
This commit is contained in:
committed by
Dan Christian Bogos
parent
157dda68bf
commit
2450cf56d0
File diff suppressed because one or more lines are too long
@@ -260,3 +260,35 @@ func TestNewEventExporterDcCase(t *testing.T) {
|
||||
t.Errorf("Expected %+v \n but got %+v", errExpect, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewConcReq(t *testing.T) {
|
||||
if reply := newConcReq(5); len(reply.reqs) != 5 {
|
||||
t.Errorf("Expected 5 \n but received \n %v", len(reply.reqs))
|
||||
}
|
||||
}
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
c := &concReq{
|
||||
reqs: make(chan struct{}, 2),
|
||||
limit: 2,
|
||||
}
|
||||
c.reqs <- struct{}{}
|
||||
c.reqs <- struct{}{}
|
||||
c.get()
|
||||
if len(c.reqs) != 1 {
|
||||
t.Error("Expected length of 1")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDone(t *testing.T) {
|
||||
c := &concReq{
|
||||
reqs: make(chan struct{}, 3),
|
||||
limit: 3,
|
||||
}
|
||||
c.reqs <- struct{}{}
|
||||
c.reqs <- struct{}{}
|
||||
c.done()
|
||||
if len(c.reqs) != 3 {
|
||||
t.Error("Expected length of 3")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user