Finish native completion and retire legacy command machinery
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
@@ -150,11 +149,12 @@ func TestCommittedStatusReportsOnlyDeclaredPublishedOutputs(t *testing.T) {
|
||||
current.Commit.Artifacts[1].Source = "narratio.transcript.final_trimmed"
|
||||
fake.SeedObject(storage.FakeObject{Key: current.SessionPrefix + "transcripts/full.json", Data: []byte("mutable stale copy\n")})
|
||||
|
||||
availability := remotePublishedOutputAvailabilityForCurrent(context.Background(), cfg, fake, nil, current)
|
||||
key := publishedOutputRemoteStateKey("narratio.transcript.final_trimmed", "transcripts/full.json")
|
||||
if availability[key] != "remote=published" {
|
||||
t.Fatalf("availability = %#v, want committed published output", availability)
|
||||
cfg.ArtifactCatalog = &config.ArtifactCatalog{PublishOutputs: cfg.Pipeline.Publish.Outputs}
|
||||
outputs, err := inspectPublishedOutputs(context.Background(), cfg, fake, nil, current, nil, true, "available")
|
||||
if err != nil || len(outputs) != 1 || outputs[0].State != "published" {
|
||||
t.Fatalf("outputs=%#v err=%v", outputs, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCommittedStatusReportsCarriedOutputOriginAndChecksExactKey(t *testing.T) {
|
||||
@@ -180,22 +180,18 @@ func TestCommittedStatusReportsCarriedOutputOriginAndChecksExactKey(t *testing.T
|
||||
}}},
|
||||
}
|
||||
|
||||
availability := remotePublishedOutputAvailabilityForCurrent(context.Background(), cfg, fake, nil, current)
|
||||
key := publishedOutputRemoteStateKey("narratio.transcript.final_trimmed", "transcripts/full.json")
|
||||
want := "outcome=carried_locked remote=published declared_dest=transcripts/original.json declared_key=" + oldKey + " origin_run=" + originRun
|
||||
if availability[key] != want {
|
||||
t.Fatalf("availability = %#v, want %q", availability, want)
|
||||
outputs, err := inspectPublishedOutputs(context.Background(), cfg, fake, nil, current, nil, true, "available")
|
||||
if err != nil || len(outputs) != 1 {
|
||||
t.Fatalf("outputs=%#v err=%v", outputs, err)
|
||||
}
|
||||
output := outputs[0]
|
||||
if output.Outcome != "carried_locked" || output.State != "published" || output.Destination != "transcripts/full.json" || output.DeclaredDestination != "transcripts/original.json" || output.DeclaredKey != oldKey || output.OriginRun != originRun {
|
||||
t.Fatalf("carried output=%#v", output)
|
||||
}
|
||||
if len(fake.ExistsKeys) == 0 || fake.ExistsKeys[len(fake.ExistsKeys)-1] != oldKey {
|
||||
t.Fatalf("exists keys = %#v, want final exact declaration key %q", fake.ExistsKeys, oldKey)
|
||||
}
|
||||
var rendered bytes.Buffer
|
||||
writePublishedOutputLine(&rendered, cfg.ArtifactCatalog.PublishOutputs[0], nil, nil, availability)
|
||||
for _, fragment := range []string{"dest=transcripts/full.json", "declared_dest=transcripts/original.json", "declared_key=" + oldKey, "origin_run=" + originRun} {
|
||||
if !strings.Contains(rendered.String(), fragment) {
|
||||
t.Fatalf("rendered output = %q, want %q", rendered.String(), fragment)
|
||||
}
|
||||
t.Fatalf("exists keys=%v, want exact carried key", fake.ExistsKeys)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCommittedPublishOutputOutcomesRecognizesAllStates(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user