From 532170ee911262d16083499d3e0774fd633ce3b7 Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Wed, 8 May 2024 15:57:41 -0400 Subject: [PATCH] fix unit tests Signed-off-by: Will Murphy --- grype/db/v3/namespace_test.go | 3 ++- grype/distro/distro_test.go | 5 +++++ grype/distro/test-fixtures/os/azurelinux/etc/os-release | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 grype/distro/test-fixtures/os/azurelinux/etc/os-release diff --git a/grype/db/v3/namespace_test.go b/grype/db/v3/namespace_test.go index 9e67aa8a36f..0f7c2849d3b 100644 --- a/grype/db/v3/namespace_test.go +++ b/grype/db/v3/namespace_test.go @@ -199,8 +199,9 @@ func Test_NamespaceForDistro(t *testing.T) { allDistros.Add(d.String()) } - // TODO: what do we do with mariner + // v3 and older schemas don't include these newer distros: allDistros.Remove(distro.Mariner.String()) + allDistros.Remove(distro.Azure.String()) for _, test := range tests { name := fmt.Sprintf("%s:%s", test.dist, test.version) diff --git a/grype/distro/distro_test.go b/grype/distro/distro_test.go index cbeec3af185..c18be758fa1 100644 --- a/grype/distro/distro_test.go +++ b/grype/distro/distro_test.go @@ -216,6 +216,11 @@ func Test_NewDistroFromRelease_Coverage(t *testing.T) { Type: Mariner, Version: "1.0.0", }, + { + fixture: "test-fixtures/os/azurelinux", + Type: Azure, + Version: "3.0.0", + }, { fixture: "test-fixtures/os/rockylinux", Type: RockyLinux, diff --git a/grype/distro/test-fixtures/os/azurelinux/etc/os-release b/grype/distro/test-fixtures/os/azurelinux/etc/os-release new file mode 100644 index 00000000000..09028dfe941 --- /dev/null +++ b/grype/distro/test-fixtures/os/azurelinux/etc/os-release @@ -0,0 +1,9 @@ +NAME="Microsoft Azure Linux" +VERSION="3.0.20240417" +ID=azurelinux +VERSION_ID="3.0" +PRETTY_NAME="Microsoft Azure Linux 3.0" +ANSI_COLOR="1;34" +HOME_URL="https://aka.ms/azurelinux" +BUG_REPORT_URL="https://aka.ms/azurelinux" +SUPPORT_URL="https://aka.ms/azurelinux"