From ddc9c1e4e512ccc4b86c8688b0e43bae626c74a2 Mon Sep 17 00:00:00 2001 From: Ivan Poleshchuk Date: Thu, 9 Jun 2022 12:05:35 +0400 Subject: [PATCH] Fix GPU detection test --- common/util_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/util_test.go b/common/util_test.go index 02afe7fb43..9a541669d6 100644 --- a/common/util_test.go +++ b/common/util_test.go @@ -353,6 +353,22 @@ func TestRatPriceInfo(t *testing.T) { assert.Zero(priceInfo.Cmp(big.NewRat(7, 2))) } +func TestParseAccelDevices_FailedDetection(t *testing.T) { + assert := assert.New(t) + + getGPU = func() ([]*gpu.GraphicsCard, error) { + return []*gpu.GraphicsCard{}, nil + } + getPCI = func() ([]*pci.Device, error) { + return []*pci.Device{}, nil + } + + ids, err := ParseAccelDevices("all", ffmpeg.Nvidia) + + assert.NotNil(err) + assert.Equal(len(ids), 0) +} + func TestParseAccessDevices_Gpu(t *testing.T) { assert := assert.New(t)