|
| 1 | +import Tabs from '@theme/Tabs'; |
| 2 | +import TabItem from '@theme/TabItem'; |
| 3 | + |
1 | 4 | # Test |
2 | 5 |
|
3 | 6 | Testing of your ROFL-powered applications and services depends on the [ROFL |
@@ -30,17 +33,57 @@ Simply spin up the [`sapphire-localnet`] Docker image and bind-mount the folder |
30 | 33 | that contains your `rofl.yaml`: |
31 | 34 |
|
32 | 35 | ```shell |
33 | | -docker run -it -p8544-8548:8544-8548 -v .:/rofls ghcr.io/oasisprotocol/sapphire-localnet |
| 36 | +docker run -it -p8544-8549:8544-8549 -v .:/rofls ghcr.io/oasisprotocol/sapphire-localnet |
34 | 37 | ``` |
35 | 38 |
|
36 | 39 | In a few moments you should see an output like |
37 | 40 |
|
38 | 41 | ``` |
39 | | -* TDX ROFL detected. Localnet appd service will be accessible on the host via rofl-appd.sock in the shared volume |
| 42 | +* TDX ROFL detected. Localnet appd service will be accessible via UNIX socket and TCP port |
40 | 43 | ``` |
41 | 44 |
|
42 | 45 | which means `rofl-appd.sock` will appear in the bind-mounted folder on your host |
43 | | -when the Localnet spins up. |
| 46 | +when the Localnet spins up. The appd service is also exposed via TCP on port |
| 47 | +`8549`, if you cannot use the UNIX socket on your host (e.g. macOS): |
| 48 | + |
| 49 | +<Tabs> |
| 50 | +<TabItem value="UNIX socket (Linux)"> |
| 51 | +```shell title="Shell" |
| 52 | +curl --unix-socket ./rofl-appd.sock http://localhost/rofl/v1/app/id |
| 53 | +``` |
| 54 | + |
| 55 | +[ROFL clients] can connect to the UNIX socket as follows: |
| 56 | + |
| 57 | +```python title="Python" |
| 58 | +from oasis_rofl_client import RoflClient |
| 59 | +client = RoflClient(url="./rofl-appd.sock") |
| 60 | +``` |
| 61 | + |
| 62 | +```typescript title="TypeScript" |
| 63 | +import { RoflClient } from '@oasisprotocol/rofl-client'; |
| 64 | +const client = new RoflClient({ url: './rofl-appd.sock' }); |
| 65 | +``` |
| 66 | +</TabItem> |
| 67 | +<TabItem value="TCP port (macOS, Linux)"> |
| 68 | +```shell title="Shell" |
| 69 | +curl http://localhost:8549/rofl/v1/app/id |
| 70 | +``` |
| 71 | + |
| 72 | +[ROFL clients] can connect to the TCP port as follows: |
| 73 | + |
| 74 | +```python title="Python" |
| 75 | +from oasis_rofl_client import RoflClient |
| 76 | +client = RoflClient(url="http://localhost:8549") |
| 77 | +``` |
| 78 | + |
| 79 | +```typescript title="TypeScript" |
| 80 | +import { RoflClient } from '@oasisprotocol/rofl-client'; |
| 81 | +const client = new RoflClient({ url: 'http://localhost:8549' }); |
| 82 | +``` |
| 83 | +</TabItem> |
| 84 | +</Tabs> |
| 85 | + |
| 86 | +[ROFL clients]: ../features/appd.md#rofl-clients |
44 | 87 |
|
45 | 88 | Next, it's time to spin up your services and run tests. If you use the same |
46 | 89 | `compose.yaml` for production and testing, the following one-liner may come |
|
0 commit comments