From 58c560061f68a8a51ccf9e3f8ec7c706b8021fe5 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Mon, 13 Feb 2017 19:32:48 -0500 Subject: [PATCH] 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 --- realis_e2e_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/realis_e2e_test.go b/realis_e2e_test.go index a7e4b94..bbcda61 100644 --- a/realis_e2e_test.go +++ b/realis_e2e_test.go @@ -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())) }) }