Skip to content

Commit dab44dd

Browse files
committed
Disable RevisionsTest::testCanListRevisionsBin for RavenDB v5.2
1 parent 07f818a commit dab44dd

File tree

12 files changed

+57
-43
lines changed

12 files changed

+57
-43
lines changed

.github/workflows/RavenClient.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313

14+
strategy:
15+
matrix:
16+
php-versions: [ "8.1", "8.2" ]
17+
serverVersion: [ "5.2", "5.4" ]
18+
fail-fast: false
19+
1420
env:
1521
RAVENDB_BUILD_TYPE: nightly
1622
RAVEN_License: ${{ secrets.RAVEN_LICENSE }}
@@ -21,12 +27,8 @@ jobs:
2127
RAVENDB_PHP_TEST_CA_PATH: "/usr/local/share/ca-certificates/ca.crt"
2228
RAVENDB_TEST_CLIENT_CERT_PATH: "./certs/java.pem"
2329

30+
SERVER_VERSION: ${{ matrix.serverVersion }}
2431

25-
strategy:
26-
matrix:
27-
php-versions: [ "8.1", "8.2" ]
28-
serverVersion: [ "5.2", "5.4" ]
29-
fail-fast: false
3032

3133
steps:
3234
- name: Check out repository code

tests/Infrastructure/DisableOnPullRequestCondition.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/Infrastructure/TestRunGuard.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace tests\RavenDB\Infrastructure;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
class TestRunGuard
8+
{
9+
public static string $ENV_RAVEN_LICENSE = "RAVEN_LICENSE";
10+
public static string $SERVER_VERSION = "SERVER_VERSION";
11+
12+
public static function disableTestIfLicenseNotAvailable(TestCase $testCase): void
13+
{
14+
$ravenLicense = getenv(self::$ENV_RAVEN_LICENSE);
15+
if (empty($ravenLicense)) {
16+
$testCase->markTestSkipped("Test disabled on Pull Request. License not available.");
17+
}
18+
}
19+
20+
public static function disableTestForRaven52(TestCase $testCase): void
21+
{
22+
$serverVersion = getenv(self::$SERVER_VERSION);
23+
if ($serverVersion == '5.2') {
24+
$testCase->markTestSkipped("Test disabled for RavenDB version 5.2.");
25+
}
26+
}
27+
}

tests/Test/Client/RevisionsTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use RavenDB\Exceptions\RavenException;
1818
use tests\RavenDB\Infrastructure\Entity\Company;
1919
use tests\RavenDB\Infrastructure\Entity\User;
20+
use tests\RavenDB\Infrastructure\TestRunGuard;
2021
use tests\RavenDB\RemoteTestBase;
2122
use Throwable;
2223

@@ -90,6 +91,8 @@ public function testRevisions(): void
9091

9192
public function testCanListRevisionsBin(): void
9293
{
94+
TestRunGuard::disableTestForRaven52($this);
95+
9396
$store = $this->getDocumentStore();
9497
try {
9598
$this->setupRevisions($store, false, 4);
@@ -112,7 +115,7 @@ public function testCanListRevisionsBin(): void
112115
$session->close();
113116
}
114117

115-
$revisionsBinEntryCommand = new GetRevisionsBinEntryCommand(PHP_INT_MAX, 20);
118+
$revisionsBinEntryCommand = new GetRevisionsBinEntryCommand(0, 20);
116119
$store->getRequestExecutor()->execute($revisionsBinEntryCommand);
117120

118121
$result = $revisionsBinEntryCommand->getResult();

tests/Test/Client/TimeSeries/TimeSeriesConfigurationTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use RavenDB\ServerWide\GetDatabaseRecordOperation;
2020
use RavenDB\Type\Duration;
2121
use RavenDB\Utils\DateUtils;
22-
use tests\RavenDB\Infrastructure\DisableOnPullRequestCondition;
22+
use tests\RavenDB\Infrastructure\TestRunGuard;
2323
use tests\RavenDB\Infrastructure\Entity\User;
2424
use tests\RavenDB\RemoteTestBase;
2525
use Throwable;
@@ -52,7 +52,7 @@ public function testDeserialization(): void
5252

5353
public function testCanConfigureTimeSeries(): void
5454
{
55-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
55+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
5656

5757
$store = $this->getDocumentStore();
5858
try {
@@ -188,7 +188,7 @@ public function testNotValidConfigureShouldThrow(): void
188188

189189
public function testCanExecuteSimpleRollup(): void
190190
{
191-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
191+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
192192

193193
$store = $this->getDocumentStore();
194194
try {
@@ -260,7 +260,7 @@ public function testCanExecuteSimpleRollup(): void
260260

261261
public function testCanConfigureTimeSeries2(): void
262262
{
263-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
263+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
264264

265265
$store = $this->getDocumentStore();
266266
try {
@@ -328,7 +328,7 @@ public function testCanConfigureTimeSeries2(): void
328328

329329
public function testCanConfigureTimeSeries3(): void
330330
{
331-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
331+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
332332
$store = $this->getDocumentStore();
333333
try {
334334
$store->timeSeries()->setPolicy(User::class, "By15SecondsFor1Minute", TimeValue::ofSeconds(15), TimeValue::ofSeconds(60));

tests/Test/Client/TimeSeries/_TimeSeriesTypedSessionTest/TimeSeriesTypedSessionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use RavenDB\ServerWide\GetDatabaseRecordOperation;
1919
use RavenDB\Type\Duration;
2020
use RavenDB\Utils\DateUtils;
21-
use tests\RavenDB\Infrastructure\DisableOnPullRequestCondition;
21+
use tests\RavenDB\Infrastructure\TestRunGuard;
2222
use tests\RavenDB\Infrastructure\Entity\Company;
2323
use tests\RavenDB\Infrastructure\Entity\User;
2424
use tests\RavenDB\RemoteTestBase;
@@ -502,7 +502,7 @@ public function testCanQueryTimeSeriesAggregation_NoSelectOrGroupBy(): void
502502

503503
public function testCanWorkWithRollupTimeSeries(): void
504504
{
505-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
505+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
506506

507507
$store = $this->getDocumentStore();
508508
try {
@@ -621,7 +621,7 @@ public function testCanWorkWithRollupTimeSeries(): void
621621

622622
public function testCanWorkWithRollupTimeSeries2(): void
623623
{
624-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
624+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
625625

626626
$store = $this->getDocumentStore();
627627
try {

tests/Test/Issues/RavenDB_15753Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use RavenDB\Documents\Indexes\AdditionalAssemblySet;
88
use RavenDB\Documents\Indexes\IndexDefinition;
99
use RavenDB\Documents\Operations\Indexes\PutIndexesOperation;
10-
use tests\RavenDB\Infrastructure\DisableOnPullRequestCondition;
10+
use tests\RavenDB\Infrastructure\TestRunGuard;
1111
use tests\RavenDB\RemoteTestBase;
1212
use Throwable;
1313

@@ -17,7 +17,7 @@ public function setUp(): void
1717
{
1818
parent::setUp();
1919

20-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
20+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
2121
}
2222

2323
/** @doesNotPerformAssertions */

tests/Test/Issues/RavenDB_16060Test/RavenDB_16060Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use RavenDB\Type\Duration;
1919
use RavenDB\Type\ExtendedArrayObject;
2020
use RavenDB\Utils\DateUtils;
21-
use tests\RavenDB\Infrastructure\DisableOnPullRequestCondition;
21+
use tests\RavenDB\Infrastructure\TestRunGuard;
2222
use tests\RavenDB\Infrastructure\Entity\User;
2323
use tests\RavenDB\RemoteTestBase;
2424
use tests\RavenDB\Test\Client\TimeSeries\_TimeSeriesTypedSessionTest\StockPrice;
@@ -28,7 +28,7 @@ class RavenDB_16060Test extends RemoteTestBase
2828
public function setUp(): void
2929
{
3030
parent::setUp();
31-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
31+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
3232
}
3333

3434
public function testCanIncludeTypedTimeSeries(): void

tests/Test/Server/Documents/CompressAllCollectionsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
use RavenDB\ServerWide\DocumentsCompressionConfiguration;
77
use RavenDB\ServerWide\GetDatabaseRecordOperation;
88
use RavenDB\ServerWide\Operations\DocumentsCompression\UpdateDocumentsCompressionConfigurationOperation;
9-
use tests\RavenDB\Infrastructure\DisableOnPullRequestCondition;
9+
use tests\RavenDB\Infrastructure\TestRunGuard;
1010
use tests\RavenDB\RemoteTestBase;
1111

1212
class CompressAllCollectionsTest extends RemoteTestBase
1313
{
1414
public function setUp(): void
1515
{
16-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
16+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
1717

1818
parent::setUp();
1919
}

tests/Test/Server/Etl/Raven/EtlTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use RavenDB\Documents\Operations\OngoingTasks\DeleteOngoingTaskOperation;
1616
use RavenDB\Documents\Operations\OngoingTasks\OngoingTaskState;
1717
use RavenDB\Documents\Operations\OngoingTasks\OngoingTaskType;
18-
use tests\RavenDB\Infrastructure\DisableOnPullRequestCondition;
18+
use tests\RavenDB\Infrastructure\TestRunGuard;
1919
use tests\RavenDB\Infrastructure\Entity\User;
2020
use tests\RavenDB\ReplicationTestBase;
2121

@@ -25,7 +25,7 @@ public function setUp(): void
2525
{
2626
parent::setUp();
2727

28-
DisableOnPullRequestCondition::evaluateExecutionCondition($this);
28+
TestRunGuard::disableTestIfLicenseNotAvailable($this);
2929
}
3030

3131
public function testCanAddEtl(): void

0 commit comments

Comments
 (0)