mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 16:25:19 +00:00
Split ImageDefinitionToTar test
ImageDefinitionToTar it is not actually used by compiler code, but can be handy from an API perspective, so we keep it.
This commit is contained in:
@@ -77,9 +77,10 @@ ENV PACKAGE_CATEGORY=app-admin`))
|
|||||||
DockerFileName: "Dockerfile",
|
DockerFileName: "Dockerfile",
|
||||||
Destination: filepath.Join(tmpdir2, "output1.tar"),
|
Destination: filepath.Join(tmpdir2, "output1.tar"),
|
||||||
}
|
}
|
||||||
Expect(b.ImageDefinitionToTar(opts)).ToNot(HaveOccurred())
|
|
||||||
Expect(helpers.Exists(filepath.Join(tmpdir2, "output1.tar"))).To(BeTrue())
|
|
||||||
Expect(b.BuildImage(opts)).ToNot(HaveOccurred())
|
Expect(b.BuildImage(opts)).ToNot(HaveOccurred())
|
||||||
|
Expect(b.ExportImage(opts)).ToNot(HaveOccurred())
|
||||||
|
Expect(helpers.Exists(filepath.Join(tmpdir2, "output1.tar"))).To(BeTrue())
|
||||||
|
|
||||||
err = lspec.WriteStepImageDefinition(lspec.Image, filepath.Join(tmpdir, "LuetDockerfile"))
|
err = lspec.WriteStepImageDefinition(lspec.Image, filepath.Join(tmpdir, "LuetDockerfile"))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@@ -100,7 +101,9 @@ RUN echo bar > /test2`))
|
|||||||
DockerFileName: "LuetDockerfile",
|
DockerFileName: "LuetDockerfile",
|
||||||
Destination: filepath.Join(tmpdir, "output2.tar"),
|
Destination: filepath.Join(tmpdir, "output2.tar"),
|
||||||
}
|
}
|
||||||
Expect(b.ImageDefinitionToTar(opts2)).ToNot(HaveOccurred())
|
|
||||||
|
Expect(b.BuildImage(opts2)).ToNot(HaveOccurred())
|
||||||
|
Expect(b.ExportImage(opts2)).ToNot(HaveOccurred())
|
||||||
Expect(helpers.Exists(filepath.Join(tmpdir, "output2.tar"))).To(BeTrue())
|
Expect(helpers.Exists(filepath.Join(tmpdir, "output2.tar"))).To(BeTrue())
|
||||||
|
|
||||||
artifacts := []ArtifactNode{{
|
artifacts := []ArtifactNode{{
|
||||||
@@ -115,13 +118,23 @@ RUN echo bar > /test2`))
|
|||||||
|
|
||||||
Expect(b.Changes(opts, opts2)).To(Equal(
|
Expect(b.Changes(opts, opts2)).To(Equal(
|
||||||
[]ArtifactLayer{{
|
[]ArtifactLayer{{
|
||||||
FromImage: filepath.Join(tmpdir2, "output1.tar"),
|
FromImage: "luet/base",
|
||||||
ToImage: filepath.Join(tmpdir, "output2.tar"),
|
ToImage: "test",
|
||||||
Diffs: ArtifactDiffs{
|
Diffs: ArtifactDiffs{
|
||||||
Additions: artifacts,
|
Additions: artifacts,
|
||||||
},
|
},
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
|
opts2 = CompilerBackendOptions{
|
||||||
|
ImageName: "test",
|
||||||
|
SourcePath: tmpdir,
|
||||||
|
DockerFileName: "LuetDockerfile",
|
||||||
|
Destination: filepath.Join(tmpdir, "output3.tar"),
|
||||||
|
}
|
||||||
|
|
||||||
|
Expect(b.ImageDefinitionToTar(opts2)).ToNot(HaveOccurred())
|
||||||
|
Expect(helpers.Exists(filepath.Join(tmpdir, "output3.tar"))).To(BeTrue())
|
||||||
|
Expect(b.ImageExists(opts2.ImageName)).To(BeFalse())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Detects available images", func() {
|
It("Detects available images", func() {
|
||||||
|
Reference in New Issue
Block a user