From fea6061f89fe3f518905e2abafb8025427511e28 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sun, 29 Dec 2019 14:06:43 +0100 Subject: [PATCH] Add hash test to artifact_test Refers to #28 --- pkg/compiler/artifact_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/compiler/artifact_test.go b/pkg/compiler/artifact_test.go index 75c4b7f1..9813fdd4 100644 --- a/pkg/compiler/artifact_test.go +++ b/pkg/compiler/artifact_test.go @@ -32,7 +32,7 @@ import ( var _ = Describe("Artifact", func() { Context("Simple package build definition", func() { - It("Generates a delta", func() { + It("Generates a verified delta", func() { generalRecipe := tree.NewGeneralRecipe(pkg.NewInMemoryDatabase(false)) @@ -138,6 +138,15 @@ RUN echo bar > /test2`)) content2, err := helpers.Read(filepath.Join(unpacked, "test2")) Expect(err).ToNot(HaveOccurred()) Expect(content2).To(Equal("bar\n")) + + err = artifact.Hash() + Expect(err).ToNot(HaveOccurred()) + err = artifact.Verify() + Expect(err).ToNot(HaveOccurred()) + Expect(helpers.CopyFile(filepath.Join(tmpdir, "output2.tar"), filepath.Join(tmpdir, "package.tar"))).ToNot(HaveOccurred()) + + err = artifact.Verify() + Expect(err).To(HaveOccurred()) }) })