Skip to content

Commit

Permalink
changes made as per review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shriramsharma committed May 25, 2022
1 parent 7be81eb commit 6ce5e58
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions admiral/pkg/controller/common/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package common
import (
"context"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -200,26 +201,35 @@ func TestSidecarEgressGet(t *testing.T) {
ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(3*time.Second))
defer cancel()

var wg sync.WaitGroup
wg.Add(2)
// Producer go routine
go func(ctx context.Context) {
for {
select {
case <-ctx.Done():
wg.Done()
return
default:
egressMap.Put("pkey1", string(uuid.NewUUID()), "fqdn", map[string]string{"pkey2": "pkey2"})
}
}
}(ctx)

for {
select {
case <-ctx.Done():
return
default:
assert.NotNil(t, egressMap.Get("pkey1"))
// Consumer go routine
go func(ctx context.Context) {
for {
select {
case <-ctx.Done():
wg.Done()
return
default:
assert.NotNil(t, egressMap.Get("pkey1"))
}
}
}
}(ctx)

wg.Wait()
}

func TestSidecarEgressRange(t *testing.T) {
Expand Down

0 comments on commit 6ce5e58

Please sign in to comment.