Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lgtm badge from README #147

Merged
merged 8 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .githooks/readme-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![CI](https://github.com/jbaldwin/liblifthttp/workflows/build/badge.svg)](https://github.com/jbaldwin/liblifthttp/workflows/build/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/jbaldwin/liblifthttp/badge.svg?branch=master)](https://coveralls.io/github/jbaldwin/liblifthttp?branch=master)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/jbaldwin/liblifthttp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/jbaldwin/liblifthttp/context:cpp)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/2625260f88524abfa2c2974ad9328e45)](https://www.codacy.com/gh/jbaldwin/liblifthttp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jbaldwin/liblifthttp&utm_campaign=Badge_Grade)
[![language][badge.language]][language]
[![license][badge.license]][license]
Expand Down Expand Up @@ -116,8 +115,8 @@ target_link_libraries(${PROJECT_NAME} PUBLIC lifthttp)

#### Running Tests
The tests are automatically run by GitHub Actions on all Pull Requests. They can also be ran locally with a default
localhost instance of `nginx`. To do so the CMake option `LIFT_LOCALHOST_TESTS=ON` must be set otherwise the tests
will use the hostname `nginx` setup in the CI settings. After building and starting `nginx` tests can be run by issuing:
localhost instance of `nginx` and `haproxy`. To do so the CMake option `LIFT_LOCALHOST_TESTS=ON` must be set otherwise the tests
will use the hostname `nginx` setup in the CI settings. After building and starting `nginx` and `haproxy` tests can be run by issuing:

```bash
# Invoke via cmake:
Expand All @@ -127,8 +126,10 @@ ctest -v
./test/liblifthttp_tests
```

Note there are now proxy http requests that utilize an `haproxy` instance. To run these locally you will also need
to start an instance of `haproxy`.
Note:
* `nginx` should be default install/configuration running on port `80`.
* `haproxy` should be running on port `*3128` with a backend pointing at the `nginx` instance. See `docker/build/haproxy/haproxy.cfg` to update the local configuration.


### Benchmarks
Using the example benchmark code and a local `nginx` instance serving its default welcome page. All benchmarks use `keep-alive` connections. The benchmark is compared against `wrk` as that is basically optimal performance since
Expand Down Expand Up @@ -169,7 +170,7 @@ Using `nginx` as the webserver with the default `fedora` configuration.

File bug reports, feature requests and questions using [GitHub Issues](https://github.com/jbaldwin/liblifthttp/issues)

Copyright © 2017-2022, Josh Baldwin
Copyright © 2017-2023, Josh Baldwin

[badge.language]: https://img.shields.io/badge/language-C%2B%2B17-yellow.svg
[badge.license]: https://img.shields.io/badge/license-Apache--2.0-blue
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![CI](https://github.com/jbaldwin/liblifthttp/workflows/build/badge.svg)](https://github.com/jbaldwin/liblifthttp/workflows/build/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/jbaldwin/liblifthttp/badge.svg?branch=master)](https://coveralls.io/github/jbaldwin/liblifthttp?branch=master)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/jbaldwin/liblifthttp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/jbaldwin/liblifthttp/context:cpp)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/2625260f88524abfa2c2974ad9328e45)](https://www.codacy.com/gh/jbaldwin/liblifthttp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jbaldwin/liblifthttp&utm_campaign=Badge_Grade)
[![language][badge.language]][language]
[![license][badge.license]][license]
Expand Down Expand Up @@ -199,8 +198,8 @@ target_link_libraries(${PROJECT_NAME} PUBLIC lifthttp)

#### Running Tests
The tests are automatically run by GitHub Actions on all Pull Requests. They can also be ran locally with a default
localhost instance of `nginx`. To do so the CMake option `LIFT_LOCALHOST_TESTS=ON` must be set otherwise the tests
will use the hostname `nginx` setup in the CI settings. After building and starting `nginx` tests can be run by issuing:
localhost instance of `nginx` and `haproxy`. To do so the CMake option `LIFT_LOCALHOST_TESTS=ON` must be set otherwise the tests
will use the hostname `nginx` setup in the CI settings. After building and starting `nginx` and `haproxy` tests can be run by issuing:

```bash
# Invoke via cmake:
Expand All @@ -210,8 +209,10 @@ ctest -v
./test/liblifthttp_tests
```

Note there are now proxy http requests that utilize an `haproxy` instance. To run these locally you will also need
to start an instance of `haproxy`.
Note:
* `nginx` should be default install/configuration running on port `80`.
* `haproxy` should be running on port `*3128` with a backend pointing at the `nginx` instance. See `docker/build/haproxy/haproxy.cfg` to update the local configuration.


### Benchmarks
Using the example benchmark code and a local `nginx` instance serving its default welcome page. All benchmarks use `keep-alive` connections. The benchmark is compared against `wrk` as that is basically optimal performance since
Expand Down Expand Up @@ -252,7 +253,7 @@ Using `nginx` as the webserver with the default `fedora` configuration.

File bug reports, feature requests and questions using [GitHub Issues](https://github.com/jbaldwin/liblifthttp/issues)

Copyright © 2017-2022, Josh Baldwin
Copyright © 2017-2023, Josh Baldwin

[badge.language]: https://img.shields.io/badge/language-C%2B%2B17-yellow.svg
[badge.license]: https://img.shields.io/badge/license-Apache--2.0-blue
Expand Down
6 changes: 3 additions & 3 deletions test/test_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TEST_CASE("proxy")
{
if (header.name() == "server")
{
REQUIRE(header.value() == "nginx/1.22.1");
REQUIRE(header.value().substr(0, 6) == "nginx/");
}
else if (header.name() == "content-length")
{
Expand Down Expand Up @@ -51,7 +51,7 @@ TEST_CASE("proxy Basic Auth")
{
if (header.name() == "server")
{
REQUIRE(header.value() == "nginx/1.22.1");
REQUIRE(header.value().substr(0, 6) == "nginx/");
}
else if (header.name() == "content-length")
{
Expand Down Expand Up @@ -84,7 +84,7 @@ TEST_CASE("proxy Any Auth")
{
if (header.name() == "server")
{
REQUIRE(header.value() == "nginx/1.22.1");
REQUIRE(header.value().substr(0, 6) == "nginx/");
}
else if (header.name() == "content-length")
{
Expand Down
41 changes: 22 additions & 19 deletions test/test_timesup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,41 @@ TEST_CASE("Timesup single request")

auto r = std::make_unique<lift::request>(
"http://www.reddit.com", // should be slow enough /shrug
std::chrono::milliseconds{25});
std::chrono::milliseconds{5});

client.start_request(
std::move(r),
[](std::unique_ptr<lift::request> rh, lift::response response) -> void
{
REQUIRE(response.lift_status() == lift::lift_status::timeout);
REQUIRE(response.status_code() == lift::http::status_code::http_504_gateway_timeout);
REQUIRE(response.total_time() == std::chrono::milliseconds{25});
REQUIRE(response.total_time() == std::chrono::milliseconds{5});
REQUIRE(response.num_connects() == 0);
REQUIRE(response.num_redirects() == 0);
});
}

TEST_CASE("Timesup two requests")
{
lift::client client{lift::client::options{.connect_timeout = std::chrono::seconds{1}}};
// TEST_CASE("Timesup two requests")
// {
// // TODO: This test requires a re-work with a proper "timeout" endpoint in nginx. It does not work against random
// // urls consistently.

std::vector<lift::request_ptr> requests{};
// lift::client client{lift::client::options{.connect_timeout = std::chrono::seconds{1}}};

auto callback = [](std::unique_ptr<lift::request> rh, lift::response response) -> void
{
REQUIRE(response.lift_status() == lift::lift_status::timeout);
REQUIRE(response.status_code() == lift::http::status_code::http_504_gateway_timeout);
REQUIRE(
(response.total_time() == std::chrono::milliseconds{25} ||
response.total_time() == std::chrono::milliseconds{50}));
};
// std::vector<lift::request_ptr> requests{};

// should be slow enough /shrug
requests.push_back(std::make_unique<lift::request>("http://www.reddit.com", std::chrono::milliseconds{25}));
requests.push_back(std::make_unique<lift::request>("http://www.reddit.com", std::chrono::milliseconds{50}));
// auto callback = [](std::unique_ptr<lift::request> rh, lift::response response) -> void
// {
// REQUIRE(response.lift_status() == lift::lift_status::timeout);
// REQUIRE(response.status_code() == lift::http::status_code::http_504_gateway_timeout);
// REQUIRE(
// (response.total_time() == std::chrono::milliseconds{5} ||
// response.total_time() == std::chrono::milliseconds{10}));
// };

client.start_requests(std::move(requests));
}
// // should be slow enough /shrug
// requests.push_back(std::make_unique<lift::request>("http://www.old.reddit.com", std::chrono::milliseconds{5}));
// requests.push_back(std::make_unique<lift::request>("http://www.old.reddit.com", std::chrono::milliseconds{10}));

// client.start_requests(std::move(requests), callback);
// }
Loading