Skip to content

Commit

Permalink
fix emulators
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed May 5, 2022
1 parent 4ade53f commit 2e6a3ae
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .github/emulator/start-emulator.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh -eux

docker pull -q gcr.io/google.com/cloudsdktool/cloud-sdk:342.0.0-emulators
docker pull -q gcr.io/google.com/cloudsdktool/cloud-sdk:384.0.1-emulators
CONTAINER=`docker run \
-d \
-p 8085:8085 \
gcr.io/google.com/cloudsdktool/cloud-sdk:342.0.0-emulators gcloud beta emulators $1 start --host-port=0.0.0.0:8085 --project=emulator-project`
gcr.io/google.com/cloudsdktool/cloud-sdk:384.0.1-emulators gcloud beta emulators $1 start --host-port=0.0.0.0:8085 --project=emulator-project`
sleep 10
docker logs $CONTAINER
4 changes: 0 additions & 4 deletions .github/workflows/bigtable-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ on:
push:
branches:
- main
paths:
- 'Bigtable/**'
pull_request:
paths:
- 'Bigtable/**'
name: Run Bigtable System Tests With Emulator
jobs:
test:
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/datastore-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: Run Datastore System Tests With Emulator
on:
push:
branches:
- main
paths:
- 'Datastore/**'
pull_request:
paths:
- 'Datastore/**'
name: Run Datastore System Tests With Emulator
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -26,7 +22,9 @@ jobs:

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-suggest -d Datastore/
composer config minimum-stability dev -d Datastore/
composer config repositories.local path "../Core" -d Datastore
composer require "google/cloud-core:*" -d Datastore/
- name: Run system tests
run: |
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/firestore-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ on:
push:
branches:
- main
paths:
- 'Firestore/**'
pull_request:
paths:
- 'Firestore/**'
name: Run Firestore System Tests With Emulator
jobs:
test:
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pubsub-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ on:
push:
branches:
- main
paths:
- 'PubSub/**'
pull_request:
paths:
- 'PubSub/**'
name: Run PubSub System Tests With Emulator
jobs:
test:
Expand All @@ -22,11 +18,13 @@ jobs:
with:
php-version: '7.4'
tools: pecl
extensions: grpc-1.38.0
extensions: grpc

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-suggest -d PubSub/
composer config minimum-stability dev -d PubSub/
composer config repositories.local path "../Core" -d PubSub
composer require "google/cloud-core:*" -d PubSub/
- name: Run system tests
run: |
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/spanner-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ on:
push:
branches:
- main
paths:
- 'Spanner/**'
pull_request:
paths:
- 'Spanner/**'
name: Run Spanner System Tests With Emulator
jobs:
php-test:
test:
runs-on: ubuntu-latest

services:
Expand Down Expand Up @@ -39,10 +35,12 @@ jobs:
with:
php-version: '7.4'
tools: pecl
extensions: bcmath, grpc-1.37.1
extensions: bcmath, grpc

- name: Install dependencies
run: |
composer config minimum-stability dev -d Spanner/
composer config repositories.local --json '{"type":"path", "url": "../Core", "options": {"versions": {"google/cloud-core": "1.45"}}}' -d Spanner
composer update --prefer-dist --no-interaction --no-suggest -d Spanner/
- name: Run system tests
Expand Down
1 change: 0 additions & 1 deletion Datastore/tests/Unit/Connection/GrpcTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class GrpcTest extends TestCase
use ExpectException;
use GrpcTestTrait;
use GrpcTrait;
use ExpectException;

const PROJECT_ID = 'my-project';

Expand Down
3 changes: 1 addition & 2 deletions Datastore/tests/Unit/DatastoreClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@
*/
class DatastoreClientTest extends TestCase
{
use ExpectException;
use DatastoreOperationRefreshTrait;
use GrpcTestTrait;
use ExpectException;
use GrpcTestTrait;

const PROJECT = 'example-project';
const TRANSACTION = 'transaction-id';
Expand Down
1 change: 0 additions & 1 deletion Datastore/tests/Unit/DatastoreSessionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*/
class DatastoreSessionHandlerTest extends TestCase
{
use ExpectException;
use AssertIsType;
use ExpectException;

Expand Down
1 change: 0 additions & 1 deletion Datastore/tests/Unit/EntityMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*/
class EntityMapperTest extends TestCase
{
use ExpectException;
use AssertIsType;
use ExpectException;

Expand Down
1 change: 0 additions & 1 deletion Datastore/tests/Unit/OperationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
*/
class OperationTest extends TestCase
{
use ExpectException;
use AssertIsType;
use ExpectException;

Expand Down
58 changes: 28 additions & 30 deletions Spanner/tests/System/ReadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
use Google\Cloud\Spanner\KeyRange;
use Google\Cloud\Spanner\KeySet;
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
use Yoast\PHPUnitPolyfills\Polyfills\AssertStringContains;

/**
* @group spanner
* @group spanner-read
*/
class ReadTest extends SpannerTestCase
{
use AssertStringContains;
use ExpectException;

private static $readTableName;
Expand Down Expand Up @@ -86,8 +84,8 @@ public function testRangeReadSingleKeyOpen()

$res = $db->read(self::$rangeTableName, $keyset, array_keys(self::$dataset[0]));
$rows = iterator_to_array($res->rows());
$this->assertStringNotContainsString(self::$dataset[0], $rows);
$this->assertStringNotContainsString(self::$dataset[10], $rows);
$this->assertNotContains(self::$dataset[0], $rows);
$this->assertNotContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -108,8 +106,8 @@ public function testRangeReadSingleKeyClosed()

$res = $db->read(self::$rangeTableName, $keyset, array_keys(self::$dataset[0]));
$rows = iterator_to_array($res->rows());
$this->assertStringContainsString(self::$dataset[0], $rows);
$this->assertStringContainsString(self::$dataset[10], $rows);
$this->assertContains(self::$dataset[0], $rows);
$this->assertContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -129,8 +127,8 @@ public function testRangeReadSingleKeyOpenClosed()

$res = $db->read(self::$rangeTableName, $keyset, array_keys(self::$dataset[0]));
$rows = iterator_to_array($res->rows());
$this->assertStringNotContainsString(self::$dataset[0], $rows);
$this->assertStringContainsString(self::$dataset[10], $rows);
$this->assertNotContains(self::$dataset[0], $rows);
$this->assertContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -150,8 +148,8 @@ public function testRangeReadSingleKeyClosedOpen()

$res = $db->read(self::$rangeTableName, $keyset, array_keys(self::$dataset[0]));
$rows = iterator_to_array($res->rows());
$this->assertStringContainsString(self::$dataset[0], $rows);
$this->assertStringNotContainsString(self::$dataset[10], $rows);
$this->assertContains(self::$dataset[0], $rows);
$this->assertNotContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -170,8 +168,8 @@ public function testRangeReadPartialKeyOpen()

$res = $db->read(self::$rangeTableName, $keyset, array_keys(self::$dataset[0]));
$rows = iterator_to_array($res->rows());
$this->assertStringNotContainsString(self::$dataset[0], $rows);
$this->assertStringNotContainsString(self::$dataset[10], $rows);
$this->assertNotContains(self::$dataset[0], $rows);
$this->assertNotContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -192,8 +190,8 @@ public function testRangeReadPartialKeyClosed()

$res = $db->read(self::$rangeTableName, $keyset, array_keys(self::$dataset[0]));
$rows = iterator_to_array($res->rows());
$this->assertStringContainsString(self::$dataset[0], $rows);
$this->assertStringContainsString(self::$dataset[10], $rows);
$this->assertContains(self::$dataset[0], $rows);
$this->assertContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -214,8 +212,8 @@ public function testRangeReadIndexSingleKeyOpen()
'index' => $this->getIndexName(self::$rangeTableName, 'complex')
]);
$rows = iterator_to_array($res->rows());
$this->assertStringNotContainsString(self::$dataset[0], $rows);
$this->assertStringNotContainsString(self::$dataset[10], $rows);
$this->assertNotContains(self::$dataset[0], $rows);
$this->assertNotContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -238,8 +236,8 @@ public function testRangeReadIndexSingleKeyClosed()
'index' => $this->getIndexName(self::$rangeTableName, 'complex')
]);
$rows = iterator_to_array($res->rows());
$this->assertStringContainsString(self::$dataset[0], $rows);
$this->assertStringContainsString(self::$dataset[10], $rows);
$this->assertContains(self::$dataset[0], $rows);
$this->assertContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -261,8 +259,8 @@ public function testRangeReadIndexSingleKeyOpenClosed()
'index' => $this->getIndexName(self::$rangeTableName, 'complex')
]);
$rows = iterator_to_array($res->rows());
$this->assertStringNotContainsString(self::$dataset[0], $rows);
$this->assertStringContainsString(self::$dataset[10], $rows);
$this->assertNotContains(self::$dataset[0], $rows);
$this->assertContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -284,8 +282,8 @@ public function testRangeReadIndexSingleKeyClosedOpen()
'index' => $this->getIndexName(self::$rangeTableName, 'complex')
]);
$rows = iterator_to_array($res->rows());
$this->assertStringContainsString(self::$dataset[0], $rows);
$this->assertStringNotContainsString(self::$dataset[10], $rows);
$this->assertContains(self::$dataset[0], $rows);
$this->assertNotContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -306,8 +304,8 @@ public function testRangeReadIndexPartialKeyOpen()
'index' => $this->getIndexName(self::$rangeTableName, 'complex')
]);
$rows = iterator_to_array($res->rows());
$this->assertStringNotContainsString(self::$dataset[0], $rows);
$this->assertStringNotContainsString(self::$dataset[10], $rows);
$this->assertNotContains(self::$dataset[0], $rows);
$this->assertNotContains(self::$dataset[10], $rows);
}

/**
Expand All @@ -330,8 +328,8 @@ public function testRangeReadIndexPartialKeyClosed()
'index' => $this->getIndexName(self::$rangeTableName, 'complex')
]);
$rows = iterator_to_array($res->rows());
$this->assertStringContainsString(self::$dataset[0], $rows);
$this->assertStringContainsString(self::$dataset[10], $rows);
$this->assertContains(self::$dataset[0], $rows);
$this->assertContains(self::$dataset[10], $rows);
}

/**
Expand Down Expand Up @@ -400,8 +398,8 @@ public function testReadPoint()
$res = $db->read(self::$readTableName, $keyset, array_keys($dataset[0]));
$rows = $res->rows();
foreach ($rows as $index => $row) {
$this->assertStringContainsString($row, $dataset);
$this->assertStringContainsString($row, $points);
$this->assertContains($row, $dataset);
$this->assertContains($row, $points);
}
}

Expand Down Expand Up @@ -430,8 +428,8 @@ public function testReadPointOverIndex()
]);
$rows = $res->rows();
foreach ($rows as $index => $row) {
$this->assertStringContainsString($row, $dataset);
$this->assertStringContainsString($row, $points);
$this->assertContains($row, $dataset);
$this->assertContains($row, $points);
}
}

Expand Down
4 changes: 2 additions & 2 deletions dev/src/DocGenerator/DocBlock/DescriptionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ private function lex(string $contents) : array
(?:
# Because we did not catch the tag delimiters earlier, we must be explicit with them here.
# Notice that this also matches "{}", as a way to later introduce it as an escape sequence.
{(?1)?\}
\{(?1)?\}
|
# Make sure we match hanging "{".
{
\{
)
# Match content after the nested inline tag.
[^{}]*
Expand Down
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="GcTestListener" file="Core/src/Testing/GcTestListener.php"/>
</listeners>
<php>
<ini name="memory_limit" value="2048M"/>
</php>
<listeners>
<listener class="GcTestListener" file="Core/src/Testing/GcTestListener.php"/>
</listeners>
</phpunit>

0 comments on commit 2e6a3ae

Please sign in to comment.