From 47c78065952f70f2b19aea5c11f00a4bf5e1cea5 Mon Sep 17 00:00:00 2001 From: kumarabd Date: Fri, 14 Aug 2020 20:29:59 +0530 Subject: [PATCH] modified results struct to return results Signed-off-by: kumarabd --- smi-conformance/grpc/handlers.go | 2 +- smi-conformance/test-gen/test_gen.go | 34 ++++++++++++++++------------ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/smi-conformance/grpc/handlers.go b/smi-conformance/grpc/handlers.go index 9fce133..3b8eaa7 100644 --- a/smi-conformance/grpc/handlers.go +++ b/smi-conformance/grpc/handlers.go @@ -54,7 +54,7 @@ func (s *Service) RunTest(ctx context.Context, req *conformance.Request) (*confo result := test_gen.RunTest(config, req.Annotations, req.Labels) fmt.Printf("%+v\n", result) - for _, res := range result.Testcase { + for _, res := range result.Testsuite[0].Testcase { results = append(results, &conformance.SingleTestResult{ Name: res.Name, Time: res.Time, diff --git a/smi-conformance/test-gen/test_gen.go b/smi-conformance/test-gen/test_gen.go index f46c42d..10d630b 100644 --- a/smi-conformance/test-gen/test_gen.go +++ b/smi-conformance/test-gen/test_gen.go @@ -13,20 +13,26 @@ import ( ) type Results struct { - Tests int `json:"tests"` - Failures int `json:"failures"` - Time string `json:"time"` - Name string `json:"name"` - Testcase []struct { - Classname string `json:"classname"` - Name string `json:"name"` - Time string `json:"time"` - Assertions int `json:"assertions"` - Failure struct { - Text string `json:"text"` - Message string `json:"message"` - } `json:"failure,omitempty"` - } `json:"testcase"` + Name string `json:"name"` + Tests int `json:"tests"` + Failures int `json:"failures"` + Time string `json:"time"` + Testsuite []struct { + Tests int `json:"tests"` + Failures int `json:"failures"` + Time string `json:"time"` + Name string `json:"name"` + Testcase []struct { + Classname string `json:"classname"` + Name string `json:"name"` + Time string `json:"time"` + Assertions int `json:"assertions"` + Failure struct { + Text string `json:"text"` + Message string `json:"message"` + } `json:"failure"` + } `json:"testcase"` + } `json:"testsuite"` } func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Results {