You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TESTING.md
+12-11
Original file line number
Diff line number
Diff line change
@@ -14,22 +14,22 @@ This library provides tools to help write tests for code that uses the following
14
14
You can test against a temporary local datastore by following these steps:
15
15
16
16
1. Start the local datastore emulator using `LocalGcdHelper`. This can be done in two ways:
17
-
- Run `LocalGcdHelper.java`'s `main` method with arguments `START` and (optionally) `--port=<port number>`. This will create a temporary folder on your computer and bind `localhost:<port number>` for communication with the local datastore. The port number is an optional argument. If no port number is specified, port 8080 will be used.
18
-
- Call `LocalGcdHelper.start(<project ID>, <port number>)` before running your tests. Save the `LocalGcdHelper` object returned so that you can stop the emulator later.
19
-
20
-
2. In your program, create and use a datastore whose host is set host to `localhost:<port number>`. For example,
17
+
- Run `LocalGcdHelper.java`'s `main` method with `START` provided as an argument, followed by optional arguments `--port=<port number>` and `--consistency=<float between 0 and 1, inclusive>`. This will create a temporary folder on your computer and bind `localhost:<port number>` for communication with the local datastore. If no port number is specified, port 8080 will be used. The consistency setting controls the fraction of Datastore writes that are immediately visible in global queries.
18
+
- Use the `LocalGcdHelper.start(String projectId, int port, double consistency)` method before running your tests. For example, you can use the following code to start the local Datastore on any available port with the consistency set to 0.9:
19
+
```java
20
+
int port =LocalGcdHelper.findAvailablePort(LocalGcdHelper.DEFAULT_PORT);
- If you ran `LocalGcdHelper.java`'s `main` function to start the emulator, run `LocalGcdHelper.java`'s `main` method with arguments `STOP` and (optionally) `--port=<port number>`. If the port is not supplied, the program will attempt to close the last port started.
32
-
- If you ran `LocalGcdHelper.start()`to start the emulator, call the `stop()` method on the `LocalGcdHelper` object returned by `LocalGcdHelper.start()`.
32
+
- If you ran the `LocalGcdHelper.start` method to start the emulator, call the `stop()` method on the `LocalGcdHelper` object returned by `LocalGcdHelper.start`.
33
33
34
34
#### On a remote machine
35
35
@@ -39,6 +39,7 @@ You can test against a remote datastore emulator as well. To do this, set the `
0 commit comments