浏览代码

daemon: fix TestVerifyPlatformContainerResources not capturing variable

This test runs with t.Parallel() _and_ uses subtests, but didn't capture
the `tc` variable, which potentialy (likely) makes it test the same testcase
multiple times.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父节点
当前提交
0c887404a8
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      daemon/daemon_unix_test.go

+ 1 - 0
daemon/daemon_unix_test.go

@@ -356,6 +356,7 @@ func TestVerifyPlatformContainerResources(t *testing.T) {
 		},
 		},
 	}
 	}
 	for _, tc := range tests {
 	for _, tc := range tests {
+		tc := tc
 		t.Run(tc.name, func(t *testing.T) {
 		t.Run(tc.name, func(t *testing.T) {
 			t.Parallel()
 			t.Parallel()
 			warnings, err := verifyPlatformContainerResources(&tc.resources, &tc.sysInfo, tc.update)
 			warnings, err := verifyPlatformContainerResources(&tc.resources, &tc.sysInfo, tc.update)