Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ba34f25
feat: add deployment tests, remove unused scripts
bshaffer Apr 5, 2021
32122f7
Deprecate GOOGLE_CLOUD_PROJECT env var
Apr 6, 2021
899b931
Add slack env var
Apr 6, 2021
2a70896
misc updates to fix deployment tests
bshaffer Apr 6, 2021
ee0ec3e
Another round of GCF fixes
Apr 7, 2021
a4bbfe4
GCF slack, take 2
Apr 7, 2021
36aae36
fix cloud run deployment test
bshaffer Apr 7, 2021
53e5464
Fix pubsub test
Apr 10, 2021
db72914
Merge branch 'master' into add-deployment-tests
bshaffer Apr 13, 2021
519459d
Increase firebase remote config sleep time
Apr 13, 2021
8c8a730
Merge branch 'master' into add-deployment-tests
bshaffer Apr 13, 2021
77bf4ad
Fix firestore project ID logic
Apr 14, 2021
bb0c41c
infinite retries: reduce max event age
Apr 14, 2021
76076b7
further reduce max event age
Apr 14, 2021
867222f
increase retry count for helloworld_pubsub
Apr 14, 2021
a5297b5
Add required sleep calls back to tests + fix RTDB namespaces
Apr 14, 2021
07777bf
Remove manual sleeps + use php-tools' instead
Apr 21, 2021
745811f
Fix PHPUnit deprecation warning
Apr 28, 2021
40260a0
Tweak retry times (attempt at fixing log fetch error)
Apr 28, 2021
c6da82a
chore(appengine): fix (some) GAE failures
Apr 28, 2021
9d9064d
Fix bad firestore project ID
Apr 28, 2021
32403bc
Add Redis details
Apr 28, 2021
d28fce5
chore(GAE storage): install missing yaml pkg
Apr 28, 2021
d96ebec
chore(slim on GAE): add missing error middleware
Apr 28, 2021
525c11f
chore(GAE logging): use string-contains to display output on failure
Apr 28, 2021
d51c51b
chore(GAE wordpress): update composer.json + PHPUnit spec
Apr 28, 2021
0032983
Fix missed-spot in 7.2 -> 7.4 app.yaml change
Apr 28, 2021
e6ff458
Wordpress phpunit, take 2
Apr 28, 2021
1448fb9
chore(GAE storage): delete [these] unused samples
Apr 29, 2021
e3c4ad4
chore(GAE bookshelf): add missing yaml package
Apr 29, 2021
49a6334
fix incorrect firestore project id
Apr 29, 2021
2c82dac
fix: typo
Apr 30, 2021
12d1a63
fix: use proper project ID
Apr 30, 2021
929c186
fix: tweak remote config retry params
Apr 30, 2021
14a7e70
Skip broken wordpress sample's test
May 3, 2021
ebd261e
Skip broken laravel sample's test
May 3, 2021
35e8675
Fix deprecated assertContains
May 6, 2021
015d6bc
Fix bad project ID spec for firestore
May 11, 2021
4c7252d
Tweak logging GAE sample's retry params
May 11, 2021
e97c9d0
Fix bad project ID spec, take 2
May 11, 2021
b4383f2
Try to fix compilation error in Laravel sample
May 12, 2021
a4d0cec
Fix Laravel compilation issue, take 2
May 18, 2021
55664e3
Completely skip the laravel tests in phpunit.xml
May 18, 2021
1f0216c
DEBUG: add status-code check to remote config test
May 18, 2021
bf4ed90
Increase deploy-test timeouts
May 18, 2021
a95b874
Increase remote config retry count, take 2
May 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .kokoro/deploy_gae.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php74"
}

# Run the deployment tests
env_vars: {
key: "RUN_DEPLOYMENT_TESTS"
value: "true"
}

# Only run deployment tests for App Engine Standard
env_vars: {
key: "TEST_DIRECTORIES"
value: "appengine/standard"
}
19 changes: 19 additions & 0 deletions .kokoro/deploy_gcf.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php74"
}

# Run the deployment tests
env_vars: {
key: "RUN_DEPLOYMENT_TESTS"
value: "true"
}

# Only run deployment tests for Cloud Functions
env_vars: {
key: "TEST_DIRECTORIES"
value: "functions"
}
19 changes: 19 additions & 0 deletions .kokoro/deploy_misc.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php74"
}

# Run the deployment tests
env_vars: {
key: "RUN_DEPLOYMENT_TESTS"
value: "true"
}

# Run deployment tests for Cloud Run, EventArc Endpoints
env_vars: {
key: "TEST_DIRECTORIES"
value: "endpoints eventarc run"
}
Binary file modified .kokoro/secrets.sh.enc
Binary file not shown.
9 changes: 6 additions & 3 deletions appengine/standard/errorreporting/test/DeployTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DeployTest extends TestCase

public function setUp(): void
{
$this->projectId = getenv('GOOGLE_PROJECT_ID');
self::$projectId = getenv('GOOGLE_PROJECT_ID');
}

public function testIndex()
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testFatalErrors()
private function verifyReportedError($message, $retryCount = 5)
{
$errorStats = new ErrorStatsServiceClient();
$projectName = $errorStats->projectName($this->projectId);
$projectName = $errorStats->projectName(self::$projectId);

$timeRange = (new QueryTimeRange())
->setPeriod(QueryTimeRange_Period::PERIOD_1_HOUR);
Expand All @@ -111,7 +111,10 @@ private function verifyReportedError($message, $retryCount = 5)
$message
) {
$messages = [];
$response = $errorStats->listGroupStats($projectName, $timeRange);
$response = $errorStats->listGroupStats(
$projectName,
['timeRange' => $timeRange]
);
foreach ($response->iterateAllElements() as $groupStat) {
$response = $errorStats->listEvents($projectName, $groupStat->getGroup()->getGroupId(), [
'timeRange' => $timeRange,
Expand Down
3 changes: 2 additions & 1 deletion appengine/standard/getting-started/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"slim/slim": "^4.0",
"slim/psr7": "^1.0",
"slim/twig-view": "^3.0",
"php-di/slim-bridge": "^3.1"
"php-di/slim-bridge": "^3.1",
"symfony/yaml": "^5.2"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 2 additions & 3 deletions appengine/standard/laravel-framework/app-dbsessions.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Use the PHP 7.3 runtime (BETA) by replacing "php72" below with "php73"
runtime: php72
runtime: php74

env_variables:
## Put production environment variables here.
Expand All @@ -17,4 +16,4 @@ env_variables:
## To use Stackdriver logging in your Laravel application, copy
## "app/Logging/CreateStackdriverLogger.php" and "config/logging.php"
## into your Laravel application. Then uncomment the following line:
# LOG_CHANNEL: stackdriver
# LOG_CHANNEL: stackdriver
5 changes: 5 additions & 0 deletions appengine/standard/laravel-framework/bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
App\Exceptions\Handler::class
);

$app->singleton(
Illuminate\Foundation\Exceptions\Handler::class,
App\Exceptions\Handler::class
);

# [START] Set the storage path to the environment variable APP_STORAGE
/*
|--------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion appengine/standard/laravel-framework/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<phpunit bootstrap="../../../testing/bootstrap.php">
<testsuites>
<testsuite name="AppEngine for PHP 7.2 Laravel Framework test">
<directory>test</directory>
<!-- This sample is BROKEN! See issue link below. -->
<!-- https://github.com/GoogleCloudPlatform/php-docs-samples/issues/1349 -->
<!-- <directory>test</directory> -->
</testsuite>
</testsuites>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public static function beforeDeploy()

public function testHomepage()
{
$this->markTestSkipped(
'This sample is BROKEN. See https://github.com/GoogleCloudPlatform/php-docs-samples/issues/1349'
);

// Access the blog top page
$resp = $this->client->get('/');
$this->assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public static function beforeDeploy()

public function testLogging()
{
$this->markTestSkipped(
'This sample is BROKEN. See https://github.com/GoogleCloudPlatform/php-docs-samples/issues/1349'
);

$logging = new LoggingClient([
'projectId' => self::getProjectId()
]);
Expand Down Expand Up @@ -98,6 +102,10 @@ public function testLogging()

public function testErrorReporting()
{
$this->markTestSkipped(
'This sample is BROKEN. See https://github.com/GoogleCloudPlatform/php-docs-samples/issues/1349'
);

$logging = new LoggingClient([
'projectId' => self::getProjectId()
]);
Expand Down
4 changes: 4 additions & 0 deletions appengine/standard/laravel-framework/test/DeployTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public static function beforeDeploy()

public function testHomepage()
{
$this->markTestSkipped(
'This sample is BROKEN. See https://github.com/GoogleCloudPlatform/php-docs-samples/issues/1349'
);

// Access the blog top page
$resp = $this->client->get('/');
$this->assertEquals('200', $resp->getStatusCode(), 'top page status code');
Expand Down
18 changes: 8 additions & 10 deletions appengine/standard/logging/test/DeployTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public function testIndex()
$response->getBody()->getContents()
);

$this->verifyLog('This will show up as log level INFO', 'info', 3);
$this->verifyLog('This will show up as log level INFO', 'info', 5);

// These should succeed if the above call has too.
// Thus, they need fewer retries!
$this->verifyLog('This will show up as log level WARNING', 'warning');
$this->verifyLog('This will show up as log level ERROR', 'error');
}

private function verifyLog($message, $level, $retryCount = 2)
private function verifyLog($message, $level, $retryCount = 3)
{
$fiveMinAgo = date(\DateTime::RFC3339, strtotime('-5 minutes'));
$filter = sprintf(
Expand All @@ -59,8 +59,8 @@ private function verifyLog($message, $level, $retryCount = 2)
$fiveMinAgo
);
$logOptions = [
'pageSize' => 20,
'resultLimit' => 20,
'pageSize' => 50,
'resultLimit' => 50,
'filter' => $filter,
];
$logging = new LoggingClient();
Expand All @@ -71,16 +71,14 @@ private function verifyLog($message, $level, $retryCount = 2)
$logOptions,
$message
) {
// Concatenate all relevant log messages.
$logs = $logging->entries($logOptions);
$matched = false;
$actual = '';
foreach ($logs as $log) {
if ($log->info()['jsonPayload']['message'] == $message) {
$matched = true;
break;
}
$actual .= $log->info()['jsonPayload']['message'];
}

$this->assertTrue($matched);
$this->assertStringContainsString($message, $actual);
}, $retryCount, true);
}
}
1 change: 1 addition & 0 deletions appengine/standard/slim-framework/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# [START gae_slim_front_controller]
$app = AppFactory::create();
$app->addRoutingMiddleware();
$app->addErrorMiddleware(true, true, true);

$app->get('/', function (Request $request, Response $response) {
// Use the Null Coalesce Operator in PHP7
Expand Down
57 changes: 0 additions & 57 deletions appengine/standard/storage/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions appengine/standard/storage/app.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions appengine/standard/storage/composer.json

This file was deleted.

Loading