diff --git a/seaweed-block/core/authority/golden_v100_test.go b/seaweed-block/core/authority/golden_v100_test.go index baf6124611..5318c80c20 100644 --- a/seaweed-block/core/authority/golden_v100_test.go +++ b/seaweed-block/core/authority/golden_v100_test.go @@ -85,7 +85,11 @@ func goldenAuthorityFiles(t *testing.T, root string) map[string][]byte { // goldenAuthorityAtV100 is each fixture file's git blob hash as written on // the v1.0.0 tag checkout. -var goldenAuthorityAtV100 = map[string]string{} +var goldenAuthorityAtV100 = map[string]string{ + "v1.lostrange.json": "cb4200c2742a7c784d4eb2d1beed61a212053608", + "v1.v3auth.json": "88642d0ed99d19635e1ff3d2bd2082ecc319643e", + "v2.v3auth.json": "fb7a6a3cd8d2c81c955fc130566f6ae93c677c91", +} func TestAuthorityGoldenFilesAreTheV100Files(t *testing.T) { files := goldenAuthorityFiles(t, goldenAuthorityDir) diff --git a/seaweed-block/core/authority/testdata/golden-v1.0.0/README.md b/seaweed-block/core/authority/testdata/golden-v1.0.0/README.md new file mode 100644 index 0000000000..b457f4c301 --- /dev/null +++ b/seaweed-block/core/authority/testdata/golden-v1.0.0/README.md @@ -0,0 +1,12 @@ +# v1.0.0 authority store files of the master + +Generated once by `TestWriteGoldenV100Authority` (`golden_v100_test.go`), run with `SW_GOLDEN_WRITE` on a checkout of the tag **v1.0.0**, commit **bef007fddf341944faa2eb0ed36e1b3aefda96e8**, on Linux (these stores sync their directories). The inputs are fixed. The files are never regenerated on main. + +They are the durable authority lines (`*.v3auth.json`) and the forced-move lost ranges (`*.lostrange.json`). + +A master upgraded first reads these files. The checks: +- the store writes the same files for the same inputs; +- the store reads the files back as the same records; +- each file's git blob hash matches the one written on the tag. + +A failing check is fixed by restoring the store, or by the format path (a version bump, and a refusal of the old format first), never by rewriting a fixture. diff --git a/seaweed-block/core/authority/testdata/golden-v1.0.0/v1.lostrange.json b/seaweed-block/core/authority/testdata/golden-v1.0.0/v1.lostrange.json new file mode 100644 index 0000000000..cb4200c274 --- /dev/null +++ b/seaweed-block/core/authority/testdata/golden-v1.0.0/v1.lostrange.json @@ -0,0 +1 @@ +{"v":1,"volume":"v1","ranges":[{"RequestID":"move-1","NewEpoch":3,"OldReplicaID":"r1","OldEpoch":2,"LostAfterLSN":40,"LostUntilNS":1795800000000000000}],"checksum":"a2b34e21a39a638f9e5662e2ae52300c8701d50a3630d24f5ed580c6581e1486"} \ No newline at end of file diff --git a/seaweed-block/core/authority/testdata/golden-v1.0.0/v1.v3auth.json b/seaweed-block/core/authority/testdata/golden-v1.0.0/v1.v3auth.json new file mode 100644 index 0000000000..88642d0ed9 --- /dev/null +++ b/seaweed-block/core/authority/testdata/golden-v1.0.0/v1.v3auth.json @@ -0,0 +1 @@ +{"v":1,"body":{"VolumeID":"v1","ReplicaID":"r1","Epoch":3,"EndpointVersion":2,"DataAddr":"10.0.0.1:7001","CtrlAddr":"10.0.0.1:7002","WriteSeq":7,"Incarnation":"inc-1"},"checksum":"20f0b340cc25c0b05ea23be12b3b29b0a30b87a4d90d9ca476304285386ea013"} \ No newline at end of file diff --git a/seaweed-block/core/authority/testdata/golden-v1.0.0/v2.v3auth.json b/seaweed-block/core/authority/testdata/golden-v1.0.0/v2.v3auth.json new file mode 100644 index 0000000000..fb7a6a3cd8 --- /dev/null +++ b/seaweed-block/core/authority/testdata/golden-v1.0.0/v2.v3auth.json @@ -0,0 +1 @@ +{"v":1,"body":{"VolumeID":"v2","ReplicaID":"r1","Epoch":1,"EndpointVersion":1,"DataAddr":"10.0.0.2:7001","CtrlAddr":"10.0.0.2:7002","WriteSeq":1},"checksum":"9babb9679cb24f04bc3ef6ddee97405dbdf0990f65701aba52e4abc17b734e6b"} \ No newline at end of file diff --git a/seaweed-block/core/host/master/golden_v100_test.go b/seaweed-block/core/host/master/golden_v100_test.go index fa4a8fe90b..bfb4b2f111 100644 --- a/seaweed-block/core/host/master/golden_v100_test.go +++ b/seaweed-block/core/host/master/golden_v100_test.go @@ -23,7 +23,7 @@ const goldenAttestationFix = "the store-attestation file format changed from v1. // goldenAttestationAtV100 is store-attestations.json's git blob hash as // written on the v1.0.0 tag checkout. -const goldenAttestationAtV100 = "ATTESTATION_HASH" +const goldenAttestationAtV100 = "b151a79ebf529518e4d86542204c6df99e7c64b5" // goldenAttestations writes the file under dir through the store's own // steps: a volume opened for two replicas and its first ready noted, then diff --git a/seaweed-block/core/host/master/testdata/golden-v1.0.0/README.md b/seaweed-block/core/host/master/testdata/golden-v1.0.0/README.md new file mode 100644 index 0000000000..b53c010878 --- /dev/null +++ b/seaweed-block/core/host/master/testdata/golden-v1.0.0/README.md @@ -0,0 +1,10 @@ +# v1.0.0 store-attestation file of the master + +Generated once by `TestWriteGoldenV100Attestations` (`golden_v100_test.go`), run with `SW_GOLDEN_WRITE` on a checkout of the tag **v1.0.0**, commit **bef007fddf341944faa2eb0ed36e1b3aefda96e8**, on Linux (these stores sync their directories). The inputs are fixed. The files are never regenerated on main. + +A master upgraded first reads these files. The checks: +- the store writes the same files for the same inputs; +- the store reads the files back as the same records; +- each file's git blob hash matches the one written on the tag. + +A failing check is fixed by restoring the store, or by the format path (a version bump, and a refusal of the old format first), never by rewriting a fixture. diff --git a/seaweed-block/core/host/master/testdata/golden-v1.0.0/store-attestations.json b/seaweed-block/core/host/master/testdata/golden-v1.0.0/store-attestations.json new file mode 100644 index 0000000000..b151a79ebf --- /dev/null +++ b/seaweed-block/core/host/master/testdata/golden-v1.0.0/store-attestations.json @@ -0,0 +1 @@ +{"v1":{"primary":"r1","epoch":3,"stores":{"r1":"11111111111111111111111111111111","r2":"22222222222222222222222222222222"},"initial":["r1","r2"]},"v2":{"primary":"r1","epoch":1,"stores":{"r1":"33333333333333333333333333333333"}}} \ No newline at end of file diff --git a/seaweed-block/core/lifecycle/golden_v100_test.go b/seaweed-block/core/lifecycle/golden_v100_test.go index 5bfe178fa9..8291dbeec6 100644 --- a/seaweed-block/core/lifecycle/golden_v100_test.go +++ b/seaweed-block/core/lifecycle/golden_v100_test.go @@ -112,7 +112,14 @@ func goldenFiles(t *testing.T, root string) map[string][]byte { // goldenStoresAtV100 is each fixture file's git blob hash as written on the // v1.0.0 tag checkout. -var goldenStoresAtV100 = map[string]string{} +var goldenStoresAtV100 = map[string]string{ + "bindings/bindings.json": "58547b1c1fc3ba5dd9c932b8264a6b64fe457f98", + "deletions/reservations.json": "82ccb05e41bee851282f1ccea667bbe5ea364f3a", + "nodes/node-a.json": "091a3e2da07d2ebfafc667f31a00cee3bc095566", + "placements/v1.json": "6d7fb9781db7032dc716ab61eef8bc4103988110", + "volumes/t1.json": "717358b423edcc94c50a279161791e955503137c", + "volumes/v1.json": "673ec9e0c943a1c50e0454cc24054412fc9ef62c", +} // The fixtures are the files written on the v1.0.0 tag. func TestLifecycleGoldenFilesAreTheV100Files(t *testing.T) { diff --git a/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/README.md b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/README.md new file mode 100644 index 0000000000..3da3159a47 --- /dev/null +++ b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/README.md @@ -0,0 +1,14 @@ +# v1.0.0 lifecycle store files of the master + +Generated once by `TestWriteGoldenV100Stores` (`golden_v100_test.go`), run with `SW_GOLDEN_WRITE` on a checkout of the tag **v1.0.0**, commit **bef007fddf341944faa2eb0ed36e1b3aefda96e8**, on Linux (these stores sync their directories). The inputs are fixed. The files are never regenerated on main. + +The stores are volume records (`volumes/`), placement intents (`placements/`), node inventory (`nodes/`), deletion reservations (`deletions/`) and workspace bindings (`bindings/`). + +A volume record's layout ids are minted at random by the store (CreateVolume refuses a given one). The write check therefore compares volume records with those ids blanked; every other byte of every file is compared as written. + +A master upgraded first reads these files. The checks: +- the store writes the same files for the same inputs; +- the store reads the files back as the same records; +- each file's git blob hash matches the one written on the tag. + +A failing check is fixed by restoring the store, or by the format path (a version bump, and a refusal of the old format first), never by rewriting a fixture. diff --git a/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/bindings/bindings.json b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/bindings/bindings.json new file mode 100644 index 0000000000..58547b1c1f --- /dev/null +++ b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/bindings/bindings.json @@ -0,0 +1 @@ +{"v1":[{"volume_id":"v1","server_id":"node-a","data_addr":"10.0.0.1:7001","ctrl_addr":"10.0.0.1:7002"},{"volume_id":"v1","server_id":"node-b","data_addr":"10.0.0.2:7001","ctrl_addr":"10.0.0.2:7002","retired":true,"retired_epoch":3}]} \ No newline at end of file diff --git a/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/deletions/reservations.json b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/deletions/reservations.json new file mode 100644 index 0000000000..82ccb05e41 --- /dev/null +++ b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/deletions/reservations.json @@ -0,0 +1 @@ +{"going":{"volume_id":"going","state":"admitted","tokens":["del-2"]},"gone":{"volume_id":"gone","state":"committed","tokens":["del-1"]}} \ No newline at end of file diff --git a/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/nodes/node-a.json b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/nodes/node-a.json new file mode 100644 index 0000000000..091a3e2da0 --- /dev/null +++ b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/nodes/node-a.json @@ -0,0 +1,10 @@ +{ + "server_id": "node-a", + "addr": "10.0.0.1:7000", + "data_addr": "10.0.0.1:7001", + "ctrl_addr": "10.0.0.1:7002", + "labels": { + "zone": "z1" + }, + "seen_at": "2026-11-28T08:00:00Z" +} \ No newline at end of file diff --git a/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/placements/v1.json b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/placements/v1.json new file mode 100644 index 0000000000..6d7fb9781d --- /dev/null +++ b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/placements/v1.json @@ -0,0 +1,15 @@ +{ + "volume_id": "v1", + "desired_rf": 1, + "slots": [ + { + "server_id": "node-a", + "pool_id": "pool-0", + "replica_id": "r1", + "source": "existing_replica", + "data_addr": "10.0.0.1:7001", + "ctrl_addr": "10.0.0.1:7002", + "nvme_listen_port": 4420 + } + ] +} \ No newline at end of file diff --git a/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/volumes/t1.json b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/volumes/t1.json new file mode 100644 index 0000000000..717358b423 --- /dev/null +++ b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/volumes/t1.json @@ -0,0 +1,19 @@ +{ + "spec": { + "volume_id": "t1", + "layout_id": "9292513c52dc3869a745d15610c970d0", + "size_bytes": 1073741824, + "block_size": 4096, + "chunk_bytes": 4194304, + "source_volume": "v1", + "source_layout_id": "8ba950d8dcd72d13ff1cf6d6731644b2", + "source_snapshot": "daily", + "create_request_id": "restore-1", + "replication_factor": 1, + "protocol": "iscsi", + "pvc_name": "data", + "pvc_namespace": "ns", + "pvc_uid": "uid-1", + "pv_name": "pv-1" + } +} \ No newline at end of file diff --git a/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/volumes/v1.json b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/volumes/v1.json new file mode 100644 index 0000000000..673ec9e0c9 --- /dev/null +++ b/seaweed-block/core/lifecycle/testdata/golden-v1.0.0/volumes/v1.json @@ -0,0 +1,14 @@ +{ + "spec": { + "volume_id": "v1", + "layout_id": "8ba950d8dcd72d13ff1cf6d6731644b2", + "size_bytes": 1073741824, + "block_size": 4096, + "chunk_bytes": 4194304, + "replication_factor": 1, + "protocol": "nvme", + "frontend_transport": "tcp" + }, + "attached_to": "node-a", + "store_ready": true +} \ No newline at end of file