capture_test.go 675 B

1234567891011121314151617181920212223242526272829
  1. package capture_test
  2. import (
  3. "os"
  4. "path/filepath"
  5. "testing"
  6. "hth/internal/capture"
  7. )
  8. func TestTruncatedRecordsRejected(t *testing.T) {
  9. dir := t.TempDir()
  10. p := capture.RecordsPath(dir)
  11. if err := os.WriteFile(p, []byte(`{"v":1,"kind":"event"`), 0o644); err != nil {
  12. t.Fatal(err)
  13. }
  14. r := filepath.Join(dir, "x")
  15. _ = r
  16. if _, err := capture.ReadRecords(p); err == nil {
  17. t.Fatal("truncated jsonl must fail")
  18. }
  19. }
  20. func TestManifestIncompleteRejectedByValidator(t *testing.T) {
  21. err := capture.ValidateManifest(capture.Manifest{Status: capture.StatusIncomplete}, "hth.api.v1", "", true)
  22. if err == nil {
  23. t.Fatal("incomplete must fail when requireComplete")
  24. }
  25. }