Skip to content

Commit

Permalink
Merge pull request #420 from starvader13/issue_2070
Browse files Browse the repository at this point in the history
remove: Irrelevant Languages from Test Coverage Generation Section
  • Loading branch information
shivamsouravjha authored Jul 31, 2024
2 parents 45b66e0 + fbefa3c commit aa20927
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 47 deletions.
38 changes: 38 additions & 0 deletions versioned_docs/version-2.0.0/server/sdk-installation/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,44 @@ import WhatAreKeployFeatures from './index.md'

<WhatAreKeployFeatures/>

## 🛠️ Language Specific Requirements

| Programming Language | Prerequisites |
| :------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| go | 1. The application should have a graceful shutdown to stop the API server on `SIGTERM` or `SIGINT` signals. Refer [appendix](#appendix) for basic implementation of graceful shutdown function. <br/> 2. The go binary should be built with `-cover` flag. |

## Graceful Shutdown

It is important that the application is shutdown gracefully. In case of Golang, function for graceful shutdown:

```go
func GracefulShutdown() {
stopper := make(chan os.Signal, 1)
// listens for interrupt and SIGTERM signal
signal.Notify(stopper, os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGTERM)
go func() {
select {
case <-stopper:
os.Exit(0)
}
}()
}

func main() {

port := "8080"

r := gin.Default()

r.GET("/:param", getURL)
r.POST("/url", putURL)
// should be called before starting the API server from main()
GracefulShutdown()

r.Run()
}
```

## Usage

For keploy test coverage the binary must built with `-cover` flag:
Expand Down
47 changes: 0 additions & 47 deletions versioned_docs/version-2.0.0/server/sdk-installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,50 +38,3 @@ keploy
├── test-1.yaml
└── test-2.yaml
```

**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command.

```bash
mvn clean install -Dmaven.test.skip=true
```

## 🛠️ Language Specific Requirements

| Programming Language | Prerequisites |
| :------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| go | 1. The application should have a graceful shutdown to stop the API server on `SIGTERM` or `SIGINT` signals. Refer [appendix](#graceful-shutdown) for basic implementation of graceful shutdown function. <br/> 2. The go binary should be built with `-cover` flag. |
| python | [Python 3 and above](https://www.python.org/downloads/) <br/> [coverage.py](https://coverage.readthedocs.io/en/7.4.1/install.html) |
| javascript | [nyc](https://www.npmjs.com/package/nyc) |
| java | [Jacoco 0.8.8](https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin/0.8.8) |

## Graceful Shutdown

It is important that the application is shutdown gracefully. In case of Golang, function for graceful shutdown:

```go
func GracefulShutdown() {
stopper := make(chan os.Signal, 1)
// listens for interrupt and SIGTERM signal
signal.Notify(stopper, os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGTERM)
go func() {
select {
case <-stopper:
os.Exit(0)
}
}()
}

func main() {

port := "8080"

r := gin.Default()

r.GET("/:param", getURL)
r.POST("/url", putURL)
// should be called before starting the API server from main()
GracefulShutdown()

r.Run()
}
```
12 changes: 12 additions & 0 deletions versioned_docs/version-2.0.0/server/sdk-installation/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ import WhatAreKeployFeatures from './index.md'

<WhatAreKeployFeatures/>

## 🛠️ Language Specific Requirements

| Programming Language | Prerequisites |
| :------------------: | :-------------------------------------------------------------------------------------- |
| java | [Jacoco 0.8.8](https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin/0.8.8) |

**Note**: In case of java application, before running test subcommand, you need to clean the project by removing any previously generated file, and run install command.

```bash
mvn clean install -Dmaven.test.skip=true
```

## Usage

### Update `pom.xml` file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ import WhatAreKeployFeatures from './index.md'

<WhatAreKeployFeatures/>

## 🛠️ Language Specific Requirements

| Programming Language | Prerequisites |
| :------------------: | :--------------------------------------- |
| javascript | [nyc](https://www.npmjs.com/package/nyc) |

## Usage

### Update package file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import WhatAreKeployFeatures from './index.md'

<WhatAreKeployFeatures/>

| Programming Language | Prerequisites |
| :------------------: | :--------------------------------------------------------------------------------------------------------------------------------- |
| python | [Python 3 and above](https://www.python.org/downloads/) <br/> [coverage.py](https://coverage.readthedocs.io/en/7.4.1/install.html) |

## Usage

To get the coverage data for your unit tests:
Expand Down

0 comments on commit aa20927

Please sign in to comment.