Execute incremental analysis artifact plans
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package artifacts
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/artifactmodel"
|
||||
)
|
||||
|
||||
func TestArtifactCatalogRegisterBuiltInsAndLookup(t *testing.T) {
|
||||
catalog := NewArtifactCatalog()
|
||||
@@ -179,6 +184,30 @@ func TestArtifactCatalogMarkAvailableGenerated(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestArtifactCatalogMarkAvailableGeneratedEvidence(t *testing.T) {
|
||||
catalog := NewArtifactCatalog()
|
||||
if err := catalog.RegisterConfiguredArtifacts(map[string]ConfiguredArtifactDefinition{
|
||||
"session_recap": {Enabled: true, OutputPath: "artifacts/session_recap.md"},
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sourceID, _ := catalog.SourceIDForConfiguredKey("session_recap")
|
||||
contract := &artifactmodel.ContractMetadata{
|
||||
MediaType: "text/markdown", SchemaID: "narratio.session_recap", SchemaVersion: "1",
|
||||
}
|
||||
checksum := strings.Repeat("a", 64)
|
||||
if err := catalog.MarkAvailableGeneratedEvidence(
|
||||
sourceID, "/tmp/session_recap.md", "run-1", checksum, 42, contract,
|
||||
); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
entry, _ := catalog.Lookup(sourceID)
|
||||
if !entry.Available || entry.ProducerRunID != "run-1" || entry.Checksum != checksum || entry.Size != 42 ||
|
||||
entry.Contract == nil || *entry.Contract != *contract {
|
||||
t.Fatalf("generated evidence entry = %#v", entry)
|
||||
}
|
||||
}
|
||||
|
||||
func TestArtifactCatalogLookupPlannedButUnavailable(t *testing.T) {
|
||||
catalog := NewArtifactCatalog()
|
||||
if err := catalog.RegisterConfiguredArtifacts(
|
||||
|
||||
Reference in New Issue
Block a user