Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Akhil Thampy <[email protected]>
  • Loading branch information
athampy committed Dec 16, 2019
1 parent ff16f6d commit 0b72b99
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/common/network/address_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,15 @@ TEST(PipeInstanceTest, AbstractNamespacePermission) {
const mode_t mode = 0777;
EXPECT_THROW_WITH_REGEX(PipeInstance address("@/foo", mode), EnvoyException,
"Cannot set mode for Abstract AF_UNIX sockets");

sockaddr_un sun;
sun.sun_family = AF_UNIX;
StringUtil::strlcpy(&sun.sun_path[1], "@/foo", sizeof sun.sun_path);
sun.sun_path[0] = '\0';
socklen_t ss_len = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sun.sun_path);

EXPECT_THROW_WITH_REGEX(PipeInstance address(&sun, ss_len, mode), EnvoyException,
"Cannot set mode for Abstract AF_UNIX sockets");
#endif
}

Expand Down

0 comments on commit 0b72b99

Please sign in to comment.