From a4581e8e3febeab26d866ef77ae26f9c8f8a26d4 Mon Sep 17 00:00:00 2001 From: Claudio Maritan Date: Mon, 6 Mar 2023 10:40:24 +0100 Subject: [PATCH] test(rpmdb): add empty file test --- pkg/lockfile/fixtures/rpm/empty-rpmdb | 0 pkg/lockfile/rpmdb_test.go | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 pkg/lockfile/fixtures/rpm/empty-rpmdb diff --git a/pkg/lockfile/fixtures/rpm/empty-rpmdb b/pkg/lockfile/fixtures/rpm/empty-rpmdb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/lockfile/rpmdb_test.go b/pkg/lockfile/rpmdb_test.go index a648471a4c..ee836a53ac 100644 --- a/pkg/lockfile/rpmdb_test.go +++ b/pkg/lockfile/rpmdb_test.go @@ -15,6 +15,15 @@ func TestParseRpmDB_SQLite_FileDoesNotExist(t *testing.T) { expectPackages(t, packages, []lockfile.PackageDetails{}) } +func TestParseRpmDB_SQLite_EmptyFile(t *testing.T) { + t.Parallel() + + packages, err := lockfile.ParseRpmDB("fixtures/rpm/empty-rpmdb") + + expectErrContaining(t, err, "could not open") + expectPackages(t, packages, []lockfile.PackageDetails{}) +} + func TestParseRpmDB_SQLite_NotAnRpmDb(t *testing.T) { t.Parallel()