commit 58bd9ddfa8e32b73ca77871681715647fe582f0d Author: stef Date: Mon Jul 14 01:02:05 2025 +0200 First commit diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..0585a8f --- /dev/null +++ b/Readme.md @@ -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 -c +``` +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 +``` diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..c0e625f --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module stress-test + +go 1.19 diff --git a/main.go b/main.go new file mode 100644 index 0000000..7c90910 --- /dev/null +++ b/main.go @@ -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) + } +}