TestRepoMemoryMaxPatchSizeValidation tests max-patch-size boundary validation
(t *testing.T)
| 689 | |
| 690 | // TestRepoMemoryMaxPatchSizeValidation tests max-patch-size boundary validation |
| 691 | func TestRepoMemoryMaxPatchSizeValidation(t *testing.T) { |
| 692 | tests := []struct { |
| 693 | name string |
| 694 | maxPatchSize int |
| 695 | wantError bool |
| 696 | errorText string |
| 697 | }{ |
| 698 | { |
| 699 | name: "valid minimum size (1 byte)", |
| 700 | maxPatchSize: 1, |
| 701 | wantError: false, |
| 702 | }, |
| 703 | { |
| 704 | name: "valid maximum size (1048576 bytes = 1MB)", |
| 705 | maxPatchSize: 1048576, |
| 706 | wantError: false, |
| 707 | }, |
| 708 | { |
| 709 | name: "valid old maximum size (102400 bytes = 100KB)", |
| 710 | maxPatchSize: 102400, |
| 711 | wantError: false, |
| 712 | }, |
| 713 | { |
| 714 | name: "valid default size (10240 bytes)", |
| 715 | maxPatchSize: 10240, |
| 716 | wantError: false, |
| 717 | }, |
| 718 | { |
| 719 | name: "valid custom size (51200 bytes = 50KB)", |
| 720 | maxPatchSize: 51200, |
| 721 | wantError: false, |
| 722 | }, |
| 723 | { |
| 724 | name: "valid large size (512000 bytes = 500KB)", |
| 725 | maxPatchSize: 512000, |
| 726 | wantError: false, |
| 727 | }, |
| 728 | { |
| 729 | name: "invalid zero size", |
| 730 | maxPatchSize: 0, |
| 731 | wantError: true, |
| 732 | errorText: "max-patch-size must be between 1 and 1048576, got 0", |
| 733 | }, |
| 734 | { |
| 735 | name: "invalid negative size", |
| 736 | maxPatchSize: -1, |
| 737 | wantError: true, |
| 738 | errorText: "max-patch-size must be between 1 and 1048576, got -1", |
| 739 | }, |
| 740 | { |
| 741 | name: "invalid size exceeds maximum", |
| 742 | maxPatchSize: 1048577, |
| 743 | wantError: true, |
| 744 | errorText: "max-patch-size must be between 1 and 1048576, got 1048577", |
| 745 | }, |
| 746 | } |
| 747 | |
| 748 | for _, tt := range tests { |
nothing calls this directly
no test coverage detected