Skip to content

Commit

Permalink
test for ngrinder task
Browse files Browse the repository at this point in the history
  • Loading branch information
gmemcc committed Mar 8, 2019
1 parent 77a485a commit b2ce1ed
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions pkg/loadtester/task_ngrinder_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package loadtester

import (
"context"
"github.com/stefanprodan/flagger/pkg/logging"
"testing"
"time"
)

func TestTaskNGrinder(t *testing.T) {
logger, _ := logging.NewLoggerWithEncoding("debug", "console")
canary := "podinfo.default"
taskFactory, ok := GetTaskFactory(TaskTypeNGrinder)
if !ok {
t.Errorf("Failed to get ngrinder task factory")
}
t.Run("NormalRequest", func(t *testing.T) {
task, err := taskFactory(map[string]string{
"server": "http://10.255.254.25:8080",
"clone": "960",
"username": "admin",
"passwd": "YWRtaW4=",
}, canary, logger)
if err != nil {
t.Fatalf("Failed to create ngrinder task: %s", err.Error())
return
}
ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
task.Run(ctx)
<-ctx.Done()
})
}

0 comments on commit b2ce1ed

Please sign in to comment.