]> granicus.if.org Git - esp-idf/commitdiff
esp_http_server : Test added to check limit on max_open_sockets config option
authorAnurag Kar <anurag.kar@espressif.com>
Wed, 3 Apr 2019 13:31:40 +0000 (19:01 +0530)
committerAnurag Kar <anurag.kar@espressif.com>
Mon, 8 Apr 2019 05:52:12 +0000 (11:22 +0530)
components/esp_http_server/test/test_http_server.c

index 682a54d039a492f5473cc6532a71c4db67c7f1c6..186df6c9bcb92a58ed3524a44045afd176814fd5 100644 (file)
@@ -232,3 +232,22 @@ TEST_CASE("URI Wildcard Matcher Tests", "[HTTP SERVER]")
         ut++;
     }
 }
+
+TEST_CASE("Max Allowed Sockets Test", "[HTTP SERVER]")
+{
+    test_case_uses_tcpip();
+
+    httpd_handle_t hd;
+    httpd_config_t config = HTTPD_DEFAULT_CONFIG();
+
+    /* Starting server with default config options should pass */
+    TEST_ASSERT(httpd_start(&hd, &config) == ESP_OK);
+    TEST_ASSERT(httpd_stop(hd) == ESP_OK);
+
+    /* Default value of max_open_sockets is already set as per
+     * maximum limit imposed by LWIP. Increasing this beyond the
+     * maximum allowed value, without increasing LWIP limit,
+     * should fail */
+    config.max_open_sockets += 1;
+    TEST_ASSERT(httpd_start(&hd, &config) != ESP_OK);
+}