Skip to content

Commit

Permalink
cshared: test: Fix failing cshared tests
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Oct 6, 2023
1 parent 4df6533 commit 2f9fc7b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cshared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ func TestInputCallbackCtrlC(t *testing.T) {

ptr := unsafe.Pointer(nil)

// prepare channel for input explicitly.
err := prepareInputCollector()
if err != nil {
t.Fail()
return
}

go func() {
FLBPluginInputCallback(&ptr, nil)
cdone <- true
Expand Down Expand Up @@ -86,6 +93,12 @@ func TestInputCallbackDangle(t *testing.T) {
cdone := make(chan bool)
ptr := unsafe.Pointer(nil)

// prepare channel for input explicitly.
err := prepareInputCollector()
if err != nil {
t.Fail()
}

go func() {
t := time.NewTicker(collectInterval)
defer t.Stop()
Expand Down Expand Up @@ -156,6 +169,13 @@ func TestInputCallbackInfinite(t *testing.T) {
cshutdown := make(chan bool)
ptr := unsafe.Pointer(nil)

// prepare channel for input explicitly.
err := prepareInputCollector()
if err != nil {
t.Fail()
return
}

go func() {
t := time.NewTicker(collectInterval)
defer t.Stop()
Expand Down Expand Up @@ -237,6 +257,13 @@ func TestInputCallbackLatency(t *testing.T) {
cstarted := make(chan bool)
cmsg := make(chan []byte)

// prepare channel for input explicitly.
err := prepareInputCollector()
if err != nil {
t.Fail()
return
}

go func() {
t := time.NewTicker(collectInterval)
defer t.Stop()
Expand Down Expand Up @@ -363,6 +390,12 @@ func TestInputCallbackInfiniteConcurrent(t *testing.T) {

concurrentWait.Add(64)

// prepare channel for input explicitly.
err := prepareInputCollector()
if err != nil {
t.Fail()
}

go func(cstarted chan bool) {
ticker := time.NewTicker(time.Second * 1)
defer ticker.Stop()
Expand Down

0 comments on commit 2f9fc7b

Please sign in to comment.