Added timing to Thrift calls in order for end to end test to test changes that affect thrift call speed such as Thrift protocol changes

This commit is contained in:
Renan DelValle 2017-02-13 19:32:48 -05:00
parent 10c12d5a13
commit 58c560061f

View file

@ -21,6 +21,7 @@ import (
"io/ioutil"
"os"
"testing"
"time"
)
var r Realis
@ -62,23 +63,29 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
InstanceCount(1).
AddPorts(1)
start := time.Now()
resp, err := r.CreateJob(job)
end := time.Now()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
fmt.Printf("Create call took %d ns\n", (end.UnixNano()- start.UnixNano()))
// Tasks must exist for it to be killed
t.Run("TestRealisClient_KillJob_Thermos", func(t *testing.T) {
start := time.Now()
resp, err := r.KillJob(job.JobKey())
end := time.Now()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
fmt.Printf("Kill call took %d ns\n", (end.UnixNano()- start.UnixNano()))
})
}
@ -114,22 +121,27 @@ func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) {
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
t.Run("TestRealisClient_StartCronJob_Thermos", func(t *testing.T) {
start := time.Now()
resp, err := r.StartCronJob(job.JobKey())
end := time.Now()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
fmt.Printf("Schedule cron call took %d ns\n", (end.UnixNano()- start.UnixNano()))
})
t.Run("TestRealisClient_DeschedulerCronJob_Thermos", func(t *testing.T) {
start := time.Now()
resp, err := r.DescheduleCronJob(job.JobKey())
end := time.Now()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
fmt.Printf("Deschedule cron call took %d ns\n", (end.UnixNano()- start.UnixNano()))
})
}