Skip to content

Conversation

@grayside
Copy link
Contributor

@grayside grayside commented Nov 2, 2018

This PR updates the Cloud Tasks create task sample to Beta v2.3 and moves it inside AppEngine in alignment with other Cloud Tasks for App Engine Queue samples.

Additional, there is a "task handler" app which demonstrates how to handle a Cloud Tasks http request for work to be done.

The snippet is following new structural trends demonstrated in Bigquery.

@grayside grayside requested a review from tmatsuo November 2, 2018 21:05
@@ -0,0 +1,81 @@
<?php
/**
* Copyright 2018 Google Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new files, copyright should say Google LLC. instead of Google Inc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack

@@ -0,0 +1 @@
runtime: php72 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit: add newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

print $output;
}

// [END cloud_tasks_appengine_quickstart] No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

@@ -0,0 +1,68 @@
<?php
/**
* Copyright 2018 Google Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

'project' => self::$projectId,
'queue' => $queue,
'location' => $location
$output = $this->runSnippet('create_task', [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who deletes the queue after the test? Won't it fail if you run the test 2nd time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was set up by Brent earlier, I assume it's in Kokoro or that he means to leave the queue up permanently (which is what we're doing in Go). In theory the queue can take 2 minutes to deploy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think it's a problem of either 1) resource leak if the test runner script assign unique queue name every time, or 2) test failure on the 2nd run because the creation fails.

Also I suggest that you check if this test is really executed on kokoro. It might be just skipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will double-check this, I thought we had a fixed queue that just happened to be configured in the job.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The queue name is my-appengine-queue and is pre-created.
  2. The create_task test result is as follows:
running phpunit in appengine/php72/tasks/snippets
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.10
Configuration: /tmpfs/src/github/php-docs-samples/appengine/php72/tasks/snippets/phpunit.xml.dist
Error:         No code coverage driver is available

.                                                                   1 / 1 (100%)

Time: 573 ms, Memory: 8.00MB

OK (1 test, 1 assertion)

The app/handler tests were skipped:

running phpunit in appengine/php72/tasks/apps/handler
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.10
Configuration: /tmpfs/src/github/php-docs-samples/appengine/php72/tasks/apps/handler/phpunit.xml.dist
Error:         No code coverage driver is available

SS                                                                  2 / 2 (100%)

Time: 26 ms, Memory: 4.00MB

There were 2 skipped tests:

1) DeployTest
To run this test, set RUN_DEPLOYMENT_TESTS env to true.

/tmpfs/src/github/php-docs-samples/appengine/php72/tasks/apps/handler/vendor/google/cloud-tools/src/TestUtils/AppEngineDeploymentTrait.php:93

2) DeployTest
To run this test, set RUN_DEPLOYMENT_TESTS env to true.

/tmpfs/src/github/php-docs-samples/appengine/php72/tasks/apps/handler/vendor/google/cloud-tools/src/TestUtils/AppEngineDeploymentTrait.php:93

OK, but incomplete, skipped, or risky tests!
Tests: 4, Assertions: 0, Skipped: 2.

Not sure what the practice is around using the RUN_DEPLOYMENT_TESTS environment variable. @tmatsuo do you have insight on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, the test only uses the pre-created queue and there's no resource leak. Thanks for confirming this.

The deployment tests are usually executed in nightly run, or in full system test.

'project' => self::$projectId,
'queue' => $queue,
'location' => $location
$output = $this->runSnippet('create_task', [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, the test only uses the pre-created queue and there's no resource leak. Thanks for confirming this.

The deployment tests are usually executed in nightly run, or in full system test.

@grayside grayside merged commit 8d21038 into master Nov 9, 2018
@grayside grayside deleted the appengine/tasks-beta branch November 9, 2018 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants