From 11fc1bde204572e550f70920de8981c41b4a2790 Mon Sep 17 00:00:00 2001 From: Evgeny Ukhanov Date: Fri, 10 Feb 2017 20:17:33 +0200 Subject: [PATCH] Added tests for toolsPrintresults --- config/main.toml | 2 +- tools/ab_test.go | 11 +++++++++++ tools/siege_test.go | 11 +++++++++++ tools/tools_test.go | 15 --------------- tools/wrk_test.go | 11 +++++++++++ 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/config/main.toml b/config/main.toml index dab5171..4900396 100644 --- a/config/main.toml +++ b/config/main.toml @@ -33,6 +33,6 @@ path = "/home/evgeny/gb/apps/iron.sh" url = "http://localhost:3000/" [[app]] -title = "Nimel pure & minimal" +title = "Nickel pure & minimal" path = "/home/evgeny/gb/apps/nickel.sh" url = "http://localhost:3000/" \ No newline at end of file diff --git a/tools/ab_test.go b/tools/ab_test.go index 28bcd33..80b532a 100644 --- a/tools/ab_test.go +++ b/tools/ab_test.go @@ -191,4 +191,15 @@ func TestAbCalculate(t *testing.T) { if result[0].Ab.TimePerRequestAll.Quantor != "sec|min" { t.Fatalf("Error calculation: %#v", "TimePerRequestAll.Quantor") } + + config := &cfg.Config{ + App: []cfg.AppConfig{ + { + Title: "Test 1", + Path: "/bin/bash", + Url: "test", + }, + }, + } + PrintResults(&result, config) } diff --git a/tools/siege_test.go b/tools/siege_test.go index c646c2c..c3d1685 100644 --- a/tools/siege_test.go +++ b/tools/siege_test.go @@ -128,4 +128,15 @@ func TestSiegeCalculate(t *testing.T) { if int(result[0].Siege.TransactionRate) != 1400 { t.Fatalf("Error calculation: %v", "Siege.TransactionRate") } + + config := &cfg.Config{ + App: []cfg.AppConfig{ + { + Title: "Test 1", + Path: "/bin/bash", + Url: "test", + }, + }, + } + PrintResults(&result, config) } diff --git a/tools/tools_test.go b/tools/tools_test.go index cbcad87..f7eca12 100644 --- a/tools/tools_test.go +++ b/tools/tools_test.go @@ -1,16 +1 @@ package tools - -/* -import ( - "testing" -) - -// TestDataAnalyze - invoke analyzer for fetching results -func TestCalculate(t *testing.T) { - data := BenchResults{} - data.Ab = AbResults{} - data.Wrk = WrkResults{} - data.Siege = SiegeResults{} - _ = data.Calculate(&data) -} -*/ diff --git a/tools/wrk_test.go b/tools/wrk_test.go index 4663224..a6fde98 100644 --- a/tools/wrk_test.go +++ b/tools/wrk_test.go @@ -217,4 +217,15 @@ func TestWrkCalculate(t *testing.T) { if result[0].Wrk.LatencyDistribution99pers.Quantor != "us" { t.Fatalf("Error calculation: %v", "Wrk.LatencyDistribution99pers.Quantor") } + + config := &cfg.Config{ + App: []cfg.AppConfig{ + { + Title: "Test 1", + Path: "/bin/bash", + Url: "test", + }, + }, + } + PrintResults(&result, config) }