util_test.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. /*
  2. Copyright 2015 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package endpoints
  14. import (
  15. "reflect"
  16. "testing"
  17. "github.com/davecgh/go-spew/spew"
  18. "k8s.io/kubernetes/pkg/api"
  19. "k8s.io/kubernetes/pkg/types"
  20. )
  21. func podRef(uid string) *api.ObjectReference {
  22. ref := api.ObjectReference{UID: types.UID(uid)}
  23. return &ref
  24. }
  25. func TestPackSubsets(t *testing.T) {
  26. // The downside of table-driven tests is that some things have to live outside the table.
  27. fooObjRef := api.ObjectReference{Name: "foo"}
  28. barObjRef := api.ObjectReference{Name: "bar"}
  29. testCases := []struct {
  30. name string
  31. given []api.EndpointSubset
  32. expect []api.EndpointSubset
  33. }{
  34. {
  35. name: "empty everything",
  36. given: []api.EndpointSubset{{Addresses: []api.EndpointAddress{}, Ports: []api.EndpointPort{}}},
  37. expect: []api.EndpointSubset{},
  38. }, {
  39. name: "empty addresses",
  40. given: []api.EndpointSubset{{Addresses: []api.EndpointAddress{}, Ports: []api.EndpointPort{{Port: 111}}}},
  41. expect: []api.EndpointSubset{},
  42. }, {
  43. name: "empty ports",
  44. given: []api.EndpointSubset{{Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}}, Ports: []api.EndpointPort{}}},
  45. expect: []api.EndpointSubset{},
  46. }, {
  47. name: "empty ports",
  48. given: []api.EndpointSubset{{NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}}, Ports: []api.EndpointPort{}}},
  49. expect: []api.EndpointSubset{},
  50. }, {
  51. name: "one set, one ip, one port",
  52. given: []api.EndpointSubset{{
  53. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  54. Ports: []api.EndpointPort{{Port: 111}},
  55. }},
  56. expect: []api.EndpointSubset{{
  57. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  58. Ports: []api.EndpointPort{{Port: 111}},
  59. }},
  60. }, {
  61. name: "one set, one ip, one port (IPv6)",
  62. given: []api.EndpointSubset{{
  63. Addresses: []api.EndpointAddress{{IP: "beef::1:2:3:4"}},
  64. Ports: []api.EndpointPort{{Port: 111}},
  65. }},
  66. expect: []api.EndpointSubset{{
  67. Addresses: []api.EndpointAddress{{IP: "beef::1:2:3:4"}},
  68. Ports: []api.EndpointPort{{Port: 111}},
  69. }},
  70. }, {
  71. name: "one set, one notReady ip, one port",
  72. given: []api.EndpointSubset{{
  73. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  74. Ports: []api.EndpointPort{{Port: 111}},
  75. }},
  76. expect: []api.EndpointSubset{{
  77. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  78. Ports: []api.EndpointPort{{Port: 111}},
  79. }},
  80. }, {
  81. name: "one set, one ip, one UID, one port",
  82. given: []api.EndpointSubset{{
  83. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  84. Ports: []api.EndpointPort{{Port: 111}},
  85. }},
  86. expect: []api.EndpointSubset{{
  87. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  88. Ports: []api.EndpointPort{{Port: 111}},
  89. }},
  90. }, {
  91. name: "one set, one notReady ip, one UID, one port",
  92. given: []api.EndpointSubset{{
  93. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  94. Ports: []api.EndpointPort{{Port: 111}},
  95. }},
  96. expect: []api.EndpointSubset{{
  97. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  98. Ports: []api.EndpointPort{{Port: 111}},
  99. }},
  100. }, {
  101. name: "one set, one ip, empty UID, one port",
  102. given: []api.EndpointSubset{{
  103. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("")}},
  104. Ports: []api.EndpointPort{{Port: 111}},
  105. }},
  106. expect: []api.EndpointSubset{{
  107. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("")}},
  108. Ports: []api.EndpointPort{{Port: 111}},
  109. }},
  110. }, {
  111. name: "one set, one notReady ip, empty UID, one port",
  112. given: []api.EndpointSubset{{
  113. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("")}},
  114. Ports: []api.EndpointPort{{Port: 111}},
  115. }},
  116. expect: []api.EndpointSubset{{
  117. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("")}},
  118. Ports: []api.EndpointPort{{Port: 111}},
  119. }},
  120. }, {
  121. name: "one set, two ips, one port",
  122. given: []api.EndpointSubset{{
  123. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}, {IP: "5.6.7.8"}},
  124. Ports: []api.EndpointPort{{Port: 111}},
  125. }},
  126. expect: []api.EndpointSubset{{
  127. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}, {IP: "5.6.7.8"}},
  128. Ports: []api.EndpointPort{{Port: 111}},
  129. }},
  130. }, {
  131. name: "one set, two mixed ips, one port",
  132. given: []api.EndpointSubset{{
  133. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  134. NotReadyAddresses: []api.EndpointAddress{{IP: "5.6.7.8"}},
  135. Ports: []api.EndpointPort{{Port: 111}},
  136. }},
  137. expect: []api.EndpointSubset{{
  138. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  139. NotReadyAddresses: []api.EndpointAddress{{IP: "5.6.7.8"}},
  140. Ports: []api.EndpointPort{{Port: 111}},
  141. }},
  142. }, {
  143. name: "one set, two duplicate ips, one port, notReady is covered by ready",
  144. given: []api.EndpointSubset{{
  145. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  146. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  147. Ports: []api.EndpointPort{{Port: 111}},
  148. }},
  149. expect: []api.EndpointSubset{{
  150. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  151. Ports: []api.EndpointPort{{Port: 111}},
  152. }},
  153. }, {
  154. name: "one set, one ip, two ports",
  155. given: []api.EndpointSubset{{
  156. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  157. Ports: []api.EndpointPort{{Port: 111}, {Port: 222}},
  158. }},
  159. expect: []api.EndpointSubset{{
  160. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  161. Ports: []api.EndpointPort{{Port: 111}, {Port: 222}},
  162. }},
  163. }, {
  164. name: "one set, dup ips, one port",
  165. given: []api.EndpointSubset{{
  166. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}, {IP: "1.2.3.4"}},
  167. Ports: []api.EndpointPort{{Port: 111}},
  168. }},
  169. expect: []api.EndpointSubset{{
  170. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  171. Ports: []api.EndpointPort{{Port: 111}},
  172. }},
  173. }, {
  174. name: "one set, dup ips, one port (IPv6)",
  175. given: []api.EndpointSubset{{
  176. Addresses: []api.EndpointAddress{{IP: "beef::1"}, {IP: "beef::1"}},
  177. Ports: []api.EndpointPort{{Port: 111}},
  178. }},
  179. expect: []api.EndpointSubset{{
  180. Addresses: []api.EndpointAddress{{IP: "beef::1"}},
  181. Ports: []api.EndpointPort{{Port: 111}},
  182. }},
  183. }, {
  184. name: "one set, dup ips with target-refs, one port",
  185. given: []api.EndpointSubset{{
  186. Addresses: []api.EndpointAddress{
  187. {IP: "1.2.3.4", TargetRef: &fooObjRef},
  188. {IP: "1.2.3.4", TargetRef: &barObjRef},
  189. },
  190. Ports: []api.EndpointPort{{Port: 111}},
  191. }},
  192. expect: []api.EndpointSubset{{
  193. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: &fooObjRef}},
  194. Ports: []api.EndpointPort{{Port: 111}},
  195. }},
  196. }, {
  197. name: "one set, dup mixed ips with target-refs, one port",
  198. given: []api.EndpointSubset{{
  199. Addresses: []api.EndpointAddress{
  200. {IP: "1.2.3.4", TargetRef: &fooObjRef},
  201. },
  202. NotReadyAddresses: []api.EndpointAddress{
  203. {IP: "1.2.3.4", TargetRef: &barObjRef},
  204. },
  205. Ports: []api.EndpointPort{{Port: 111}},
  206. }},
  207. expect: []api.EndpointSubset{{
  208. // finding the same address twice is considered an error on input, only the first address+port
  209. // reference is preserved
  210. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: &fooObjRef}},
  211. Ports: []api.EndpointPort{{Port: 111}},
  212. }},
  213. }, {
  214. name: "one set, one ip, dup ports",
  215. given: []api.EndpointSubset{{
  216. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  217. Ports: []api.EndpointPort{{Port: 111}, {Port: 111}},
  218. }},
  219. expect: []api.EndpointSubset{{
  220. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  221. Ports: []api.EndpointPort{{Port: 111}},
  222. }},
  223. }, {
  224. name: "two sets, dup ip, dup port",
  225. given: []api.EndpointSubset{{
  226. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  227. Ports: []api.EndpointPort{{Port: 111}},
  228. }, {
  229. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  230. Ports: []api.EndpointPort{{Port: 111}},
  231. }},
  232. expect: []api.EndpointSubset{{
  233. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  234. Ports: []api.EndpointPort{{Port: 111}},
  235. }},
  236. }, {
  237. name: "two sets, dup mixed ip, dup port",
  238. given: []api.EndpointSubset{{
  239. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  240. Ports: []api.EndpointPort{{Port: 111}},
  241. }, {
  242. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  243. Ports: []api.EndpointPort{{Port: 111}},
  244. }},
  245. expect: []api.EndpointSubset{{
  246. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  247. Ports: []api.EndpointPort{{Port: 111}},
  248. }},
  249. }, {
  250. name: "two sets, dup ip, two ports",
  251. given: []api.EndpointSubset{{
  252. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  253. Ports: []api.EndpointPort{{Port: 111}},
  254. }, {
  255. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  256. Ports: []api.EndpointPort{{Port: 222}},
  257. }},
  258. expect: []api.EndpointSubset{{
  259. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  260. Ports: []api.EndpointPort{{Port: 111}, {Port: 222}},
  261. }},
  262. }, {
  263. name: "two sets, dup ip, dup uids, two ports",
  264. given: []api.EndpointSubset{{
  265. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  266. Ports: []api.EndpointPort{{Port: 111}},
  267. }, {
  268. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  269. Ports: []api.EndpointPort{{Port: 222}},
  270. }},
  271. expect: []api.EndpointSubset{{
  272. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  273. Ports: []api.EndpointPort{{Port: 111}, {Port: 222}},
  274. }},
  275. }, {
  276. name: "two sets, dup mixed ip, dup uids, two ports",
  277. given: []api.EndpointSubset{{
  278. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  279. Ports: []api.EndpointPort{{Port: 111}},
  280. }, {
  281. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  282. Ports: []api.EndpointPort{{Port: 222}},
  283. }},
  284. expect: []api.EndpointSubset{{
  285. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  286. Ports: []api.EndpointPort{{Port: 111}},
  287. }, {
  288. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  289. Ports: []api.EndpointPort{{Port: 222}},
  290. }},
  291. }, {
  292. name: "two sets, two ips, dup port",
  293. given: []api.EndpointSubset{{
  294. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  295. Ports: []api.EndpointPort{{Port: 111}},
  296. }, {
  297. Addresses: []api.EndpointAddress{{IP: "5.6.7.8"}},
  298. Ports: []api.EndpointPort{{Port: 111}},
  299. }},
  300. expect: []api.EndpointSubset{{
  301. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}, {IP: "5.6.7.8"}},
  302. Ports: []api.EndpointPort{{Port: 111}},
  303. }},
  304. }, {
  305. name: "two set, dup ip, two uids, dup ports",
  306. given: []api.EndpointSubset{{
  307. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  308. Ports: []api.EndpointPort{{Port: 111}},
  309. }, {
  310. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-2")}},
  311. Ports: []api.EndpointPort{{Port: 111}},
  312. }},
  313. expect: []api.EndpointSubset{{
  314. Addresses: []api.EndpointAddress{
  315. {IP: "1.2.3.4", TargetRef: podRef("uid-1")},
  316. {IP: "1.2.3.4", TargetRef: podRef("uid-2")},
  317. },
  318. Ports: []api.EndpointPort{{Port: 111}},
  319. }},
  320. }, {
  321. name: "two set, dup ip, with and without uid, dup ports",
  322. given: []api.EndpointSubset{{
  323. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  324. Ports: []api.EndpointPort{{Port: 111}},
  325. }, {
  326. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-2")}},
  327. Ports: []api.EndpointPort{{Port: 111}},
  328. }},
  329. expect: []api.EndpointSubset{{
  330. Addresses: []api.EndpointAddress{
  331. {IP: "1.2.3.4"},
  332. {IP: "1.2.3.4", TargetRef: podRef("uid-2")},
  333. },
  334. Ports: []api.EndpointPort{{Port: 111}},
  335. }},
  336. }, {
  337. name: "two sets, two ips, two dup ip with uid, dup port, wrong order",
  338. given: []api.EndpointSubset{{
  339. Addresses: []api.EndpointAddress{{IP: "5.6.7.8"}},
  340. Ports: []api.EndpointPort{{Port: 111}},
  341. }, {
  342. Addresses: []api.EndpointAddress{{IP: "5.6.7.8", TargetRef: podRef("uid-1")}},
  343. Ports: []api.EndpointPort{{Port: 111}},
  344. }, {
  345. Addresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  346. Ports: []api.EndpointPort{{Port: 111}},
  347. }, {
  348. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  349. Ports: []api.EndpointPort{{Port: 111}},
  350. }},
  351. expect: []api.EndpointSubset{{
  352. Addresses: []api.EndpointAddress{
  353. {IP: "1.2.3.4"},
  354. {IP: "1.2.3.4", TargetRef: podRef("uid-1")},
  355. {IP: "5.6.7.8"},
  356. {IP: "5.6.7.8", TargetRef: podRef("uid-1")},
  357. },
  358. Ports: []api.EndpointPort{{Port: 111}},
  359. }},
  360. }, {
  361. name: "two sets, two mixed ips, two dup ip with uid, dup port, wrong order, ends up with split addresses",
  362. given: []api.EndpointSubset{{
  363. Addresses: []api.EndpointAddress{{IP: "5.6.7.8"}},
  364. Ports: []api.EndpointPort{{Port: 111}},
  365. }, {
  366. NotReadyAddresses: []api.EndpointAddress{{IP: "5.6.7.8", TargetRef: podRef("uid-1")}},
  367. Ports: []api.EndpointPort{{Port: 111}},
  368. }, {
  369. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4", TargetRef: podRef("uid-1")}},
  370. Ports: []api.EndpointPort{{Port: 111}},
  371. }, {
  372. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  373. Ports: []api.EndpointPort{{Port: 111}},
  374. }},
  375. expect: []api.EndpointSubset{{
  376. Addresses: []api.EndpointAddress{
  377. {IP: "5.6.7.8"},
  378. },
  379. NotReadyAddresses: []api.EndpointAddress{
  380. {IP: "1.2.3.4"},
  381. {IP: "1.2.3.4", TargetRef: podRef("uid-1")},
  382. {IP: "5.6.7.8", TargetRef: podRef("uid-1")},
  383. },
  384. Ports: []api.EndpointPort{{Port: 111}},
  385. }},
  386. }, {
  387. name: "two sets, two ips, two ports",
  388. given: []api.EndpointSubset{{
  389. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  390. Ports: []api.EndpointPort{{Port: 111}},
  391. }, {
  392. Addresses: []api.EndpointAddress{{IP: "5.6.7.8"}},
  393. Ports: []api.EndpointPort{{Port: 222}},
  394. }},
  395. expect: []api.EndpointSubset{{
  396. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  397. Ports: []api.EndpointPort{{Port: 111}},
  398. }, {
  399. Addresses: []api.EndpointAddress{{IP: "5.6.7.8"}},
  400. Ports: []api.EndpointPort{{Port: 222}},
  401. }},
  402. }, {
  403. name: "four sets, three ips, three ports, jumbled",
  404. given: []api.EndpointSubset{{
  405. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  406. Ports: []api.EndpointPort{{Port: 111}},
  407. }, {
  408. Addresses: []api.EndpointAddress{{IP: "1.2.3.5"}},
  409. Ports: []api.EndpointPort{{Port: 222}},
  410. }, {
  411. Addresses: []api.EndpointAddress{{IP: "1.2.3.6"}},
  412. Ports: []api.EndpointPort{{Port: 111}},
  413. }, {
  414. Addresses: []api.EndpointAddress{{IP: "1.2.3.5"}},
  415. Ports: []api.EndpointPort{{Port: 333}},
  416. }},
  417. expect: []api.EndpointSubset{{
  418. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}, {IP: "1.2.3.6"}},
  419. Ports: []api.EndpointPort{{Port: 111}},
  420. }, {
  421. Addresses: []api.EndpointAddress{{IP: "1.2.3.5"}},
  422. Ports: []api.EndpointPort{{Port: 222}, {Port: 333}},
  423. }},
  424. }, {
  425. name: "four sets, three mixed ips, three ports, jumbled",
  426. given: []api.EndpointSubset{{
  427. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}},
  428. Ports: []api.EndpointPort{{Port: 111}},
  429. }, {
  430. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.5"}},
  431. Ports: []api.EndpointPort{{Port: 222}},
  432. }, {
  433. Addresses: []api.EndpointAddress{{IP: "1.2.3.6"}},
  434. Ports: []api.EndpointPort{{Port: 111}},
  435. }, {
  436. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.5"}},
  437. Ports: []api.EndpointPort{{Port: 333}},
  438. }},
  439. expect: []api.EndpointSubset{{
  440. Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}, {IP: "1.2.3.6"}},
  441. Ports: []api.EndpointPort{{Port: 111}},
  442. }, {
  443. NotReadyAddresses: []api.EndpointAddress{{IP: "1.2.3.5"}},
  444. Ports: []api.EndpointPort{{Port: 222}, {Port: 333}},
  445. }},
  446. },
  447. }
  448. for _, tc := range testCases {
  449. result := RepackSubsets(tc.given)
  450. if !reflect.DeepEqual(result, SortSubsets(tc.expect)) {
  451. t.Errorf("case %q: expected %s, got %s", tc.name, spew.Sprintf("%#v", SortSubsets(tc.expect)), spew.Sprintf("%#v", result))
  452. }
  453. }
  454. }