Skip to content

Commit

Permalink
docs: added the code blocks and code Highlighting (#333)
Browse files Browse the repository at this point in the history
* Added the code blocks and code Highlighting

Signed-off-by: Aditya-eddy <aditya282003@gmail.com>

* Fixing the BuildErrors and Adding the suitable tags tocode

Signed-off-by: Aditya-eddy <aditya282003@gmail.com>

* Rest Changes

Signed-off-by: Aditya-eddy <aditya282003@gmail.com>

* fix: breaking urls

Signed-off-by: Neha Gupta <gneha21@yahoo.in>

---------

Signed-off-by: Aditya-eddy <aditya282003@gmail.com>
Signed-off-by: Neha Gupta <gneha21@yahoo.in>
Co-authored-by: Aditya-eddy <aditya282003@gmail.com>
  • Loading branch information
nehagup and Aditya-eddy authored Feb 14, 2024
1 parent a40ff21 commit 72537aa
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 57 deletions.
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = {
content: `⭐️ If you like Keploy, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/keploy/keploy">GitHub</a> and follow us on <a target="_blank" rel="noopener noreferrer" href="https://twitter.com/keployio">Twitter</a> ❤️ `,
},
prism: {
theme: require("prism-react-renderer/themes/nightOwlLight"),
theme: require("prism-react-renderer/themes/palenight"),
darkTheme: require("prism-react-renderer/themes/dracula"),
additionalLanguages: ["java", "ruby", "php"],
},
Expand Down
7 changes: 6 additions & 1 deletion src/theme/DocItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {ThemeClassNames, useWindowSize} from "@docusaurus/theme-common";
import DocBreadcrumbs from "@theme/DocBreadcrumbs";
import Layout from "@docusaurus/core/lib/client/theme-fallback/Layout";
import Head from "@docusaurus/Head";
import MDXContent from "@theme/MDXContent";

export default function DocItem(props) {
const {content: DocContent} = props;
Expand All @@ -41,6 +42,8 @@ export default function DocItem(props) {
!hideTableOfContents && DocContent.toc && DocContent.toc.length > 0;
const renderTocDesktop =
canRenderTOC && (windowSize === "desktop" || windowSize === "ssr");

const MDXComponent = props.content;
return (
<>
<Head>
Expand Down Expand Up @@ -96,7 +99,9 @@ export default function DocItem(props) {
<Heading as="h1">{title}</Heading>
</header>
)}
<DocContent />
<MDXContent>
<MDXComponent />
</MDXContent>
</article>
</div>
</article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A Keploy SDK is a language-specific library that offers APIs to do the following
2. Replay the API request with captured dependency mocks to identify noisy fields.
3. Replay all the test-cases captured and mock the dependencies for the application

Comparing the expected and actual responses for an API call happens at the [Keploy Server](/go/installation).
Comparing the expected and actual responses for an API call happens at the [Keploy Server](/docs/1.0.0/go/installation).

A Keploy SDK mocks the external dependencies while testing APIs, eliminating the need to setup test-environment.
This allows the application to isolate itself from external dependencies.
8 changes: 4 additions & 4 deletions versioned_docs/version-1.0.0/devtools/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keywords:

Keploy has 3 major components.

- [Server Contribution Guide](/devtools/server-contrib-guide)
- [SDK Contribution Guide](/devtools/sdk-contrib-guide)
- [Web UI Contribution Guide](/devtools/ui-contrib-guide)
- [Keploy Docs Contribution Guide](/devtools/docs-contrib-guide)
- [Server Contribution Guide](/docs/1.0.0/devtools/server-contrib-guide)
- [SDK Contribution Guide](/docs/1.0.0/devtools/sdk-contrib-guide)
- [Web UI Contribution Guide](/docs/1.0.0/devtools/ui-contrib-guide)
- [Keploy Docs Contribution Guide](/docs/1.0.0/devtools/docs-contrib-guide)
4 changes: 2 additions & 2 deletions versioned_docs/version-1.0.0/go/quickstart/gin-mongo.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ Now, let's see the magic! 🪄💫

There are 2 ways to test the application with Keploy.

1. [Unit Test File](/go/quickstart/gin-mongo#testing-using-unit-test-file)
2. [KEPLOY_MODE environment variable](/go/quickstart/gin-mongo#testing-using-keploy_mode-env-variable)
1. [Unit Test File](/docs/1.0.0/go/quickstart/gin-mongo#testing-using-unit-test-file)
2. [KEPLOY_MODE environment variable](/docs/1.0.0/go/quickstart/gin-mongo#testing-using-keploy_mode-env-variable)

### Testing using Unit Test File

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-1.0.0/java/quickstart/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ tags:
- hello world
---

- [Employee Management App with SpringBoot-Postgres](/java/quickstart/spring-sql) - A sample Employee-Manager app fetches the employee details based on the id set while making a POST request. The application tests Keploy integration capabilities using [SpringBoot](https://spring.io) and [PostgreSQL](https://www.postgresql.org/).
- [Employee Management App with SpringBoot-Postgres](/docs/1.0.0/java/quickstart/spring-sql) - A sample Employee-Manager app fetches the employee details based on the id set while making a POST request. The application tests Keploy integration capabilities using [SpringBoot](https://spring.io) and [PostgreSQL](https://www.postgresql.org/).
7 changes: 2 additions & 5 deletions versioned_docs/version-2.0.0/concepts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ tags:
- references
---

The following terms have specific definitions within the context of the [Keploy Platform](/concepts/what-is-keploy).

- [Keploy Features](/concepts/what-are-keploy-features)
- [Keploy eBPF](/concepts/what-is-keploy-sdk)
- [Keploy Modes](/concepts/what-are-keploy-sdk-modes)
- [How Keploy Works](/keploy-explained/how-keploy-works/)
- [Why Keploy](/keploy-explained/why-keploy/)
8 changes: 5 additions & 3 deletions versioned_docs/version-2.0.0/dependencies/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Supported Dependencies
sidebar_label: Supported Dependencies
---

- [MongoDB](/dependencies/mongo)
- [Oracle](/dependencies/oracle)
- [PostgresSQL](/dependencies/postgresql)
- [MongoDB](/dependencies/mongo/)

[//]: # (- [Oracle]&#40;dependencies/oracle&#41;)

[//]: # (- [PostgresSQL]&#40;/dependencies/postgres&#41;)
4 changes: 2 additions & 2 deletions versioned_docs/version-2.0.0/dependencies/mongo.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The system is built to support wiremessage `MongoDB version => 5.1.X`, which ref

In general, each message consists of a standard message header followed by request-specific data. The standard message header is structured as follows:

```
```go
struct MsgHeader {
int32 messageLength; // total message size, including this
int32 requestID; // identifier for this message
Expand All @@ -40,7 +40,7 @@ struct MsgHeader {
`OP_MSG` is an extensible message format used to encode both client requests and server replies on the wire.
`OP_MSG` has the following format:

```
```shell
OP_MSG {
MsgHeader header; // standard message header
uint32 flagBits; // message flags
Expand Down
12 changes: 6 additions & 6 deletions versioned_docs/version-2.0.0/keploy-explained/docs-dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Initialize Docusaurus 2 in the repo by running [`yarn`](https://classic.yarnpkg.

Now you can build and view the site locally:

```bash
```shell
yarn start
```

Expand All @@ -45,31 +45,31 @@ The command starts a local development server and opens a browser window.

2. Clone the repository with the following command. Replace the <GITHUB_USERNAME> with your username

```sh
```shell
git clone https://github.com/<GITHUB_USERNAME>/docs.git
```

3. Go into the directory containing the project

```sh
```shell
cd docs
```

4. Install all the dependencies

```sh
```shell
yarn
```

5. Start the development server.

```sh
```shell
yarn start
```

6. To reformat:

```
```shell
yarn prettier --write '**/*.{js,md}'
```

Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-2.0.0/operation/browser-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ tags:

## Install Keploy on PC

```
```shell
git clone https://github.com/keploy/keploy.git
```

Now come inside this directory and run this project in docker by putting the command mentioned below.

```
```shell
docker-compose -f docker-compose-dev.yaml up
```

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2.0.0/operation/record.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tags:
To record API calls as test cases set `KEPLOY_MODE` environment variable to `record`.

```
```shell
export KEPLOY_MODE="record"
```

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2.0.0/operation/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Set Environment Variable `KEPLOY_MODE`

</summary>

```
```shell
export KEPLOY_MODE="test"
```

Expand Down
20 changes: 10 additions & 10 deletions versioned_docs/version-2.0.0/quickstart/samples-echo.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Depending on your OS, choose your adventure:

Now, we will create the binary of our application:-

```zsh
```go
go build
```

Expand Down Expand Up @@ -109,7 +109,7 @@ Depending on your OS, choose your adventure:

this will return the shortened url. The ts would automatically be ignored during testing because it'll always be different.
```
```json
{
"ts": 1647802058801841100,
"url": "http://localhost:8082/GuwHCgoQ"
Expand Down Expand Up @@ -168,21 +168,21 @@ Depending on your OS, choose your adventure:

Using the docker-compose file we will start our mongodb instance:-

```zsh
```shell
docker-compose up -d
```

> Since we are using docker to run the application, we need to update the `postgres` host on line 28 in `main.go`, update the host to `echo-sql-postgres-1`.

Now, we will create the docker image of our application:-

```zsh
```shell
docker build -t echo-app:1.0 .
```

## Capture the Testcases

```zsh
```shell
keploy record -c "docker run -p 8082:8082 --name echoSqlApp --network keploy-network echo-app:1.0"
```

Expand Down Expand Up @@ -228,7 +228,7 @@ Depending on your OS, choose your adventure:
Now that we have our testcase captured, run the test file.
```zsh
```shell
keploy test -c "sudo docker run -p 8082:8082 --net keploy-network --name echoSqlApp echo-app:1.0 echoSqlApp" --delay 10
```
Expand Down Expand Up @@ -269,21 +269,21 @@ Depending on your OS, choose your adventure:

Using the docker-compose file we will start our mongodb instance:-

```zsh
```shell
docker-compose up -d
```

> Since we are using docker to run the application, we need to update the `postgres` host on line 28 in `main.go`, update the host to `echo-sql-postgres-1`.

Now, we will create the docker image of our application:-

```zsh
```shell
docker build -t echo-app:1.0 .
```

## Capture the Testcases

```zsh
```shell
keploy record -c "docker run -p 8082:8082 --name echoSqlApp --network keploy-network echo-app:1.0"
```

Expand Down Expand Up @@ -329,7 +329,7 @@ Depending on your OS, choose your adventure:
Now that we have our testcase captured, run the test file.
```zsh
```shell
keploy test -c "sudo docker run -p 8082:8082 --net keploy-network --name echoSqlApp echo-app:1.0 echoSqlApp" --delay 10
```
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2.0.0/quickstart/samples-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ A sample Employee-Manager app to test Keploy integration capabilities using [Spr

Based on your OS and preference(Docker/Native), you setup Keploy using One-click installation method:-

```sh
```shell
curl -O https://raw.githubusercontent.com/keploy/keploy/main/keploy.sh && source keploy.sh
```

Expand Down
6 changes: 3 additions & 3 deletions versioned_docs/version-2.0.0/server/linux/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Keploy can be installed in two ways:

## One click install Keploy.

```
```shell
curl -O https://raw.githubusercontent.com/keploy/keploy/main/keploy.sh && source keploy.sh
```

Expand All @@ -43,7 +43,7 @@ There are two ways to use Keploy eBPF in linux, you can use either use:

### Download the Keploy Binary

```zsh
```shell
curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_amd64.tar.gz" | tar xz -C /tmp

sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin && keploy
Expand All @@ -52,7 +52,7 @@ sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin && keploy
<details>
<summary> <strong> ARM Architecture </strong> </summary>

```zsh
```shell
curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz -C /tmp

sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin && keploy
Expand Down
12 changes: 6 additions & 6 deletions versioned_docs/version-2.0.0/server/macos/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ There are two ways to install Keploy eBPF in MacOS, you can use either use:

## One click install Keploy.

```
```shell
curl -O https://raw.githubusercontent.com/keploy/keploy/main/keploy.sh && source keploy.sh
```

Expand All @@ -42,15 +42,15 @@ Note: To run Keploy on MacOS through [Docker](https://docs.docker.com/desktop/re

We need to create debug volume to run Keploy using Docker-Desktop:

```zsh
```shell
docker volume create --driver local --opt type=debugfs --opt device=debugfs debugfs
```

We need to create a custom network for Keploy since we are using the Docker, therefore application container would require `docker network` to act as the bridge between them.

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

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

Expand All @@ -60,13 +60,13 @@ docker network create keploy-network

You need to have the latest version of `brew` installed on your system and then run this command from a terminal:

```zsh
```shell
brew install colima
```

Start Colima with defaults

```zsh
```shell
colima start
```

Expand All @@ -76,7 +76,7 @@ We need to create a custom network for Keploy since we are using the Docker, the

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {

The keploy test cmd will look like:

```sh
```shell
keploy test -c "PATH_TO_GO_COVER_BIANRY" --withCoverage
```

Expand All @@ -79,14 +79,14 @@ keploy

Coverage percentage log in the cmd will be:

```sh
```shell
🐰 Keploy: 2023-12-07T08:53:14Z INFO test/test.go:261
test-app-url-shortener coverage: 78.4% of statements
```

Also the go-test coverage can be merged along the recorded tests coverage by following the steps:

```sh
```go
go test -cover ./... -args -test.gocoverdir="PATH_TO_UNIT_COVERAGE_FILES"

go tool covdata textfmt -i="PATH_TO_UNIT_COVERAGE_FILES","./keploy/coverage-reports" -o coverage-profile
Expand Down
Loading

0 comments on commit 72537aa

Please sign in to comment.