Skip to content

Commit

Permalink
Disable BQ on valuesBy*
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkasemmler committed Jan 27, 2025
1 parent 2d72aee commit 076c5d7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/Backend/CommonPart1/DeleteRowsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ public function testTableDeleteRowsByFilter(array $filterParams, array $expected
{
$importFile = __DIR__ . '/../../_data/users.csv';
$tableId = $this->_client->createTableAsync($this->getTestBucketId(self::STAGE_IN), 'users', new CsvFile($importFile));
$tableInfo = $this->_client->getTable($tableId);
if ($this->isBigqueryWithNewDeleteRows($tableInfo['bucket']['backend'], $filterParams)) {
$this->markTestSkipped('BQ does not new params of valuesBy* yet');
}

$this->_client->deleteTableRows($tableId, $filterParams);
$tableInfo = $this->_client->getTable($tableId);

$data = $this->_client->getTableDataPreview($tableId);

Expand Down Expand Up @@ -63,9 +66,11 @@ public function testTableDeleteRowsByFilterAsQuery(array $filterParams, array $e
{
$importFile = __DIR__ . '/../../_data/users.csv';
$tableId = $this->_client->createTableAsync($this->getTestBucketId(self::STAGE_IN), 'users', new CsvFile($importFile));

$this->_client->deleteTableRowsAsQuery($tableId, $filterParams);
$tableInfo = $this->_client->getTable($tableId);
if ($this->isBigqueryWithNewDeleteRows($tableInfo['bucket']['backend'], $filterParams)) {
$this->markTestSkipped('BQ does not new params of valuesBy* yet');
}
$this->_client->deleteTableRowsAsQuery($tableId, $filterParams);

$data = $this->_client->getTableDataPreview($tableId);

Expand All @@ -75,6 +80,16 @@ public function testTableDeleteRowsByFilterAsQuery(array $filterParams, array $e
$this->assertArrayEqualsSorted($expectedTableContent, $parsedData, 0);
}

// because BQ does not support valuesByTableInStorage / valuesByTableInWorkspace yet/. Tmp fix
private function isBigqueryWithNewDeleteRows(string $backendName, array $filterParams): bool
{
return $backendName === 'bigquery' &&
array_key_exists('whereFilters', $filterParams) &&
count($filterParams) > 0 &&

Check failure on line 88 in tests/Backend/CommonPart1/DeleteRowsTest.php

View workflow job for this annotation

GitHub Actions / tests (8.1)

Comparison operation ">" between int<1, max> and 0 is always true.

Check failure on line 88 in tests/Backend/CommonPart1/DeleteRowsTest.php

View workflow job for this annotation

GitHub Actions / tests (8.2)

Comparison operation ">" between int<1, max> and 0 is always true.

Check failure on line 88 in tests/Backend/CommonPart1/DeleteRowsTest.php

View workflow job for this annotation

GitHub Actions / tests (8.3)

Comparison operation ">" between int<1, max> and 0 is always true.
(array_key_exists('valuesByTableInStorage', $filterParams['whereFilters'][0]) || array_key_exists('valuesByTableInWorkspace', $filterParams['whereFilters'][0])
);
}

public function testDeleteRowsMissingValuesShouldReturnUserError(): void
{
$importFile = __DIR__ . '/../../_data/users.csv';
Expand Down

0 comments on commit 076c5d7

Please sign in to comment.