Remove legacy publish and state paths
This commit is contained in:
@@ -210,14 +210,14 @@ func TestRunPublishesNewLocalBundle(t *testing.T) {
|
||||
if destinationState.PipelineID != "reports" || destinationState.DestinationID != "archive" {
|
||||
t.Fatalf("state identity = %s/%s", destinationState.PipelineID, destinationState.DestinationID)
|
||||
}
|
||||
if destinationState.Source.Manifest.ID != manifest.ID {
|
||||
t.Fatalf("state source id = %q, want %q", destinationState.Source.Manifest.ID, manifest.ID)
|
||||
if destinationState.SourceID != manifest.ID {
|
||||
t.Fatalf("state source id = %q, want %q", destinationState.SourceID, manifest.ID)
|
||||
}
|
||||
if got, want := len(destinationState.Outputs), 2; got != want {
|
||||
t.Fatalf("state output count = %d, want %d", got, want)
|
||||
}
|
||||
if destinationState.Links != nil || destinationState.Outputs[0].URL != "" {
|
||||
t.Fatalf("state links = %#v output URL=%q, want absent", destinationState.Links, destinationState.Outputs[0].URL)
|
||||
if destinationState.PrimaryURL != "" || destinationState.Outputs[0].URL != "" {
|
||||
t.Fatalf("state primary URL = %q output URL=%q, want absent", destinationState.PrimaryURL, destinationState.Outputs[0].URL)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,8 +362,8 @@ func TestRunRecordsLinksForNestedBundlePath(t *testing.T) {
|
||||
t.Fatalf("Run() error = %v", err)
|
||||
}
|
||||
destinationState := readStateFile(t, filepath.Join(destinationRoot, "daily", "brentwood", storage.StateFileName))
|
||||
if destinationState.Links == nil || destinationState.Links.PrimaryURL != "https://reports.example.com/archive/daily/brentwood/report.md" {
|
||||
t.Fatalf("state links = %#v, want source primary URL", destinationState.Links)
|
||||
if destinationState.PrimaryURL != "https://reports.example.com/archive/daily/brentwood/report.md" {
|
||||
t.Fatalf("state primary URL = %q, want source primary URL", destinationState.PrimaryURL)
|
||||
}
|
||||
outputs := outputsByPath(destinationState.Outputs)
|
||||
if outputs["report.md"].URL != "https://reports.example.com/archive/daily/brentwood/report.md" {
|
||||
@@ -387,8 +387,8 @@ func TestRunRecordsLinksForFixedIndexDestination(t *testing.T) {
|
||||
t.Fatalf("Run() error = %v", err)
|
||||
}
|
||||
destinationState := readStateFile(t, filepath.Join(destinationRoot, storage.StateFileName))
|
||||
if destinationState.Links == nil || destinationState.Links.PrimaryURL != "https://reports.example.com/latest/" {
|
||||
t.Fatalf("state links = %#v, want fixed index primary URL", destinationState.Links)
|
||||
if destinationState.PrimaryURL != "https://reports.example.com/latest/" {
|
||||
t.Fatalf("state primary URL = %q, want fixed index primary URL", destinationState.PrimaryURL)
|
||||
}
|
||||
if got, want := len(destinationState.Outputs), 1; got != want {
|
||||
t.Fatalf("state output count = %d, want %d", got, want)
|
||||
@@ -427,8 +427,8 @@ func TestRunFixedPathPublishesNewestBundleAtDestinationRoot(t *testing.T) {
|
||||
t.Fatalf("nested new report stat error = %v, want not exist", err)
|
||||
}
|
||||
destinationState := readStateFile(t, filepath.Join(destinationRoot, storage.StateFileName))
|
||||
if destinationState.Source.Manifest.ID != "reports.new" {
|
||||
t.Fatalf("state source id = %q, want reports.new", destinationState.Source.Manifest.ID)
|
||||
if destinationState.SourceID != "reports.new" {
|
||||
t.Fatalf("state source id = %q, want reports.new", destinationState.SourceID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,8 +457,8 @@ func TestRunFixedPathTieBreaksByBundlePath(t *testing.T) {
|
||||
t.Fatalf("Run() error = %v", err)
|
||||
}
|
||||
destinationState := readStateFile(t, filepath.Join(destinationRoot, storage.StateFileName))
|
||||
if destinationState.Source.Manifest.ID != "reports.a" {
|
||||
t.Fatalf("state source id = %q, want reports.a", destinationState.Source.Manifest.ID)
|
||||
if destinationState.SourceID != "reports.a" {
|
||||
t.Fatalf("state source id = %q, want reports.a", destinationState.SourceID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1807,11 +1807,6 @@ func writeConfigFile(t *testing.T, body string) string {
|
||||
return path
|
||||
}
|
||||
|
||||
func writeDestinationState(t *testing.T, root, relative string, manifest bundle.Manifest) {
|
||||
t.Helper()
|
||||
testutil.WriteDestinationState(t, root, relative, manifest, testutil.DestinationStateOptions{})
|
||||
}
|
||||
|
||||
func writeJSONManifest(t *testing.T, root string, manifest bundle.Manifest) {
|
||||
t.Helper()
|
||||
if err := os.MkdirAll(root, 0o755); err != nil {
|
||||
@@ -1829,8 +1824,10 @@ func writeJSONManifest(t *testing.T, root string, manifest bundle.Manifest) {
|
||||
type testDestinationState struct {
|
||||
PipelineID string
|
||||
DestinationID string
|
||||
Source state.SourceState
|
||||
Links *state.LinkState
|
||||
SourceID string
|
||||
SourceDigest string
|
||||
SourceCreated time.Time
|
||||
PrimaryURL string
|
||||
Outputs []testStateOutput
|
||||
}
|
||||
|
||||
@@ -1859,11 +1856,11 @@ func readStateFile(t *testing.T, path string) testDestinationState {
|
||||
if index == 0 {
|
||||
view.PipelineID = output.PipelineID
|
||||
view.DestinationID = output.DestinationID
|
||||
view.Source.Manifest.ID = output.Source.ID
|
||||
view.Source.Manifest.Digest = output.Source.Digest
|
||||
view.Source.Manifest.Created = output.Source.Created
|
||||
view.SourceID = output.Source.ID
|
||||
view.SourceDigest = output.Source.Digest
|
||||
view.SourceCreated = output.Source.Created
|
||||
if output.URL != "" {
|
||||
view.Links = &state.LinkState{PrimaryURL: output.URL}
|
||||
view.PrimaryURL = output.URL
|
||||
}
|
||||
}
|
||||
view.Outputs = append(view.Outputs, testStateOutput{
|
||||
|
||||
Reference in New Issue
Block a user