diff options
| author | Shulhan <ms@kilabit.info> | 2021-03-12 02:11:11 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-03-15 01:52:45 +0700 |
| commit | d30bfb7fa1c32984eaba8ad1cf744328812e02b9 (patch) | |
| tree | 316e089ac24694a3793ff92475be531ccd444b74 /cmd | |
| download | gorankusu-d30bfb7fa1c32984eaba8ad1cf744328812e02b9.tar.xz | |
trunks: a module for testing HTTP services
Trunks is a library and HTTP service that provide web user interface
to test HTTP service, similar to Postman, and for load testing.
For the load testing we use vegeta [1] as the backend.
[1] https://github.com/tsenart/vegeta
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/trunks/main.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/cmd/trunks/main.go b/cmd/trunks/main.go new file mode 100644 index 0000000..854cf69 --- /dev/null +++ b/cmd/trunks/main.go @@ -0,0 +1,36 @@ +// Copyright 2021, Shulhan <ms@kilabit.info>. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +// Program trunks provide an example how to use the Trunks module. +// +package main + +import ( + "os" + "os/signal" + "syscall" + + "git.sr.ht/~shulhan/trunks/example" + "github.com/shuLhan/share/lib/mlog" +) + +func main() { + ex, err := example.New() + if err != nil { + mlog.Fatalf("%s\n", err) + } + + go func() { + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM) + <-c + ex.Stop() + }() + + err = ex.Start() + if err != nil { + mlog.Fatalf("%s\n", err) + } +} |
