From 8e8979cac78110f75006a02811ce5259d917b8bc Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Sun, 6 Dec 2020 20:31:45 -0800 Subject: [PATCH] integration: check currentstep field in a subtest --- test/integration/aaa_download_only_test.go | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/test/integration/aaa_download_only_test.go b/test/integration/aaa_download_only_test.go index 8413698029..46152dda7a 100644 --- a/test/integration/aaa_download_only_test.go +++ b/test/integration/aaa_download_only_test.go @@ -70,20 +70,22 @@ func TestDownloadOnly(t *testing.T) { if err != nil { t.Errorf("failed to download only. args: %q %v", args, err) } - s := bufio.NewScanner(bytes.NewReader(rt.Stdout.Bytes())) - for s.Scan() { - var rtObj map[string]interface{} - err = json.Unmarshal(s.Bytes(), &rtObj) - if err != nil { - t.Errorf("failed to parse output: %v", err) - } else if step, ok := rtObj["data"]; ok { - if stepMap, ok := step.(map[string]interface{}); ok { - if stepMap["currentstep"] == "" { - t.Errorf("Empty step number for %v", stepMap["name"]) + t.Run("check json events", func(t *testing.T) { + s := bufio.NewScanner(bytes.NewReader(rt.Stdout.Bytes())) + for s.Scan() { + var rtObj map[string]interface{} + err = json.Unmarshal(s.Bytes(), &rtObj) + if err != nil { + t.Errorf("failed to parse output: %v", err) + } else if step, ok := rtObj["data"]; ok { + if stepMap, ok := step.(map[string]interface{}); ok { + if stepMap["currentstep"] == "" { + t.Errorf("Empty step number for %v", stepMap["name"]) + } } } } - } + }) // skip for none, as none driver does not have preload feature. if !NoneDriver() {