mirror of
https://github.com/mudler/luet.git
synced 2025-09-07 18:20:19 +00:00
Define context for scoped operation across core types
It holds necessary state plus additional information relative to the context which we are being run to (e.g. if we are in a terminal or not). Besides in the future we can use it also as a contextual logger to provide more smart logging capabilities. This also replace the general global configuration instance that previously was share between the core components.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package compiler_test
|
||||
|
||||
import (
|
||||
"github.com/mudler/luet/pkg/api/core/types"
|
||||
. "github.com/mudler/luet/pkg/compiler"
|
||||
. "github.com/mudler/luet/pkg/compiler/backend"
|
||||
|
||||
@@ -25,9 +26,9 @@ import (
|
||||
|
||||
var _ = Describe("Docker image diffs", func() {
|
||||
var b CompilerBackend
|
||||
|
||||
ctx := types.NewContext()
|
||||
BeforeEach(func() {
|
||||
b = NewSimpleDockerBackend()
|
||||
b = NewSimpleDockerBackend(ctx)
|
||||
})
|
||||
|
||||
Context("Generate diffs from docker images", func() {
|
||||
@@ -38,7 +39,7 @@ var _ = Describe("Docker image diffs", func() {
|
||||
err := b.DownloadImage(opts)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
layers, err := GenerateChanges(b, opts, opts)
|
||||
layers, err := GenerateChanges(ctx, b, opts, opts)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(layers)).To(Equal(1))
|
||||
Expect(len(layers[0].Diffs.Additions)).To(Equal(0))
|
||||
@@ -56,7 +57,7 @@ var _ = Describe("Docker image diffs", func() {
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
layers, err := GenerateChanges(b, Options{
|
||||
layers, err := GenerateChanges(ctx, b, Options{
|
||||
ImageName: "quay.io/mocaccino/micro",
|
||||
}, Options{
|
||||
ImageName: "quay.io/mocaccino/extra",
|
||||
|
Reference in New Issue
Block a user