Files
s3/weed/s3api/s3lifecycle/final_cleanup_test.go
zooqueen dd74d3e6d6 Replace AGPL MinIO fork with Apache-2.0 SeaweedFS fork; rebrand CLI weed->s3
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.

- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
  "Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
  SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
  (replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
  keep their upstream import paths with zero churn. Internal identifiers and
  import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
  help/usage/flag strings, shell autocomplete program name, and the product name
  in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
  (e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
  `cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
  updated to ignore the `s3` build output.
2026-06-18 23:41:25 -07:00

49 lines
1.8 KiB
Go

package s3lifecycle
import (
"testing"
"github.com/stretchr/testify/assert"
)
// Final unit-test cleanup ahead of the integration suite. Pins the
// remaining 0%-and-default-branch helpers in the s3lifecycle package
// and the lifecycletest builder so a regression doesn't slip in
// during the integration work that follows.
func TestActionKind_StringUnspecifiedDefault(t *testing.T) {
// String's default branch (covers ActionKindUnspecified and any
// future enum value not listed) must render "unspecified" rather
// than empty or panic. Operators read this via the metrics labels
// (see S3LifecycleDispatchCounter "kind").
assert.Equal(t, "unspecified", ActionKindUnspecified.String())
assert.Equal(t, "unspecified", ActionKind(99).String())
}
func TestHashExtended_DirectFromLifecyclePackage(t *testing.T) {
// HashExtended is exercised from the s3api package's identity
// tests; pin it here so the s3lifecycle package's own coverage
// reflects the call. A nil/empty map produces no bytes, so the
// CAS witness collapses to "no Extended" rather than a synthetic
// hash that would mismatch on the server.
assert.Empty(t, HashExtended(nil))
assert.Empty(t, HashExtended(map[string][]byte{}))
got := HashExtended(map[string][]byte{"a": []byte("1")})
assert.NotEmpty(t, got)
// Same content, different literal/insertion order across multiple
// keys: hash must be stable. A single-key check can't catch an
// iteration-order regression — multiple keys force the helper's
// sort path to actually do work.
first := HashExtended(map[string][]byte{
"a": []byte("1"),
"b": []byte("2"),
"c": []byte("3"),
})
second := HashExtended(map[string][]byte{
"c": []byte("3"),
"a": []byte("1"),
"b": []byte("2"),
})
assert.Equal(t, first, second, "hash must be insensitive to map iteration order")
}