Skip to content

Commit e886d60

Browse files
committed
fix ci
1 parent b451a66 commit e886d60

File tree

7 files changed

+19
-13
lines changed

7 files changed

+19
-13
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Tests
22

33
on:
4-
push:
54
pull_request:
5+
# push: TODO P3 No tests on push because it causes an unresolved bug (no space left on device). This Smell a race condition.
66

77
jobs:
88

@@ -12,7 +12,8 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
php: ['7.2'] # TODO P1 TRY MORE VERSION (5.6, 7.0, 7.1, 7.3, 7.4)
15+
php: ['7.2', '7.3', '7.4']
16+
# TODO P2 PHP 8 Compatibility: Fix: Error: Class "Memcached" not found (https://github.com/crowdsecurity/php-cs-bouncer/runs/1491476055?check_suite_focus=true)
1617

1718
services:
1819
redis:

docs/how-it-works.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TODO reword this text.
1+
TODO P2 reword this text.
22

33
Sync Strategy
44
-------------

docs/technical-decisions.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ We don't use Swagger Codegen
3232

3333
We were not able to use this client with easen ex: impossible to get
3434
JSON data, it's seemd there is a bug with unserialization, we received
35-
an empty array.
35+
an empty array.
36+
37+
PHP 7.0+ compatibility
38+
----------------------
39+
40+
Why not PHP 5.6? This PHP version is no more supported since december 2018 (not even security fix!).
41+
42+
What about PHP 8? We are working on it. The current problem is that we have some troubles with PHP 8 + Memcached.

src/ApiCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function saveDeferred(CacheItem $item, int $ip, string $type, int $expir
8989
9090
Update the cached remediations from these new decisions.
9191
92-
TODO WRITE TESTS P2
92+
TODO P2 WRITE TESTS
9393
0 decisions
9494
3 known remediation type
9595
3 decisions but 1 unknown remediation type
@@ -186,7 +186,7 @@ private function miss(int $ip): string
186186
private function hit(int $ip): string
187187
{
188188
$remediations = $this->adapter->getItem((string) $ip)->get();
189-
// P2 TODO control before if date is not expired and if true, update cache item.
189+
// TODO P2 control before if date is not expired and if true, update cache item.
190190

191191
// We apply array values first because keys are ids.
192192
$firstRemediation = array_values($remediations)[0];

src/Constants.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ class Constants
1818
const CAPI_URL = 'https://api.crowdsec.net/v2/'; // TODO P2 get the correct one
1919

2020
/** @var string The user agent used to send request to LAPI or CAPI */
21-
const BASE_USER_AGENT = 'CrowdSec PHP Library/1.0.0'; // P3 TODO get the correct version
21+
const BASE_USER_AGENT = 'CrowdSec PHP Library/1.0.0'; // TODO P3 get the correct version
2222

2323
/** @var int The timeout when calling LAPI or CAPI */
2424
const API_TIMEOUT = 1; // TODO P2 get the correct one
2525

2626
/** @var array The list of each known remediation, sorted by priority */
27-
const ORDERED_REMEDIATIONS = ['ban', 'captcha']; // P2 TODO get the correct one
27+
const ORDERED_REMEDIATIONS = ['ban', 'captcha']; // TODO P2 get the correct one
2828
}

src/Remediation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static function sortRemediationByPriority(array $remediations): array
6363
/**
6464
* Parse "duration" entries returned from API to a number of seconds.
6565
*
66-
* TODO TEST P3
66+
* TODO P3 TEST
6767
* 9999h59m56.603445s
6868
* 10m33.3465483s
6969
* 33.3465483s
@@ -102,7 +102,7 @@ private static function parseDurationToSeconds(string $duration): int
102102
* Format a remediation item of a cache item.
103103
* This format use a minimal amount of data allowing less cache data consumption.
104104
*
105-
* TODO TESTS P3
105+
* TODO P3 TESTS
106106
*/
107107
public static function formatFromDecision(?array $decision): array
108108
{

tests/IpVerificationTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,14 @@ public function testCanVerifyIpInStreamModeWithCacheSystem(AbstractAdapter $cach
133133
$remediation1stCall = $bouncer->getRemediationForIp($blockedIp);
134134
$this->assertEquals('ban', $remediation1stCall);
135135

136-
// TODO P1 Add and remove decision and try updating cache
136+
// TODO P1 Add and remove decision and try updating cache with refreshBlocklistCache()
137137

138138
// Clear cache
139139
//$cacheAdapter->clear();
140140

141141
// Call the same thing for the second time (now it should be a cache miss)
142142
//$remediation2ndCall = $bouncer->getRemediationForIp($blockedIp);
143143
//$this->assertEquals('ban', $remediation2ndCall);
144-
145-
// TODO ADD new decisions to LAPI and test refreshBlocklistCache()
146144
}
147145

148146
/**

0 commit comments

Comments
 (0)