|
1 | 1 | /** |
2 | | - * Copyright 2022 Google LLC |
| 2 | + * Copyright 2022-2025 Google LLC |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -28,14 +28,12 @@ import ( |
28 | 28 | "github.com/mitchellh/go-testing-interface" |
29 | 29 | "github.com/stretchr/testify/assert" |
30 | 30 | "github.com/tidwall/gjson" |
31 | | - "golang.org/x/sync/errgroup" |
32 | 31 | ) |
33 | 32 |
|
34 | 33 | const ( |
35 | 34 | gfDir = "testdata" |
36 | 35 | gfPerms = 0755 |
37 | 36 | gfUpdateEnvVar = "UPDATE_GOLDEN" |
38 | | - gGoroutinesMax = 24 |
39 | 37 | ) |
40 | 38 |
|
41 | 39 | type GoldenFile struct { |
@@ -162,17 +160,8 @@ func (g *GoldenFile) JSONEq(a *assert.Assertions, got gjson.Result, jsonPath str |
162 | 160 |
|
163 | 161 | // JSONPathEqs asserts that json content in jsonPaths for got and goldenfile are the same |
164 | 162 | func (g *GoldenFile) JSONPathEqs(a *assert.Assertions, got gjson.Result, jsonPaths []string) { |
165 | | - syncGroup := new(errgroup.Group) |
166 | | - syncGroup.SetLimit(gGoroutinesMax) |
167 | | - g.t.Logf("Checking %d JSON paths with max %d goroutines", len(jsonPaths), gGoroutinesMax) |
168 | | - for _, jsonPath := range jsonPaths { |
169 | | - jsonPath := jsonPath |
170 | | - syncGroup.Go(func() error { |
171 | | - g.JSONEq(a, got, jsonPath) |
172 | | - return nil |
173 | | - }) |
174 | | - } |
175 | | - if err := syncGroup.Wait(); err != nil { |
176 | | - g.t.Fatal(err) |
| 163 | + for i, jsonPath := range jsonPaths { |
| 164 | + g.t.Logf("Checking (%d of %d) JSON paths: %s", i, len(jsonPaths), jsonPath) |
| 165 | + g.JSONEq(a, got, jsonPath) |
177 | 166 | } |
178 | 167 | } |
0 commit comments