From 49354693fb9a54e93f5fa28a3c59c3d2d87da965 Mon Sep 17 00:00:00 2001 From: Eero Tamminen Date: Fri, 5 Mar 2021 18:45:31 +0200 Subject: [PATCH] Fix GPU plugin test setup + better error message Tests fail depending in which order they are run, unless mocked files are cleaned between test runs. Without this, the next commit would fail. --- cmd/gpu_plugin/gpu_plugin_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/gpu_plugin/gpu_plugin_test.go b/cmd/gpu_plugin/gpu_plugin_test.go index a90210b6..7f42cab3 100644 --- a/cmd/gpu_plugin/gpu_plugin_test.go +++ b/cmd/gpu_plugin/gpu_plugin_test.go @@ -138,8 +138,12 @@ func TestScan(t *testing.T) { t.Errorf("unexpected error: %+v", err) } if tc.expectedDevs != notifier.devCount { - t.Errorf("Wrong number of discovered devices") + t.Errorf("Expected %d, discovered %d devices", + tc.expectedDevs, notifier.devCount) } + // remove dirs/files for next test + os.RemoveAll(sysfs) + os.RemoveAll(devfs) }) } }