Skip to content

Commit 0039ae3

Browse files
authored
docs: move test suite information to CONTRIBUTING.md (#442)
1 parent 3f5cd07 commit 0039ae3

2 files changed

Lines changed: 58 additions & 56 deletions

File tree

packages/django-google-spanner/CONTRIBUTING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,61 @@ information on using pull requests.
2626

2727
This project follows [Google's Open Source Community
2828
Guidelines](https://opensource.google/conduct/).
29+
30+
## Tests
31+
32+
### Functional tests
33+
We have functional tests for individual components that can be run by
34+
```shell
35+
tox
36+
```
37+
38+
### Django integration tests
39+
We run full integration tests with continuous integration on Google Cloud Build with Kokoro.
40+
41+
The tests to be run are specified in file [django_test_apps.txt](./django_test_apps.txt)
42+
43+
There are 2 ways to run the tests:
44+
45+
#### django_test_suite.sh
46+
47+
This method requires an already existing Cloud Spanner instance.
48+
Expected environment variables:
49+
50+
##### Environment variables
51+
Variable|Description|Comment
52+
---|---|---
53+
`GOOGLE_APPLICATION_CREDENTIALS`|The Google Application Credentials file|For example `GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json`
54+
`PROJECT_ID`|The project id of the Google Application credentials being used|For example `PROJECT_ID=appdev-soda-spanner-staging`
55+
`DJANGO_TEST_APPS`|The Django test suite apps to run|For example `DJANGO_TEST_APPS="basic i18n admin_views"`
56+
`SPANNER_TEST_INSTANCE`|The Cloud Spanner instance to use, it MUST exist before running tests|For example `SPANNER_TEST_INSTANCE="django-tests"`
57+
`DJANGO_TESTS_DIR`|The directory into which Django has been cloned to run the test suite|For example `DJANGO_TESTS_DIR=django_tests`
58+
59+
##### Example run
60+
```shell
61+
GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json \
62+
PROJECT_ID=appdev-soda DJANGO_TEST_APPS="expressions i18n" \
63+
SPANNER_TEST_INSTANCE=django-tests ./django_tests_suite.sh
64+
```
65+
66+
#### Parallelization script
67+
68+
This method shards tests over multiple builds, and over available cores.
69+
70+
##### Environment variables
71+
To run the tests locally, you'll need the following environment variables.
72+
73+
Variable|Description|Comment
74+
---|---|---
75+
`GOOGLE_APPLICATION_CREDENTIALS`|The Google Application Credentials file|For example `GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json`
76+
`PROJECT_ID`|The project id of the Google Application credentials being used|For example `PROJECT_ID=appdev-soda-spanner-staging`
77+
`DJANGO_WORKER_COUNT`|The number of parallel jobs to split the tests amongst|To get all the tests run by one process, use a cout of 1, so `DJANGO_WORKER_COUNT=1`
78+
`DJANGO_WORKER_INDEX`|The zero based index of the parallel job number, to run tests, it is correlated with `DJANGO_WORKER_COUNT` and an offset to figure out which tests to run with this job|
79+
`django_test_apps.txt`|The listing of Django apps to run|Set the apps you'd like to be run in parallel
80+
81+
##### Example run
82+
```shell
83+
GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json \
84+
PROJECT_ID=appdev-soda DJANGO_TEST_APPS="expressions i18n" \
85+
DJANGO_WORKER_COUNT=1 DJANGO_WORKER_INDEX=0SPANNER_TEST_INSTANCE=django-tests ./bin/parallelize_tests_linux
86+
```

packages/django-google-spanner/README.md

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -80,62 +80,6 @@ DATABASES = {
8080
}
8181
```
8282

83-
## Functional tests
84-
We have functional tests for individual components that can be run by
85-
```shell
86-
tox
87-
```
88-
89-
## Django integration tests
90-
We run full integration tests with continuous integration on Google Cloud Build with Kokoro.
91-
92-
The tests to be run are specified in file [django_test_apps.txt](./django_test_apps.txt)
93-
94-
There are 2 ways to run the tests:
95-
96-
### django_test_suite.sh
97-
98-
This method requires an already existing Cloud Spanner instance.
99-
Expected environment variables:
100-
101-
#### Environment variables
102-
Variable|Description|Comment
103-
---|---|---
104-
`GOOGLE_APPLICATION_CREDENTIALS`|The Google Application Credentials file|For example `GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json`
105-
`PROJECT_ID`|The project id of the Google Application credentials being used|For example `PROJECT_ID=appdev-soda-spanner-staging`
106-
`DJANGO_TEST_APPS`|The Django test suite apps to run|For example `DJANGO_TEST_APPS="basic i18n admin_views"`
107-
`SPANNER_TEST_INSTANCE`|The Cloud Spanner instance to use, it MUST exist before running tests|For example `SPANNER_TEST_INSTANCE="django-tests"`
108-
`DJANGO_TESTS_DIR`|The directory into which Django has been cloned to run the test suite|For example `DJANGO_TESTS_DIR=django_tests`
109-
110-
#### Example run
111-
```shell
112-
GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json \
113-
PROJECT_ID=appdev-soda DJANGO_TEST_APPS="expressions i18n" \
114-
SPANNER_TEST_INSTANCE=django-tests ./django_tests_suite.sh
115-
```
116-
117-
### Parallelization script
118-
119-
This method shards tests over multiple builds, and over available cores.
120-
121-
#### Environment variables
122-
To run the tests locally, you'll need the following environment variables.
123-
124-
Variable|Description|Comment
125-
---|---|---
126-
`GOOGLE_APPLICATION_CREDENTIALS`|The Google Application Credentials file|For example `GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json`
127-
`PROJECT_ID`|The project id of the Google Application credentials being used|For example `PROJECT_ID=appdev-soda-spanner-staging`
128-
`DJANGO_WORKER_COUNT`|The number of parallel jobs to split the tests amongst|To get all the tests run by one process, use a cout of 1, so `DJANGO_WORKER_COUNT=1`
129-
`DJANGO_WORKER_INDEX`|The zero based index of the parallel job number, to run tests, it is correlated with `DJANGO_WORKER_COUNT` and an offset to figure out which tests to run with this job|
130-
`django_test_apps.txt`|The listing of Django apps to run|Set the apps you'd like to be run in parallel
131-
132-
#### Example run
133-
```shell
134-
GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/creds.json \
135-
PROJECT_ID=appdev-soda DJANGO_TEST_APPS="expressions i18n" \
136-
DJANGO_WORKER_COUNT=1 DJANGO_WORKER_INDEX=0SPANNER_TEST_INSTANCE=django-tests ./bin/parallelize_tests_linux
137-
```
138-
13983
## Limitations
14084

14185
Limitation|Comment|Resolution

0 commit comments

Comments
 (0)