Skip to content

Commit

Permalink
cap execution of test
Browse files Browse the repository at this point in the history
  • Loading branch information
sakoush committed Nov 1, 2024
1 parent b7a70b6 commit dfb3472
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 9 additions & 2 deletions scheduler/pkg/agent/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,13 @@ func TestSubscribe(t *testing.T) {
}(a.id)
}

for len(server.agents) != test.expectedAgentsCount {
maxCount := 10
count := 0
for len(server.agents) != test.expectedAgentsCount && count < maxCount {
time.Sleep(100 * time.Millisecond)
count++
}
g.Expect(len(server.agents)).To(Equal(test.expectedAgentsCount))

for idx, s := range streams {
go func(idx int, s *grpc.ClientConn) {
Expand All @@ -1066,9 +1070,12 @@ func TestSubscribe(t *testing.T) {
}(idx, s)
}

for len(server.agents) != test.expectedAgentsCountAfterClose {
count = 0
for len(server.agents) != test.expectedAgentsCountAfterClose && count < maxCount {
time.Sleep(100 * time.Millisecond)
count++
}
g.Expect(len(server.agents)).To(Equal(test.expectedAgentsCountAfterClose))

server.StopAgentStreams()
})
Expand Down
12 changes: 10 additions & 2 deletions scheduler/pkg/kafka/dataflow/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ func TestPipelineRebalance(t *testing.T) {
}

func TestPipelineSubscribe(t *testing.T) {
g := NewGomegaWithT(t)
type ag struct {
id uint32
doClose bool
Expand Down Expand Up @@ -739,9 +740,13 @@ func TestPipelineSubscribe(t *testing.T) {
}(a.id)
}

for len(s.streams) != test.expectedAgentsCount {
maxCount := 10
count := 0
for len(s.streams) != test.expectedAgentsCount && count < maxCount {
time.Sleep(100 * time.Millisecond)
count++
}
g.Expect(len(s.streams)).To(Equal(test.expectedAgentsCount))

for idx, s := range streams {
go func(idx int, s *grpc.ClientConn) {
Expand All @@ -751,9 +756,12 @@ func TestPipelineSubscribe(t *testing.T) {
}(idx, s)
}

for len(s.streams) != test.expectedAgentsCountAfterClose {
count = 0
for len(s.streams) != test.expectedAgentsCountAfterClose && count < maxCount {
time.Sleep(100 * time.Millisecond)
count++
}
g.Expect(len(s.streams)).To(Equal(test.expectedAgentsCountAfterClose))

s.StopSendPipelineEvents()
})
Expand Down

0 comments on commit dfb3472

Please sign in to comment.