]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notification: add negative test case to test boost:parse:url. 66316/head
authorKrunal Chheda <kchheda3@bloomberg.net>
Wed, 19 Nov 2025 16:30:18 +0000 (11:30 -0500)
committerKrunal Chheda <kchheda3@bloomberg.net>
Fri, 21 Nov 2025 16:02:53 +0000 (11:02 -0500)
Signed-off-by: kchheda3 <kchheda3@bloomberg.net>
src/test/rgw/test_rgw_url.cc

index 2b036c3444ea0fe3ff48a19e98f73ec6e8522a79..32216d3069332f5354e38c9c0ac4eac505053eaa 100644 (file)
@@ -91,13 +91,44 @@ TEST(TestURL, DifferentSchema)
     EXPECT_STREQ(host.c_str(), "example.com"); 
 }
 
-TEST(TestURL, InvalidHost)
+TEST(TestURL, InvalidUrl)
 {
-    std::string host;
-    std::string user;
-    std::string password;
-    const std::string url = "http://exa_mple.com";
-    ASSERT_FALSE(parse_url_authority(url, host, user, password));
+  std::string host, user, password;
+  EXPECT_FALSE(parse_url_authority("not a valid url", host, user, password));
+}
+
+TEST(TestURL, EmptyString)
+{
+  std::string host, user, password;
+  EXPECT_FALSE(parse_url_authority("", host, user, password));
+}
+
+TEST(TestURL, MalformedScheme)
+{
+  std::string host, user, password;
+  EXPECT_FALSE(
+      parse_url_authority("ht!tp://example.com", host, user, password));
+}
+
+TEST(TestURL, InvalidCharactersInHost)
+{
+  std::string host, user, password;
+  EXPECT_FALSE(
+      parse_url_authority("http://exa mple.com", host, user, password));
+}
+
+TEST(TestURL, MissingScheme)
+{
+  std::string host, user, password;
+  EXPECT_FALSE(parse_url_authority("example.com", host, user, password));
+}
+
+TEST(TestURL, SpecialCharactersInUserinfo)
+{
+  std::string host, user, password;
+  EXPECT_FALSE(
+      parse_url_authority(
+          "http://us er:pass@example.com", host, user, password));
 }
 
 TEST(TestURL, WithPath)