Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
huikang committed Jul 24, 2023
1 parent 44f52d9 commit 28ab71e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ func TestAPI_AgentMembersOpts(t *testing.T) {
}

require.Equal(t, 1, len(members))

members, err = agent.MembersOpts(MembersOpts{
WAN: true,
Filter: `Tags["dc"] == notExist`,
})
if err != nil {
t.Fatalf("err: %v", err)
}
require.Equal(t, 0, len(members))

_, err = agent.MembersOpts(MembersOpts{
WAN: true,
Filter: `Tags["dc"] == invalid-bexpr-value`,
})
require.ErrorContains(t, err, "Failed to create boolean expression evaluator")
}

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

0 comments on commit 28ab71e

Please sign in to comment.