You've already forked Traefik-Redis-Api
derpherp
This commit is contained in:
@@ -13,7 +13,6 @@ use Siteworxpro\Tests\Unit;
|
||||
|
||||
class MiddlewareServiceTest extends Unit
|
||||
{
|
||||
|
||||
public function testGerMiddlewareHttpAll(): void
|
||||
{
|
||||
$this->getAllMiddleware(ProtocolEnum::HTTP);
|
||||
@@ -39,10 +38,14 @@ class MiddlewareServiceTest extends Unit
|
||||
Redis::expects('scan')
|
||||
->with(0, ['MATCH' => 'traefik/' . $protocolEnum->getValue() . '/middlewares/*'])
|
||||
->andReturn([0, [
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/Host',
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Host',
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Port',
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Proto',
|
||||
'traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/Host',
|
||||
'traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Host',
|
||||
'traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Port',
|
||||
'traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Proto',
|
||||
]]);
|
||||
|
||||
$services = RedisClient::getAllMiddlewares($protocolEnum);
|
||||
@@ -70,25 +73,32 @@ class MiddlewareServiceTest extends Unit
|
||||
->with(0, ['MATCH' => 'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/*'])
|
||||
->andReturn([0, [
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/Host',
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Host',
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Port',
|
||||
'traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Proto',
|
||||
'traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Host',
|
||||
'traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Port',
|
||||
'traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Proto',
|
||||
]]);
|
||||
|
||||
Redis::expects('get')
|
||||
->with('traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/Host')
|
||||
->with('traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/Host')
|
||||
->andReturn('foo.localhost');
|
||||
|
||||
Redis::expects('get')
|
||||
->with('traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Host')
|
||||
->with('traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Host')
|
||||
->andReturn('foo.localhost');
|
||||
|
||||
Redis::expects('get')
|
||||
->with('traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Port')
|
||||
->with('traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Port')
|
||||
->andReturn('80');
|
||||
|
||||
Redis::expects('get')
|
||||
->with('traefik/' . $protocolEnum->getValue() . '/middlewares/foo/headers/customrequestheaders/X-Forwarded-Proto')
|
||||
->with('traefik/' . $protocolEnum->getValue() .
|
||||
'/middlewares/foo/headers/customrequestheaders/X-Forwarded-Proto')
|
||||
->andReturn('http');
|
||||
|
||||
$middleware = RedisClient::getMiddleware('foo', $protocolEnum);
|
||||
@@ -99,4 +109,4 @@ class MiddlewareServiceTest extends Unit
|
||||
$this->assertSame('80', $middleware['headers']['customrequestheaders']['X-Forwarded-Port']);
|
||||
$this->assertSame('http', $middleware['headers']['customrequestheaders']['X-Forwarded-Proto']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,10 @@ use Siteworxpro\Tests\Unit;
|
||||
|
||||
class ProtocolEnumTest extends Unit
|
||||
{
|
||||
|
||||
public function testFromString(): void
|
||||
{
|
||||
$this->assertEquals(ProtocolEnum::HTTP, ProtocolEnum::fromString('http'));
|
||||
$this->assertEquals(ProtocolEnum::TCP, ProtocolEnum::fromString('tcp'));
|
||||
$this->assertEquals(ProtocolEnum::UDP, ProtocolEnum::fromString('udp'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ use Siteworxpro\Tests\Unit;
|
||||
|
||||
class RedisClientServiceTest extends Unit
|
||||
{
|
||||
|
||||
public function testCreateServiceHttp(): void
|
||||
{
|
||||
$this->createTest(ProtocolEnum::HTTP);
|
||||
@@ -50,7 +49,8 @@ class RedisClientServiceTest extends Unit
|
||||
->andReturn([0, []]);
|
||||
|
||||
Redis::expects('set')
|
||||
->with('traefik/' . $protocol->getValue() . '/services/foo/loadbalancer/servers/server1/url', 'http://foo.localhost:80')
|
||||
->with('traefik/' . $protocol->getValue() .
|
||||
'/services/foo/loadbalancer/servers/server1/url', 'http://foo.localhost:80')
|
||||
->once()
|
||||
->andReturn(true);
|
||||
|
||||
@@ -140,4 +140,4 @@ class RedisClientServiceTest extends Unit
|
||||
$this->assertIsArray($services);
|
||||
$this->assertCount(2, $services);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user