From 1c6f25b91c8d0c4c57a236236ca78d2e7e611d1d Mon Sep 17 00:00:00 2001 From: Christian Ege Date: Sat, 23 Dec 2023 09:45:34 +0100 Subject: [PATCH] test: add embedded testdata Signed-off-by: Christian Ege --- pkg/pcic/protocol_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/pcic/protocol_test.go b/pkg/pcic/protocol_test.go index 2c261a0..86b07df 100644 --- a/pkg/pcic/protocol_test.go +++ b/pkg/pcic/protocol_test.go @@ -1,6 +1,7 @@ package pcic_test import ( + "embed" "fmt" "strings" "testing" @@ -12,6 +13,9 @@ import ( const miniMalContentLength int = 14 +//go:embed testdata/*.bz2 +var tfs embed.FS + func TestMinimalReceive(t *testing.T) { r := strings.NewReader("Hello, Reader!") p := pcic.PCIC{} @@ -70,3 +74,9 @@ func TestReceiveWithChunk(t *testing.T) { assert.Error(t, err, "We expect an error while receiving malformed data") } + +func TestWithRealData(t *testing.T) { + _, err := tfs.ReadFile("testdata/pcic-test-data.blob.bz2") + assert.NoError(t, err, "No error expected while reading the input") + +}