From a9e71a98ca27f9f1e75cc2d1212d9216d7a96705 Mon Sep 17 00:00:00 2001 From: dhruv0000 Date: Wed, 17 Mar 2021 13:05:00 +0530 Subject: [PATCH] Added panic test for `res.Failure` Signed-off-by: dhruv0000 --- smi-conformance/grpc/handlers.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/smi-conformance/grpc/handlers.go b/smi-conformance/grpc/handlers.go index 0ad2c59..67dd22d 100644 --- a/smi-conformance/grpc/handlers.go +++ b/smi-conformance/grpc/handlers.go @@ -98,14 +98,16 @@ func (s *Service) RunTest(ctx context.Context, req *conformance.Request) (*confo // A hacky way to see the testStep Failed, since KUDO only provides it in Failure.Message re := regexp.MustCompile(`[0-9]+`) - stepFailed := re.FindAllString(res.Failure.Message, 1) - if len(stepFailed) != 0 { - passed, _ := strconv.Atoi(stepFailed[0]) - passed = passed - 1 - failures := stepsCount[res.Name] - passed - totalFailures += failures - if (passed) >= (stepsCount[res.Name] / 2) { - d.Capability = conformance.Capability_HALF + if res.Failure != nil { + stepFailed := re.FindAllString(res.Failure.Message, 1) + if len(stepFailed) != 0 { + passed, _ := strconv.Atoi(stepFailed[0]) + passed = passed - 1 + failures := stepsCount[res.Name] - passed + totalFailures += failures + if (passed) >= (stepsCount[res.Name] / 2) { + d.Capability = conformance.Capability_HALF + } } } }