Commit 3541f76
authored
test: reduce repetition in metrics tests (#860)
Currently, the metrics tests have a bunch of code that's repeated
between tests in the inbound and outbound directions. This makes
modifying the tests much more painful, since the code needs to be
changed multiple times. Also, the file is hard to navigate.
This commit changes this by factoring out the shared code into functions
which are called by the differing code (e.g. metrics labels) as
parameters. This means that the common behavior is only defined once, so
it should be somewhat easier to edit. This has a significant advantage
over the approach we use elsewhere, where similar tests are generated by
macros: it doesn't mess up the compiler diagnostics for errors in the
tests. We may want to refactor other tests to use a similar style in the
future.
Signed-off-by: Eliza Weisman <[email protected]>1 parent 1e98a5b commit 3541f76
2 files changed
+502
-558
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
| |||
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
| 113 | + | |
| 114 | + | |
104 | 115 | | |
105 | 116 | | |
106 | 117 | | |
| |||
172 | 183 | | |
173 | 184 | | |
174 | 185 | | |
175 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
176 | 189 | | |
177 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
178 | 198 | | |
179 | 199 | | |
180 | 200 | | |
181 | 201 | | |
182 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
183 | 215 | | |
184 | 216 | | |
185 | 217 | | |
186 | | - | |
| 218 | + | |
187 | 219 | | |
188 | 220 | | |
189 | 221 | | |
| |||
0 commit comments