test(ops): add partition status unit tests and fix test mocks

- Add ops_partition_test.go with comprehensive unit tests:
  - Test partitioned table scenario
  - Test needs_partitioning warning level
  - Test info level warning (50K-100K rows)
  - Test below threshold scenario
  - Test error handling
  - Test nil repo handling

- Fix ops_repo_mock_test.go to implement new interface methods:
  - IsUsageLogsPartitioned
  - GetUsageLogsRowCount
  - GetUsageLogsPartitionCount

- Fix admin_basic_handlers_test.go password length:
  - Change "pass123" to "password123" (min=8 enforced)
This commit is contained in:
User
2026-04-17 07:20:54 +08:00
parent 60d15d2ba4
commit e34a59d720
3 changed files with 293 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ func TestUserHandlerEndpoints(t *testing.T) {
router.ServeHTTP(rec, req)
require.Equal(t, http.StatusOK, rec.Code)
createBody := map[string]any{"email": "new@example.com", "password": "pass123", "balance": 1, "concurrency": 2}
createBody := map[string]any{"email": "new@example.com", "password": "password123", "balance": 1, "concurrency": 2}
body, _ := json.Marshal(createBody)
rec = httptest.NewRecorder()
req = httptest.NewRequest(http.MethodPost, "/api/v1/admin/users", bytes.NewReader(body))