Skip to content

Commit

Permalink
[skip ci] improve documentation and add example
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Dec 15, 2018
1 parent cd69b40 commit 37f1ad3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
6 changes: 3 additions & 3 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package ghz can be used to perform benchmarking and load testing against gRPC se
report, err := runner.Run(
"helloworld.Greeter.SayHello",
"localhost:50051",
WithProtoFile("greeter.proto", []string{}),
WithDataFromFile("data.json"),
WithInsecure(true),
runner.WithProtoFile("greeter.proto", []string{}),
runner.WithDataFromFile("data.json"),
runner.WithInsecure(true),
)
*/
package ghz
31 changes: 31 additions & 0 deletions runner/example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package runner_test

import (
"fmt"
"os"

"github.com/bojand/ghz/printer"
"github.com/bojand/ghz/runner"
)

func main() {
report, err := runner.Run(
"helloworld.Greeter.SayHello",
"localhost:50051",
runner.WithProtoFile("../testdata/greeter.proto", []string{}),
runner.WithDataFromFile("../testdata/data.json"),
runner.WithInsecure(true),
)

if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}

printer := printer.ReportPrinter{
Out: os.Stdout,
Report: report,
}

printer.Print("pretty")
}
27 changes: 19 additions & 8 deletions www/docs/package.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@ package main

import (
"fmt"
"os"

"github.com/bojand/ghz/printer"
"github.com/bojand/ghz/runner"
)

func main() {
report, err := runner.Run(
report, err := runner.Run(
"helloworld.Greeter.SayHello",
"localhost:50051",
WithProtoFile("greeter.proto", []string{}),
WithDataFromFile("data.json"),
WithInsecure(true),
)

fmt.Println(report)
}
runner.WithProtoFile("greeter.proto", []string{}),
runner.WithDataFromFile("data.json"),
runner.WithInsecure(true),
)

if err != nil {
fmt.Println(err.Error())
}

printer := printer.ReportPrinter{
Out: os.Stdout,
Report: report,
}

printer.Print("pretty")
}
```

0 comments on commit 37f1ad3

Please sign in to comment.