Skip to content

Commit

Permalink
test: fix expectations with ID zero
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beaumont <[email protected]>
  • Loading branch information
michaelbeaumont committed Jul 10, 2024
1 parent 19af5fb commit 4a7f4b1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/extensions/filters/udp/dns_filter/dns_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1863,12 +1863,11 @@ TEST_F(DnsFilterTest, NotImplementedQueryTest) {
EXPECT_EQ(0, config_->stats().downstream_rx_invalid_queries_.value());
}

TEST_F(DnsFilterTest, NoTransactionIdTest) {
TEST_F(DnsFilterTest, ZeroTransactionIdTest) {
InSequence s;

setup(forward_query_off_config);
// This buffer has an invalid Transaction ID. We should return an error
// to the client
// This buffer has a Transaction ID of zero. This is not an error.
constexpr char dns_request[] = {
0x00, 0x00, // Transaction ID
0x01, 0x20, // Flags
Expand All @@ -1888,8 +1887,8 @@ TEST_F(DnsFilterTest, NoTransactionIdTest) {
sendQueryFromClient("10.0.0.1:1000", query);

response_ctx_ = ResponseValidator::createResponseContext(udp_response_, counters_);
EXPECT_FALSE(response_ctx_->parse_status_);
EXPECT_EQ(DNS_RESPONSE_CODE_FORMAT_ERROR, response_ctx_->getQueryResponseCode());
EXPECT_TRUE(response_ctx_->parse_status_);
EXPECT_EQ(DNS_RESPONSE_CODE_NOT_IMPLEMENTED, response_ctx_->getQueryResponseCode());
}

TEST_F(DnsFilterTest, InvalidShortBufferTest) {
Expand Down

0 comments on commit 4a7f4b1

Please sign in to comment.