Skip to content

Commit

Permalink
adds error just to have test coverage also
Browse files Browse the repository at this point in the history
  • Loading branch information
ncode committed Feb 19, 2024
1 parent d68059b commit 1cb5438
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/tagit/tagit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,9 @@ func TestRun(t *testing.T) {
MockAgent: &MockAgent{
ServicesFunc: func() (map[string]*api.AgentService, error) {
updateServiceTagsCalled.Add(1)
if updateServiceTagsCalled.Load() == 2 {
return nil, fmt.Errorf("enter error")
}
return map[string]*api.AgentService{
"test-service": {
ID: "test-service",
Expand All @@ -758,7 +761,7 @@ func TestRun(t *testing.T) {
go tagit.Run(ctx)

// Allow some time to pass and then cancel the context
time.Sleep(250 * time.Millisecond) // Adjust this duration as needed
time.Sleep(350 * time.Millisecond) // Adjust this duration as needed
cancel()

// Allow some time for the goroutine to react to the context cancellation
Expand Down

0 comments on commit 1cb5438

Please sign in to comment.