mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Run httpbin docker image locally in CI (#3778)
This commit is contained in:
parent
765a17d374
commit
b198438f25
3 changed files with 23 additions and 5 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -83,8 +83,10 @@ jobs:
|
||||||
- name: Test (Ubuntu)
|
- name: Test (Ubuntu)
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
run: |
|
run: |
|
||||||
|
docker pull kennethreitz/httpbin
|
||||||
docker pull ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
|
docker pull ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
|
||||||
docker run --network=host --detach ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
|
docker run --network=host --detach ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
|
||||||
|
docker run -p 9051:80 --detach kennethreitz/httpbin
|
||||||
./bin/chatterino-test --platform minimal
|
./bin/chatterino-test --platform minimal
|
||||||
working-directory: build-test
|
working-directory: build-test
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
8
tests/README.md
Normal file
8
tests/README.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
To run tests all tests you will need to run the `kennethreitz/httpbin` and `ghcr.io/chatterino/twitch-pubsub-server-test:latest` docker images
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --network=host --detach ghcr.io/chatterino/twitch-pubsub-server-test:latest
|
||||||
|
docker run -p 9051:80 --detach kennethreitz/httpbin
|
||||||
|
```
|
|
@ -13,9 +13,17 @@ using namespace chatterino;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static QString getStatusURL(int code)
|
// Change to http://httpbin.org if you don't want to run the docker image yourself to test this
|
||||||
|
const char *const HTTPBIN_BASE_URL = "http://127.0.0.1:9051";
|
||||||
|
|
||||||
|
QString getStatusURL(int code)
|
||||||
{
|
{
|
||||||
return QString("http://httpbin.org/status/%1").arg(code);
|
return QString("%1/status/%2").arg(HTTPBIN_BASE_URL).arg(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getDelayURL(int delay)
|
||||||
|
{
|
||||||
|
return QString("%1/delay/%2").arg(HTTPBIN_BASE_URL).arg(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -201,7 +209,7 @@ TEST(NetworkRequest, TimeoutTimingOut)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
|
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
|
||||||
|
|
||||||
auto url = "http://httpbin.org/delay/5";
|
auto url = getDelayURL(5);
|
||||||
|
|
||||||
std::mutex mut;
|
std::mutex mut;
|
||||||
bool requestDone = false;
|
bool requestDone = false;
|
||||||
|
@ -248,7 +256,7 @@ TEST(NetworkRequest, TimeoutNotTimingOut)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
|
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
|
||||||
|
|
||||||
auto url = "http://httpbin.org/delay/1";
|
auto url = getDelayURL(1);
|
||||||
|
|
||||||
std::mutex mut;
|
std::mutex mut;
|
||||||
bool requestDone = false;
|
bool requestDone = false;
|
||||||
|
@ -293,7 +301,7 @@ TEST(NetworkRequest, FinallyCallbackOnTimeout)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
|
EXPECT_TRUE(NetworkManager::workerThread.isRunning());
|
||||||
|
|
||||||
auto url = "http://httpbin.org/delay/5";
|
auto url = getDelayURL(5);
|
||||||
|
|
||||||
std::mutex mut;
|
std::mutex mut;
|
||||||
bool requestDone = false;
|
bool requestDone = false;
|
||||||
|
|
Loading…
Reference in a new issue