aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-25 14:14:19 +0900
committerOphestra <cat@gensokyo.uk>2026-01-25 14:48:25 +0900
commit334578fddeda6c952b1c2e35829c91c9da72747e (patch)
tree2e3f65188ddbb600cf2f55913dd8f819b10672ea /internal/pkg/pkg_test.go
parent20790af71ec9a69a462ecaaa7fc308e3b685383d (diff)
internal/pkg: expose underlying reader
This will be fully implemented in httpArtifact in a future commit. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg_test.go')
-rw-r--r--internal/pkg/pkg_test.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go
index 2581cce7..903db563 100644
--- a/internal/pkg/pkg_test.go
+++ b/internal/pkg/pkg_test.go
@@ -47,10 +47,10 @@ type overrideIdent struct {
func (a overrideIdent) ID() pkg.ID { return a.id }
-// overrideIdentFile overrides the ID method of [File].
+// overrideIdentFile overrides the ID method of [FileArtifact].
type overrideIdentFile struct {
id pkg.ID
- pkg.File
+ pkg.FileArtifact
}
func (a overrideIdentFile) ID() pkg.ID { return a.id }
@@ -61,10 +61,10 @@ type knownIdentArtifact interface {
pkg.TrivialArtifact
}
-// A knownIdentFile implements [pkg.KnownIdent] and [File]
+// A knownIdentFile implements [pkg.KnownIdent] and [FileArtifact]
type knownIdentFile interface {
pkg.KnownIdent
- pkg.File
+ pkg.FileArtifact
}
// overrideChecksum overrides the Checksum method of [Artifact].
@@ -75,7 +75,7 @@ type overrideChecksum struct {
func (a overrideChecksum) Checksum() pkg.Checksum { return a.checksum }
-// overrideChecksumFile overrides the Checksum method of [File].
+// overrideChecksumFile overrides the Checksum method of [FileArtifact].
type overrideChecksumFile struct {
checksum pkg.Checksum
knownIdentFile
@@ -111,7 +111,7 @@ func (a *stubArtifactF) Params(ctx *pkg.IContext) { ctx.GetHash().Write(a.pa
func (a *stubArtifactF) Dependencies() []pkg.Artifact { return a.deps }
func (a *stubArtifactF) Cure(f *pkg.FContext) error { return a.cure(f) }
-// A stubFile implements [File] with hardcoded behaviour.
+// A stubFile implements [FileArtifact] with hardcoded behaviour.
type stubFile struct {
data []byte
err error
@@ -119,7 +119,9 @@ type stubFile struct {
stubArtifact
}
-func (a *stubFile) Cure(context.Context) ([]byte, error) { return a.data, a.err }
+func (a *stubFile) Cure(context.Context) (io.ReadCloser, error) {
+ return io.NopCloser(bytes.NewReader(a.data)), a.err
+}
// newStubFile returns an implementation of [pkg.File] with hardcoded behaviour.
func newStubFile(
@@ -128,7 +130,7 @@ func newStubFile(
sum *pkg.Checksum,
data []byte,
err error,
-) pkg.File {
+) pkg.FileArtifact {
f := overrideIdentFile{id, &stubFile{data, err, stubArtifact{
kind,
nil,