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: package-testing/sdk-test-runner/README.md
+108Lines changed: 108 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,47 @@ docker run \
26
26
SDK_NAME=eppo/php-sdk yarn dev
27
27
```
28
28
29
+
### Client SDK Mode
30
+
31
+
TODO: Update this section when client testing is available at the test-sdk.sh level (requires build out of custom client build solution).
32
+
33
+
Limited support is currently available for testing client SDKs. To test an SDK Client Relay, start an API server, start the test runner in client mode, then start up the SDK client.
34
+
35
+
```shell
36
+
docker run \
37
+
--rm -d \
38
+
-v ./test-data:/app/test-data \
39
+
-p 5000:5000 \
40
+
-t Eppo-exp/test-api-server:local
41
+
42
+
../<SDK_DIR>/build-and-run.sh
43
+
44
+
SDK_NAME=android yarn dev --type=client
45
+
46
+
# Start client application to auto-connect
47
+
```
48
+
49
+
Or, use the latest docker image of the test runner
50
+
51
+
```shell
52
+
53
+
docker run \
54
+
--rm \
55
+
--name test-runner \
56
+
-e SDK_NAME=android \
57
+
-p 3000:3000 \
58
+
-v ./test-data:/app/test-data:ro \
59
+
-t Eppo-exp/sdk-test-runner \
60
+
--type=client
61
+
62
+
```
63
+
64
+
Once the Client application conencts to the test-runner, it will proceed to send test cases over the established `socket.io` connection.
65
+
29
66
#### Command line arguments
30
67
31
68
`--junit=<filepath>` records results in junit xml format to specified file
@@ -54,6 +92,7 @@ The following env variable can be set when running the `test-sdk.sh` script
54
92
The following components are required to use the the package test runner with a new SDK
55
93
56
94
1. An **SDK relay server**. This is a REST server running at `localhost:4000` resonding to the [Asssignment and Bandit Request API](#sdk-relay-server)
95
+
1. OR, an **SDK relay client**. This is a client application that connects to the SDK test runner via `socket.io` and responses to [Assignment requests](#sdk-relay-client)
57
96
2. A `build-and-run.sh` file which, given a properly configured environment, [builds the SDK Relay Server application](#build-and-runsh)**using the specified version of the SDK package**.
58
97
59
98
The following are key components derived from above which allow for convenient and consistent dev-ops.
@@ -66,6 +105,75 @@ Finally, these are the advanced items to integrate the new package test into our
66
105
1. Github Action to run test configured for SDK (TODO: Create example)
67
106
2. Github workflows (in SDK repository and `sdk-test-data` repository) to run the test. (TODO: create example)
68
107
108
+
### SDK Relay Client
109
+
110
+
This is a client application which connects to the test runner via `socket.io` and waits for assignment requests ("client" SDKs do not yet support bandits). The interface for assignment request and responses is the same as the server API detailed below, with the exception that requests will be sent to a `socket.io` channel instead of via HTTP POST. The SDK Relay client sends a `READY` message to the test runner and then listens for requests under the same paths as the SDK Server API. See the example below from the Android relay.
111
+
112
+
```java
113
+
114
+
// Some code omitted; see repo for full implementation
115
+
116
+
mSocket.on("/sdk/reset", onSdkReset);
117
+
mSocket.on("/flags/v1/assignment", onNewAssignment); // Same path as server request.
The test runner sends assignment and bandit action requests to the SDK Relay Server which calls `EppoClient` and returns the results to the test runner. The paths and data packets are outlined below in [API](#api). Environment variables set the host and port for the Relay Server to listen on as well as the Eppo API server and port (for `EppoClient` initialization). For development of the SDK Relay server, start a local copy of the [Test API Server](../testing-api/) to serve the flag/bandit configuration, then use this handy [Postman workspace](https://www.postman.com/material-meteorologist-42730907/typotter-eppo/collection/5bjhdzy/relay-server-testing?action=share&creator=38014089) to issue requests to the relay server without having to blast it with the test runner.
0 commit comments