From ac58687d760e52627181c335443ed6cb3bbf3b8e Mon Sep 17 00:00:00 2001 From: desmax74 Date: Wed, 11 Oct 2023 20:21:45 +0200 Subject: [PATCH] Add Guacone collect files json.bz2 capability Signed-off-by: desmax74 --- cmd/guacone/cmd/gcs_test.go | 21 +++++++++++++++++- .../exampledata/busybox-cyclonedx.json.bz2 | Bin 0 -> 543 bytes pkg/handler/processor/process/process.go | 14 +++++++++--- pkg/handler/processor/processor.go | 5 +++++ 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 internal/testing/testdata/exampledata/busybox-cyclonedx.json.bz2 diff --git a/cmd/guacone/cmd/gcs_test.go b/cmd/guacone/cmd/gcs_test.go index 687daa7fe1..eb106bd994 100644 --- a/cmd/guacone/cmd/gcs_test.go +++ b/cmd/guacone/cmd/gcs_test.go @@ -15,7 +15,11 @@ package cmd -import "testing" +import ( + "testing" + + "github.com/spf13/cobra" +) func TestValidateGCSFlags(t *testing.T) { testCases := []struct { @@ -78,3 +82,18 @@ func TestValidateGCSFlags(t *testing.T) { } } + +func TestJsonBz2Ingestion(t *testing.T) { + rootCmd := &cobra.Command{ + Use: "guacone", + Short: "guacone", + } + rootCmd.AddCommand(collectCmd) + rootCmd.AddCommand(filesCmd) + bz2Path := "./../../../internal/testing/testdata/exampledata/busybox-cyclonedx.json.bz2" + rootCmd.SetArgs([]string{"collect", "files", bz2Path}) + err := rootCmd.Execute() + if err != nil { + t.Fatal(err) + } +} diff --git a/internal/testing/testdata/exampledata/busybox-cyclonedx.json.bz2 b/internal/testing/testdata/exampledata/busybox-cyclonedx.json.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..f39d16880a9683ac5d9b5d9cc5d7738e90be14f0 GIT binary patch literal 543 zcmV+)0^t2ZT4*^jL0KkKS*Of5i~s^I-+)yRPzV3;9VG=yKkwh_Kmq*b{rh`BLZA}0GXa;~KG)+@YJyX7OE($NB7(XDrmPd0C zy&$~u#X>#N0B_AFhM*{W8JP&8jaD4GvppZDf0rebQFOdonK?z$21ipWqOu$u-zsTd z)v9fc57qD#WRZa+3u>=$2~;e)j23geuu6aKSa~l$ko|X|5e-lAcO+AV2?~6}c)