30 lines
1.2 KiB
Go
30 lines
1.2 KiB
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"testing"
|
|
"time"
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/internal/adapters/storage"
|
|
"gitea.maximumdirect.net/eric/narratio/internal/config"
|
|
)
|
|
|
|
func TestDiscoverRemoteCurrentStateRequiresCommittedPointer(t *testing.T) {
|
|
cfg := &config.Config{Pipeline: &config.PipelineConfig{Storage: config.StorageConfig{S3: &config.StorageS3Config{Bucket: "test-bucket", RootPrefix: "dnd"}}}, Session: &config.SessionConfig{Campaign: "sample-campaign", SessionID: "2026-05-03"}}
|
|
_, err := discoverRemoteCurrentState(context.Background(), cfg, &storage.FakeBackend{})
|
|
if err == nil {
|
|
t.Fatal("discoverRemoteCurrentState() error = nil, want missing committed pointer")
|
|
}
|
|
}
|
|
|
|
func restoreManifestJSON(t *testing.T, sessionID, campaign string) []byte {
|
|
t.Helper()
|
|
now := time.Date(2026, 5, 19, 23, 0, 0, 0, time.UTC).Format(time.RFC3339Nano)
|
|
data, err := json.Marshal(map[string]any{"schema_version": "narratio.session-manifest.v1", "session_id": sessionID, "campaign": campaign, "run_id": "20260519T010203Z-a1b2c3d4", "created_at": now, "updated_at": now, "stages": map[string]any{}})
|
|
if err != nil {
|
|
t.Fatalf("marshal manifest: %v", err)
|
|
}
|
|
return append(data, '\n')
|
|
}
|