Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Faisal Memon <fymemon@yahoo.com>
  • Loading branch information
faisal-memon committed Apr 5, 2024
1 parent 17ff269 commit 7a6c493
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/server/endpoints/authorized_entryfetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package endpoints
import (
"context"
"errors"
"regexp"
"sort"
"strconv"
"testing"
Expand Down Expand Up @@ -305,13 +304,14 @@ func TestRunUpdateCacheTaskPrunesExpiredAgents(t *testing.T) {

// Make sure nothing was pruned yet
for _, entry := range hook.AllEntries() {
require.NotRegexp(t, regexp.MustCompile(`Pruned \d* expired agents from entry cache`), entry.Message)
require.NotEqual(t, "Pruned expired agents from entry cache", entry.Message)
}

// Bump clock so entry expires and is pruned
clk.Add(defaultCacheReloadInterval)
clk.WaitForAfter(time.Second, "waiting for task to pause after expiring agent")
assert.Equal(t, "Pruned 1 expired agents from entry cache", hook.LastEntry().Message)
assert.Equal(t, 1, hook.LastEntry().Data["count"])
assert.Equal(t, "Pruned expired agents from entry cache", hook.LastEntry().Message)

// Stop the task
cancel()
Expand Down

0 comments on commit 7a6c493

Please sign in to comment.