mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
Merge pull request #579 from seaweedfs/docs/drop-row-count
docs: the invariant row count is printed by the test, not kept in the file
This commit is contained in:
commit
543f090ebb
2 files changed
+10
-13
No files matched your search
@@ -553,7 +553,6 @@ stateDiagram-v2
|
||||
|
||||
## Part B. Invariant ledger
|
||||
|
||||
364 rows: 293 ACTIVE, 67 STUB, 4 ARCHIVED; 15 kept from the internal ledger, 349 new.
|
||||
|
||||
The "Machine / transition" column refers to Part A. Notes under a table record what a row does not cover and, for kept rows, what was narrowed from the internal ledger.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Package invcheck checks docs/design/invariants.md against the code: the
|
||||
// row count it states is the count its tables hold, every Go test a row
|
||||
// names exists, an ACTIVE row names at least one test, and a statement is
|
||||
// short (one property per row).
|
||||
// Package invcheck checks docs/design/invariants.md against the code: every
|
||||
// Go test a row names exists, an ACTIVE row names at least one test, a
|
||||
// statement is short (one property per row), and the file keeps no hand-written
|
||||
// row count (the test prints it).
|
||||
package invcheck
|
||||
|
||||
import (
|
||||
@@ -175,19 +175,17 @@ func TestInvariantRowsNameExistingTests(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvariantRowCountMatchesTables(t *testing.T) {
|
||||
func TestInvariantRowCount(t *testing.T) {
|
||||
rows, doc := partB(t, repoRoot(t))
|
||||
by := map[string]int{}
|
||||
for _, r := range rows {
|
||||
by[r.status]++
|
||||
}
|
||||
want := fmt.Sprintf("%d rows: %d ACTIVE, %d STUB, %d ARCHIVED", len(rows), by["ACTIVE"], by["STUB"], by["ARCHIVED"])
|
||||
m := strings.Replace(countLine.FindString(doc), "`INV-` ", "", 1)
|
||||
if m == "" {
|
||||
t.Fatalf("invariants.md states no row count; the tables hold: %s", want)
|
||||
}
|
||||
if m != want {
|
||||
t.Fatalf("invariants.md says %q; its tables hold %q", m, want)
|
||||
// The count is printed here, never kept by hand in the file: a hand-kept
|
||||
// line made every pull request conflict with every merge.
|
||||
t.Logf("%d rows: %d ACTIVE, %d STUB, %d ARCHIVED", len(rows), by["ACTIVE"], by["STUB"], by["ARCHIVED"])
|
||||
if m := countLine.FindString(doc); m != "" {
|
||||
t.Fatalf("invariants.md states a row count (%q); remove it, this test prints the count", m)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user