Drop mimeType and ctime from the manifest format (closes #235)
check / check (push) Waiting to run
check / check (push) Waiting to run
Nothing goes in the 1.0 manifest that 1.0 does not read or write, and mfer never wrote either field. mf.proto now reserves the numbers 301 and 303 and both names in MFFilePath, and mf.pb.go is regenerated. The decoded-size check counts only file entries, hashes and timestamps, and counts a file entry, 16 bytes smaller without the two fields, at 160 bytes. export prints no ctime, and FileEntry loses the Ctime nothing set. FORMAT.md and the README no longer describe either field. The test of entries that decode too large gives each entry a second, empty hash: an entry with one hash and a modification time can no longer reach 8 times its size. Model: opus-5-5
This commit was merged in pull request #237.
This commit is contained in:
@@ -4,8 +4,10 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"maps"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
@@ -84,6 +86,36 @@ func TestExportManifestOperation(t *testing.T) {
|
||||
assert.True(t, pathSet["sub/file.txt"])
|
||||
}
|
||||
|
||||
// export prints the fields of a file entry and nothing else, so no ctime.
|
||||
func TestExportPrintsOnlyFileEntryFields(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
manifestData := buildTestManifest(t, map[string][]byte{"entry.txt": []byte("aaa")})
|
||||
|
||||
fs := afero.NewMemMapFs()
|
||||
require.NoError(t, afero.WriteFile(fs, "/test.mf", manifestData, 0o644))
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
|
||||
exitCode := runCLI(&RunOptions{
|
||||
Appname: testApp,
|
||||
Args: []string{testApp, testCmdExport, "/test.mf"},
|
||||
Stdin: &bytes.Buffer{},
|
||||
Stdout: &stdout,
|
||||
Stderr: &stderr,
|
||||
Fs: fs,
|
||||
})
|
||||
|
||||
require.Equal(t, 0, exitCode, "stderr: %s", stderr.String())
|
||||
|
||||
var entries []map[string]json.RawMessage
|
||||
require.NoError(t, json.Unmarshal(stdout.Bytes(), &entries))
|
||||
require.Len(t, entries, 1)
|
||||
assert.Equal(t,
|
||||
[]string{"hashes", "mode", "mtime", "path", "size"},
|
||||
slices.Sorted(maps.Keys(entries[0])))
|
||||
}
|
||||
|
||||
func TestExportFromHTTPURL(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user