Skip to content

Commit

Permalink
Add load test for bulk messages
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed Nov 22, 2023
1 parent 28e4918 commit a355fb1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions api/cmd/loadtest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ func main() {
func bulkSend() {
var to []string
for i := 0; i < 100; i++ {
to = append(to, os.Getenv("HTTPSMS_TO"))
to = append(to, os.Getenv("HTTPSMS_TO_BULK"))
}

var responsePayload string
err := requests.
URL("/v1/messages/send").
URL("/v1/messages/bulk-send").
Host("api.httpsms.com").
// Host("localhost:8000").
// Scheme("http").
Header("x-api-key", os.Getenv("HTTPSMS_KEY")).
Header("x-api-key", os.Getenv("HTTPSMS_KEY_BULK")).
BodyJSON(&map[string]any{
"content": fmt.Sprintf("Bulk Load Test [%s]", time.Now().Format(time.RFC850)),
"from": os.Getenv("HTTPSMS_FROM_BULK"),
Expand All @@ -46,7 +44,8 @@ func bulkSend() {
ToString(&responsePayload).
Fetch(context.Background())
if err != nil {
log.Fatal(stacktrace.Propagate(err, "cannot create json payload"))
log.Println(responsePayload)
log.Fatal(stacktrace.Propagate(err, "cannot create request"))
}
log.Println(responsePayload)
}
Expand Down

0 comments on commit a355fb1

Please sign in to comment.