Skip to content

Commit 8695733

Browse files
committed
Create integration/README.md to document details of integration tests
1 parent 853c00f commit 8695733

3 files changed

Lines changed: 70 additions & 23 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -149,32 +149,13 @@ $ rake test:acceptance
149149

150150
The google-cloud-ruby integration tests are end-to-end tests that validate library functionality on real Google Cloud Platform hosting environments. The integration process deploys several Rack-based applications to Google Cloud Platform one by one, then validates google-cloud-ruby code by making requests to these test applications.
151151

152-
All integration tests require [Cloud SDK](https://cloud.google.com/sdk/) for deployment. Following the instructions in [Authentication guide](AUTHENTICATION.md) for installation and authentication. Make sure a project ID is set:
153-
```sh
154-
$ gcloud config set project PROJECT_ID
155-
```
152+
See the [integration/README.md](integration/README.md) for instructions on how to setup for the integration tests and other details.
156153

157-
#### Running integration tests on Google App Engine
158-
159-
To run the integration tests on Google App Engine:
154+
To run the integration tests:
160155
```sh
161-
$ rake integration:gae
156+
$ rake integration
162157
```
163158

164-
#### Running integration tests on Google Container Engine
165-
166-
Additinoal to Cloud SDK, Google Container Engine requires [docker](https://www.docker.com/) for building docker images, and the [Kubernetes commandline tool](http://kubernetes.io/docs/user-guide/kubectl-overview/) for image deployment.
167-
168-
Follow the [docker website](https://www.docker.com/products/docker) for docker installation instructions. The Kubernetes commandline tool can be installed through Cloud SDK:
169-
```sh
170-
$ gcloud components install kubectl
171-
```
172-
Make sure a [Google Container Engine Cluster](https://cloud.google.com/container-engine/docs/clusters/operations) with permissions to access all the GCP services this library implements is properly setup and ready to use. It's easier to create the Cluster through [Cloud Platform Console](https://console.cloud.google.com/kubernetes/list). Keep in mind once the Cluster is create, the service permissions cannot be updated.
173-
174-
To run the integration tests on Google Container Engine:
175-
```sh
176-
$ rake integration:gke
177-
```
178159

179160
## Coding Style
180161

‎Rakefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ namespace :integration do
675675
"http://#{project_id}.appspot-preview.com"
676676

677677
fail "You must provide a project_uri. e.g. rake " \
678-
"integration:gae[http://my-project.appspot.com]" if project_uri.nil?
678+
"integration:gae[http://my-project.appspot-preview.com]" if project_uri.nil?
679679

680680
test_apps = Dir.glob("integration/*_app").select {|f| File.directory? f}
681681

‎integration/README.md‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
## Integration Tests
2+
3+
The google-cloud-ruby integration tests are end-to-end tests that validate library functionality on real Google Cloud Platform hosting environments. The integration process deploys several Rack-based applications to Google Cloud Platform one by one, then validates google-cloud-ruby code by making requests to these test applications.
4+
5+
All integration tests require [Cloud SDK](https://cloud.google.com/sdk/) for deployment. Following the instructions in [Authentication guide](../AUTHENTICATION.md) for installation and authentication.
6+
7+
### Configuration
8+
First, make sure a Google Cloud Platform project is setup that satisfies the following requirements:
9+
* [Stackdriver Error Reporting API](https://console.cloud.google.com/apis/api/clouderrorreporting.googleapis.com/overview) is enabled.
10+
* Make sure a [Google Container Engine Cluster](https://cloud.google.com/container-engine/docs/clusters/operations) with permissions to access all the GCP services this library implements is properly setup and ready to use. It's easier to create the Cluster through [Cloud Platform Console](https://console.cloud.google.com/kubernetes/list). Keep in mind once the Cluster is create, the service permissions cannot be updated.
11+
12+
Once Google Cloud SDK is installed and authenticated, make sure the following items are also configured properly:
13+
* Project ID is set:
14+
```sh
15+
$ gcloud config set project PROJECT_ID
16+
```
17+
* Container Cluster is set:
18+
```sh
19+
$ gcloud config set container/cluster CLUSTER_NAME
20+
```
21+
* Extend Cloud Build timeout to an hour:
22+
```sh
23+
$ gcloud config set container/build_timeout 3600
24+
```
25+
Additinoal to Cloud SDK, Google Container Engine requires [docker](https://www.docker.com/) for building docker images, and the [Kubernetes commandline tool](http://kubernetes.io/docs/user-guide/kubectl-overview/) for image deployment.
26+
27+
Follow the [docker website](https://www.docker.com/products/docker) for docker installation instructions. The Kubernetes commandline tool can be installed through Cloud SDK:
28+
```sh
29+
$ gcloud components install kubectl
30+
```
31+
32+
### Usage
33+
To kick off the full integration test suite:
34+
```sh
35+
$ rake integration
36+
```
37+
38+
### Integration tests on Google App Engine
39+
To run the integration tests just on Google App Engine:
40+
```sh
41+
$ rake integration:gae
42+
```
43+
This rake task automates the Google App Engine deployment by deploying the google-cloud-ruby libraries with sample application using the `gcloud app deploy` shell command. Each of the sample applications contains an app.yaml.example file that defines specific deployment procedure for that application. For example, the [Rails 5 app.yaml.example](rails5_app/app.yaml.example) file defines a custom entrypoint that allows bundler to install the sample application's dependencies and launch the application.
44+
45+
After a successful deployment, each google-cloud-ruby libraries can then run its integration tests again the deployed sample application. For example, the [google-cloud-logging tests](google-cloud-logging/integration/) send HTTP requests to redefined routes on the sample application to trigger logs being generated. Then it's able to verify the result logs through gcloud sdk.
46+
47+
### Integration tests on Google Container Engine
48+
To run the integration tests on Google Container Engine:
49+
```sh
50+
$ rake integration:gke
51+
```
52+
Similar to the workflow of `integration:gae` task, the `integration:gke` task uses the Dockerfile.example file from each sample application as the template to build a docker image, deploy it to Google Container Registry, and deploy Google Container pods to launch the application. In the case of GKE pods configuration, all sample application shares a same configuration defined in [integration_rc.yaml.example](integration_rc.yaml.example) file.
53+
54+
After the integration tests finish run against the deployed GKE sample application, the `integration:gke` application is also able to clean up all the resources created during the deployment. These resources include local test docker image, GCR test docker image, GKE ReplicationController, and GKE pods.
55+
56+
### Integration tests on Google Compute Engine
57+
We're currently not supporting automated tests on Google Compute Engine environment for the following reasons:
58+
* Major functionalities such as metadata service accisibility, application default authentication are, operating system, and API accessibility are already covered by other automated tests.
59+
* Both GAE and GKE are currently hosted on GCE VMs.
60+
* It's harder to automate deployment on GCE environment than GAE or GKE, due to GCE's IaaS nature.
61+
62+
### Write tests
63+
64+
Each google-cloud-ruby libraries should define its own set of integration tests. It it doesn't already, make sure a corresponding `integration:gae` or `integration:gke` task exists at the package level. These tasks will be invoked by top level `integration` task when deployment is finished. Otherwise these package level tasks can also be invoked independently assume deployment already happened.
65+
66+
Common test cases defined in google-cloud-*/integration/ directory will be run on both GAE and GKE environments. Environment specific test cases can be defined in google-cloud-*/integration/gae/ or google-cloud-*/integration/gke/ directories. Such test cases will only be run against the corresponding environment.

0 commit comments

Comments
 (0)