Skip to content

Commit

Permalink
feat: added more ways to run samples-gin
Browse files Browse the repository at this point in the history
Signed-off-by: Animesh <kurosakiichigo.songoku@gmail.com>
  • Loading branch information
Sonichigo committed Sep 13, 2023
1 parent 65eeba8 commit a744a3c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
11 changes: 10 additions & 1 deletion versioned_docs/version-2.0.0/quickstart/samples-gin.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,17 @@ Keploy can be used on Linux & Windows through [Docker](https://docs.docker.com/e

### Create Keploy Alias

To establish a network for your application using Keploy on Docker, follow these steps.

If you're using a docker-compose network, replace keploy-network with your app's docker_compose_network_name below.

```shell
docker network create keploy-network
```

Then, create an alias for Keploy:
```bash
alias keploy='sudo docker run --name keploy-v2 -p 16789:16789 --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'
alias keploy='sudo docker run --name keploy-v2 --network keploy-network -p 16789:16789 --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'
```

### Let's start the MongoDB Instance
Expand Down
14 changes: 12 additions & 2 deletions versioned_docs/version-2.0.0/server/linux/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,20 @@ Voilà! 🧑🏻‍💻 We have the server running!

### Creating Alias

We need to create a he alias for the Keploy since we are using the Docker.
### Create Keploy Alias

To establish a network for your application using Keploy on Docker, follow these steps.

If you're using a docker-compose network, replace keploy-network with your app's docker_compose_network_name below.

```shell
alias keploy='sudo docker run --name keploy-v2 -p 16789:16789 --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm pull ghcr.io/keploy/keploy'
docker network create keploy-network
```

Then, create an alias for Keploy:

```bash
alias keploy='sudo docker run --name keploy-v2 --network keploy-network -p 16789:16789 --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'
```

#### Capture the Testcases
Expand Down
19 changes: 15 additions & 4 deletions versioned_docs/version-2.0.0/server/macos/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@ colima start

## Creating Alias

We need to create the Alias for Keploy since we are using the Docker.
### Create Keploy Alias

To establish a network for your application using Keploy on Docker, follow these steps.

If you're using a docker-compose network, replace keploy-network with your app's docker_compose_network_name below.

```shell
alias keploy='sudo docker run --name keploy-v2 -p 16789:16789 --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm pull ghcr.io/keploy/keploy'
docker network create keploy-network
```

Then, create an alias for Keploy:

```bash
alias keploy='sudo docker run --name keploy-v2 --network keploy-network -p 16789:16789 --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'
```

### Creating Alias
Expand All @@ -64,16 +74,18 @@ alias keploy='sudo docker run --name keploy-v2 -p 16789:16789 --network keploy-n
### Recording Testcases and Data Mocks

Here are few points to consider before recording!

- If you're running via **docker compose**, ensure to include the `<CONTAINER_NAME>` under your application service in the docker-compose.yaml file [like this](https://github.com/keploy/samples-python/blob/9d6cf40da2eb75f6e035bedfb30e54564785d5c9/flask-mongo/docker-compose.yml#L14).

- Change the **network name** (`--network` flag) from `keploy-network` to your custom network if you changed it above.
- Change the **network name** (`--network` flag) from `keploy-network` to your custom network if you changed it above.
- `Docker_CMD_to_run_user_container` refers to the Docker **command for launching** the application.

Utilize the keploy alias we created to capture testcases. **Execute** the following command within your application's **root directory**.

```shell
keploy record -c "Docker_CMD_to_run_user_container --network keploy-network" --containerName "<containerName>"
```

Perform API calls using tools like [Hoppscotch](https://hoppscotch.io/), [Postman](https://www.postman.com/), or cURL commands.

Keploy will capture the API calls you've conducted, generating test suites comprising **testcases (KTests) and data mocks (KMocks)** in `YAML` format.
Expand All @@ -84,7 +96,6 @@ Now, use the keployV2 Alias we created to execute the testcases. Follow these st

When using **docker-compose** to start the application, it's important to ensure that the `--containerName` parameter matches the container name in your `docker-compose.yaml` file.


```shell
keploy test -c "Docker_CMD_to_run_user_container --network keploy-network" --containerName "<containerName>" --delay 20
```
Expand Down

0 comments on commit a744a3c

Please sign in to comment.