First commit
commit
58bd9ddfa8
|
|
@ -0,0 +1,25 @@
|
|||
# stress-test
|
||||
Simple application de GET d'url
|
||||
## Installation
|
||||
apres le clone
|
||||
```
|
||||
go mod tidy
|
||||
go build
|
||||
```
|
||||
## Utilisation
|
||||
```
|
||||
.stress-test -u <url> -c <count>
|
||||
```
|
||||
Exemple
|
||||
```
|
||||
./stress-test -u http://appdemo.dell.stef.lan -c 1000
|
||||
Url http://appdemo.dell.stef.lan Count 10
|
||||
Count 1/1000
|
||||
Count 2/1000
|
||||
Count 3/1000
|
||||
Count 4/1000
|
||||
...
|
||||
...
|
||||
Count 999/1000
|
||||
Count 1000/1000
|
||||
```
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var url string
|
||||
var count int
|
||||
flag.StringVar(&url, "u", "http://127.0.0.1", "Specify url to stressusername. Default http://127.0.0.1")
|
||||
flag.IntVar(&count, "c", 10, "Specify pass. Default is 100")
|
||||
flag.Parse()
|
||||
fmt.Printf("Url %s Count %d\n", url, count)
|
||||
for i := 0; i < count; i++ {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
fmt.Printf("Count %d/%d\n", i+1, count)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue