From ee11778a4fe60868d6b9b96ae7d974e5a85c8d49 Mon Sep 17 00:00:00 2001 From: Christopher Hunter Date: Wed, 5 Jul 2023 16:37:46 -0700 Subject: [PATCH] refator: add test coverage for TestReadBOSHReleaseManifestsFromTarballs --- pkg/tile/bosh_release_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/tile/bosh_release_test.go b/pkg/tile/bosh_release_test.go index c82c0d692..6f779399c 100644 --- a/pkg/tile/bosh_release_test.go +++ b/pkg/tile/bosh_release_test.go @@ -2,6 +2,7 @@ package tile_test import ( "bytes" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "io" "os" @@ -33,6 +34,16 @@ func TestReadReleaseFromFile(t *testing.T) { please.Expect(err).NotTo(HaveOccurred()) } +func TestReadBOSHReleaseManifestsFromTarballs(t *testing.T) { + boshReleases, err := tile.ReadBOSHReleaseManifestsFromTarballs(os.DirFS("testdata"), "bpm-1.1.21-ubuntu-xenial-621.463.tgz", "bpm-1.1.21.tgz") + require.NoError(t, err) + require.Len(t, boshReleases, 2) + assert.Equal(t, "be5b1710f33128f6c864eae1d97effddb94dd3ac", boshReleases[0].SHA1) + assert.Equal(t, "519b78f2f3333a7b9c000bbef325e12a2f36996d", boshReleases[1].SHA1) + assert.Equal(t, "bpm-1.1.21-ubuntu-xenial-621.463.tgz", boshReleases[0].FilePath) + assert.Equal(t, "bpm-1.1.21.tgz", boshReleases[1].FilePath) +} + func TestReadProductTemplatePartFromBOSHReleaseTarball(t *testing.T) { t.Run("when the release is compiled", func(t *testing.T) { f, err := os.Open(filepath.Join("testdata", "bpm-1.1.21-ubuntu-xenial-621.463.tgz"))