diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 46c7cb4a..d5dfde7b 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -21,11 +21,11 @@ jobs: - name: Run Go tests id: go-tests - working-directory: backend + working-directory: ${{ github.workspace }} env: CGO_ENABLED: 1 run: | - go test -race -v -coverprofile=coverage.out ./... 2>&1 | tee test-output.txt + bash scripts/go-test-coverage.sh 2>&1 | tee backend/test-output.txt exit ${PIPESTATUS[0]} - name: Go Test Summary diff --git a/backend/test-output.txt b/backend/test-output.txt new file mode 100644 index 00000000..cc73f42c --- /dev/null +++ b/backend/test-output.txt @@ -0,0 +1,2893 @@ +# github.com/Wikid82/charon/backend/cmd/seed +go: no such tool "covdata" +# github.com/Wikid82/charon/backend/cmd/api +go: no such tool "covdata" +# github.com/Wikid82/charon/backend/internal/logger +go: no such tool "covdata" +# github.com/Wikid82/charon/backend/internal/metrics +go: no such tool "covdata" +# github.com/Wikid82/charon/backend/internal/util +go: no such tool "covdata" +=== RUN TestAccessListHandler_Create +=== RUN TestAccessListHandler_Create/create_whitelist_successfully +=== RUN TestAccessListHandler_Create/create_geo_whitelist_successfully +=== RUN TestAccessListHandler_Create/create_local_network_only +=== RUN TestAccessListHandler_Create/fail_with_invalid_type +=== RUN TestAccessListHandler_Create/fail_with_missing_name +--- PASS: TestAccessListHandler_Create (0.02s) + --- PASS: TestAccessListHandler_Create/create_whitelist_successfully (0.00s) + --- PASS: TestAccessListHandler_Create/create_geo_whitelist_successfully (0.00s) + --- PASS: TestAccessListHandler_Create/create_local_network_only (0.00s) + --- PASS: TestAccessListHandler_Create/fail_with_invalid_type (0.00s) + --- PASS: TestAccessListHandler_Create/fail_with_missing_name (0.00s) +=== RUN TestAccessListHandler_List +--- PASS: TestAccessListHandler_List (0.01s) +=== RUN TestAccessListHandler_Get +=== RUN TestAccessListHandler_Get/get_existing_ACL +=== RUN TestAccessListHandler_Get/get_non-existent_ACL + +2025/12/03 13:11:12 /projects/Charon/backend/internal/services/access_list_service.go:91 record not found +[0.141ms] [rows:0] SELECT * FROM `access_lists` WHERE `access_lists`.`id` = 9999 ORDER BY `access_lists`.`id` LIMIT 1 +--- PASS: TestAccessListHandler_Get (0.01s) + --- PASS: TestAccessListHandler_Get/get_existing_ACL (0.00s) + --- PASS: TestAccessListHandler_Get/get_non-existent_ACL (0.00s) +=== RUN TestAccessListHandler_Update +=== RUN TestAccessListHandler_Update/update_successfully +=== RUN TestAccessListHandler_Update/update_non-existent_ACL + +2025/12/03 13:11:12 /projects/Charon/backend/internal/services/access_list_service.go:91 record not found +[0.092ms] [rows:0] SELECT * FROM `access_lists` WHERE `access_lists`.`id` = 9999 ORDER BY `access_lists`.`id` LIMIT 1 +--- PASS: TestAccessListHandler_Update (0.02s) + --- PASS: TestAccessListHandler_Update/update_successfully (0.00s) + --- PASS: TestAccessListHandler_Update/update_non-existent_ACL (0.00s) +=== RUN TestAccessListHandler_Delete +=== RUN TestAccessListHandler_Delete/delete_successfully +=== RUN TestAccessListHandler_Delete/fail_to_delete_ACL_in_use +=== RUN TestAccessListHandler_Delete/delete_non-existent_ACL +--- PASS: TestAccessListHandler_Delete (0.02s) + --- PASS: TestAccessListHandler_Delete/delete_successfully (0.00s) + --- PASS: TestAccessListHandler_Delete/fail_to_delete_ACL_in_use (0.00s) + --- PASS: TestAccessListHandler_Delete/delete_non-existent_ACL (0.00s) +=== RUN TestAccessListHandler_TestIP +=== RUN TestAccessListHandler_TestIP/test_IP_in_whitelist +=== RUN TestAccessListHandler_TestIP/test_IP_not_in_whitelist +=== RUN TestAccessListHandler_TestIP/test_invalid_IP +=== RUN TestAccessListHandler_TestIP/test_non-existent_ACL + +2025/12/03 13:11:12 /projects/Charon/backend/internal/services/access_list_service.go:91 record not found +[0.066ms] [rows:0] SELECT * FROM `access_lists` WHERE `access_lists`.`id` = 9999 ORDER BY `access_lists`.`id` LIMIT 1 +--- PASS: TestAccessListHandler_TestIP (0.02s) + --- PASS: TestAccessListHandler_TestIP/test_IP_in_whitelist (0.00s) + --- PASS: TestAccessListHandler_TestIP/test_IP_not_in_whitelist (0.00s) + --- PASS: TestAccessListHandler_TestIP/test_invalid_IP (0.00s) + --- PASS: TestAccessListHandler_TestIP/test_non-existent_ACL (0.00s) +=== RUN TestAccessListHandler_GetTemplates +--- PASS: TestAccessListHandler_GetTemplates (0.01s) +=== RUN TestAuthHandler_Login +--- PASS: TestAuthHandler_Login (1.58s) +=== RUN TestAuthHandler_Login_Errors + +2025/12/03 13:11:14 /projects/Charon/backend/internal/services/auth_service.go:64 record not found +[0.115ms] [rows:0] SELECT * FROM `users` WHERE email = "nonexistent@example.com" ORDER BY `users`.`id` LIMIT 1 +--- PASS: TestAuthHandler_Login_Errors (0.00s) +=== RUN TestAuthHandler_Register +--- PASS: TestAuthHandler_Register (0.73s) +=== RUN TestAuthHandler_Register_Duplicate + +2025/12/03 13:11:15 /projects/Charon/backend/internal/services/auth_service.go:54 UNIQUE constraint failed: users.email +[0.461ms] [rows:0] INSERT INTO `users` (`uuid`,`email`,`api_key`,`password_hash`,`name`,`role`,`enabled`,`failed_login_attempts`,`locked_until`,`last_login`,`created_at`,`updated_at`) VALUES ("27721601-d22b-41ba-ac32-c75bd4e19167","dup@example.com","35bc31ae-2a31-41dd-a77c-d0438d9123ac","$2a$10$rUH.kxnabdTR3J4AxZDGtuwN6V7WJS1ULEJv1XhrGdTphQWv.sTHy","Dup User","user",true,0,NULL,NULL,"2025-12-03 13:11:14.837","2025-12-03 13:11:14.837") RETURNING `id` +--- PASS: TestAuthHandler_Register_Duplicate (0.75s) +=== RUN TestAuthHandler_Logout +--- PASS: TestAuthHandler_Logout (0.01s) +=== RUN TestAuthHandler_Me +--- PASS: TestAuthHandler_Me (0.00s) +=== RUN TestAuthHandler_Me_NotFound + +2025/12/03 13:11:15 /projects/Charon/backend/internal/services/auth_service.go:147 record not found +[0.246ms] [rows:0] SELECT * FROM `users` WHERE `users`.`id` = 999 ORDER BY `users`.`id` LIMIT 1 +--- PASS: TestAuthHandler_Me_NotFound (0.01s) +=== RUN TestAuthHandler_ChangePassword +--- PASS: TestAuthHandler_ChangePassword (3.16s) +=== RUN TestAuthHandler_ChangePassword_WrongOld +--- PASS: TestAuthHandler_ChangePassword_WrongOld (1.65s) +=== RUN TestAuthHandler_ChangePassword_Errors +--- PASS: TestAuthHandler_ChangePassword_Errors (0.00s) +=== RUN TestBackupHandlerSanitizesFilename +--- PASS: TestBackupHandlerSanitizesFilename (0.00s) +=== RUN TestBackupLifecycle +--- PASS: TestBackupLifecycle (0.02s) +=== RUN TestBackupHandler_Errors +--- PASS: TestBackupHandler_Errors (0.00s) +=== RUN TestBackupHandler_List_Success +--- PASS: TestBackupHandler_List_Success (0.01s) +=== RUN TestBackupHandler_Create_Success +--- PASS: TestBackupHandler_Create_Success (0.00s) +=== RUN TestBackupHandler_Download_Success +--- PASS: TestBackupHandler_Download_Success (0.00s) +=== RUN TestBackupHandler_PathTraversal +--- PASS: TestBackupHandler_PathTraversal (0.00s) +=== RUN TestBackupHandler_Download_InvalidPath +--- PASS: TestBackupHandler_Download_InvalidPath (0.00s) +=== RUN TestBackupHandler_Create_ServiceError +--- PASS: TestBackupHandler_Create_ServiceError (0.00s) +=== RUN TestBackupHandler_Delete_InternalError +--- PASS: TestBackupHandler_Delete_InternalError (0.00s) +=== RUN TestBackupHandler_Restore_InternalError +--- PASS: TestBackupHandler_Restore_InternalError (0.01s) +=== RUN TestDeleteCertificate_InUse +--- PASS: TestDeleteCertificate_InUse (0.01s) +=== RUN TestDeleteCertificate_CreatesBackup + +2025/12/03 13:11:20 /projects/Charon/backend/internal/api/handlers/certificate_handler_test.go:123 record not found +[0.056ms] [rows:0] SELECT * FROM `ssl_certificates` WHERE `ssl_certificates`.`id` = 1 ORDER BY `ssl_certificates`.`id` LIMIT 1 +--- PASS: TestDeleteCertificate_CreatesBackup (0.02s) +=== RUN TestDeleteCertificate_BackupFailure +--- PASS: TestDeleteCertificate_BackupFailure (0.01s) +=== RUN TestDeleteCertificate_InUse_NoBackup +--- PASS: TestDeleteCertificate_InUse_NoBackup (0.01s) +=== RUN TestCertificateHandler_List +--- PASS: TestCertificateHandler_List (0.02s) +=== RUN TestCertificateHandler_Upload_MissingName +--- PASS: TestCertificateHandler_Upload_MissingName (0.01s) +=== RUN TestCertificateHandler_Upload_MissingCertFile +--- PASS: TestCertificateHandler_Upload_MissingCertFile (0.01s) +=== RUN TestCertificateHandler_Upload_MissingKeyFile +--- PASS: TestCertificateHandler_Upload_MissingKeyFile (0.01s) +=== RUN TestCertificateHandler_Upload_Success +--- PASS: TestCertificateHandler_Upload_Success (0.24s) +=== RUN TestBackupHandlerQuick +--- PASS: TestBackupHandlerQuick (0.00s) +=== RUN TestDefaultCrowdsecExecutorPidFile +--- PASS: TestDefaultCrowdsecExecutorPidFile (0.00s) +=== RUN TestDefaultCrowdsecExecutorStartStatusStop +--- PASS: TestDefaultCrowdsecExecutorStartStatusStop (0.20s) +=== RUN TestCrowdsecEndpoints +--- PASS: TestCrowdsecEndpoints (0.00s) +=== RUN TestImportConfig +--- PASS: TestImportConfig (0.00s) +=== RUN TestImportCreatesBackup +--- PASS: TestImportCreatesBackup (0.00s) +=== RUN TestExportConfig +--- PASS: TestExportConfig (0.01s) +=== RUN TestListAndReadFile +--- PASS: TestListAndReadFile (0.00s) +=== RUN TestWriteFileCreatesBackup +--- PASS: TestWriteFileCreatesBackup (0.00s) +=== RUN TestDockerHandler_ListContainers +--- PASS: TestDockerHandler_ListContainers (0.02s) +=== RUN TestDockerHandler_ListContainers_NonExistentServerID + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/remoteserver_service.go:77 record not found +[0.073ms] [rows:0] SELECT * FROM `remote_servers` WHERE uuid = "non-existent-uuid" ORDER BY `remote_servers`.`id` LIMIT 1 +--- PASS: TestDockerHandler_ListContainers_NonExistentServerID (0.00s) +=== RUN TestDockerHandler_ListContainers_WithServerID +--- PASS: TestDockerHandler_ListContainers_WithServerID (0.01s) +=== RUN TestDockerHandler_ListContainers_WithHostQuery +--- PASS: TestDockerHandler_ListContainers_WithHostQuery (0.01s) +=== RUN TestDockerHandler_RegisterRoutes +--- PASS: TestDockerHandler_RegisterRoutes (0.01s) +=== RUN TestDockerHandler_NewDockerHandler +--- PASS: TestDockerHandler_NewDockerHandler (0.00s) +=== RUN TestDomainLifecycle +--- PASS: TestDomainLifecycle (0.01s) +=== RUN TestDomainErrors +--- PASS: TestDomainErrors (0.01s) +=== RUN TestDomainDelete_NotFound + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/domain_handler.go:73 record not found +[0.119ms] [rows:0] SELECT * FROM `domains` WHERE uuid = "nonexistent-uuid" AND `domains`.`deleted_at` IS NULL ORDER BY `domains`.`id` LIMIT 1 +--- PASS: TestDomainDelete_NotFound (0.01s) +=== RUN TestDomainCreate_Duplicate + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/domain_handler.go:49 UNIQUE constraint failed: domains.name +[0.236ms] [rows:0] INSERT INTO `domains` (`uuid`,`name`,`created_at`,`updated_at`,`deleted_at`) VALUES ("b22b6427-d89f-4dda-966f-4cd0b0431515","duplicate.com","2025-12-03 13:11:21.1","2025-12-03 13:11:21.1",NULL) RETURNING `id` +--- PASS: TestDomainCreate_Duplicate (0.01s) +=== RUN TestDomainList_Empty +--- PASS: TestDomainList_Empty (0.00s) +=== RUN TestDomainCreate_LongName +--- PASS: TestDomainCreate_LongName (0.01s) +=== RUN TestFeatureFlags_GetAndUpdate + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 record not found +[0.072ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.global.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 record not found +[0.101ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 record not found +[0.084ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.uptime.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 record not found +[0.075ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.notifications.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 record not found +[0.105ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.docker.enabled" ORDER BY `settings`.`id` LIMIT 1 +--- PASS: TestFeatureFlags_GetAndUpdate (0.00s) +=== RUN TestFeatureFlags_EnvFallback + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 no such table: settings +[1.312ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.global.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 no such table: settings +[0.059ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 no such table: settings +[0.058ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.uptime.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 no such table: settings +[0.055ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.notifications.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/feature_flags_handler.go:41 no such table: settings +[0.050ms] [rows:0] SELECT * FROM `settings` WHERE key = "feature.docker.enabled" ORDER BY `settings`.`id` LIMIT 1 +--- PASS: TestFeatureFlags_EnvFallback (0.00s) +=== RUN TestHealthHandler +--- PASS: TestHealthHandler (0.00s) +=== RUN TestIsSafePathUnderBase +--- PASS: TestIsSafePathUnderBase (0.00s) +=== RUN TestImportUploadSanitizesFilename +--- PASS: TestImportUploadSanitizesFilename (0.00s) +=== RUN TestLogsLifecycle +--- PASS: TestLogsLifecycle (0.00s) +=== RUN TestLogsHandler_PathTraversal +--- PASS: TestLogsHandler_PathTraversal (0.00s) +=== RUN TestNotificationTemplateHandler_CRUDAndPreview +--- PASS: TestNotificationTemplateHandler_CRUDAndPreview (0.01s) +=== RUN TestNotificationTemplateHandler_Create_InvalidJSON +--- PASS: TestNotificationTemplateHandler_Create_InvalidJSON (0.00s) +=== RUN TestNotificationTemplateHandler_Update_InvalidJSON +--- PASS: TestNotificationTemplateHandler_Update_InvalidJSON (0.00s) +=== RUN TestNotificationTemplateHandler_Preview_InvalidJSON +--- PASS: TestNotificationTemplateHandler_Preview_InvalidJSON (0.00s) +=== RUN TestProxyHostLifecycle + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/proxyhost_service.go:111 record not found +[0.061ms] [rows:0] SELECT * FROM `proxy_hosts` WHERE uuid = "234adb38-e057-4603-ac03-8c550280e89d" ORDER BY `proxy_hosts`.`id` LIMIT 1 +--- PASS: TestProxyHostLifecycle (0.01s) +=== RUN TestProxyHostDelete_WithUptimeCleanup + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/notification_service.go:81 no such table: notification_providers +[2.280ms] [rows:0] SELECT * FROM `notification_providers` WHERE enabled = true + +2025/12/03 13:11:21 /projects/Charon/backend/internal/api/handlers/proxy_host_handler_test.go:141 record not found +[0.110ms] [rows:0] SELECT * FROM `proxy_hosts` WHERE uuid = "ph-delete-1" ORDER BY `proxy_hosts`.`id` LIMIT 1 +--- PASS: TestProxyHostDelete_WithUptimeCleanup (0.02s) +=== RUN TestProxyHostErrors + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.097ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.050ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.053ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.078ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:85 no such table: security_configs +[2.832ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:93 no such table: security_rule_sets +[1.187ms] [rows:0] SELECT * FROM `security_rule_sets` + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:100 no such table: security_decisions +[1.223ms] [rows:0] SELECT * FROM `security_decisions` ORDER BY created_at desc + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/proxyhost_service.go:111 record not found +[0.137ms] [rows:0] SELECT * FROM `proxy_hosts` WHERE uuid = "non-existent-uuid" ORDER BY `proxy_hosts`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/proxyhost_service.go:111 record not found +[0.095ms] [rows:0] SELECT * FROM `proxy_hosts` WHERE uuid = "non-existent-uuid" ORDER BY `proxy_hosts`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.109ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.083ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.078ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.078ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:85 no such table: security_configs +[0.057ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:93 no such table: security_rule_sets +[0.044ms] [rows:0] SELECT * FROM `security_rule_sets` + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:100 no such table: security_decisions +[0.046ms] [rows:0] SELECT * FROM `security_decisions` ORDER BY created_at desc + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/proxyhost_service.go:111 record not found +[0.092ms] [rows:0] SELECT * FROM `proxy_hosts` WHERE uuid = "non-existent-uuid" ORDER BY `proxy_hosts`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.088ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.069ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.068ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.091ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:85 no such table: security_configs +[0.049ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:93 no such table: security_rule_sets +[0.032ms] [rows:0] SELECT * FROM `security_rule_sets` + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:100 no such table: security_decisions +[0.041ms] [rows:0] SELECT * FROM `security_decisions` ORDER BY created_at desc +--- PASS: TestProxyHostErrors (0.04s) +=== RUN TestProxyHostValidation +--- PASS: TestProxyHostValidation (0.01s) +=== RUN TestProxyHostCreate_AdvancedConfig_InvalidJSON +--- PASS: TestProxyHostCreate_AdvancedConfig_InvalidJSON (0.01s) +=== RUN TestProxyHostCreate_AdvancedConfig_Normalization +--- PASS: TestProxyHostCreate_AdvancedConfig_Normalization (0.02s) +=== RUN TestProxyHostUpdate_CertificateID_Null +--- PASS: TestProxyHostUpdate_CertificateID_Null (0.01s) +=== RUN TestProxyHostConnection +--- PASS: TestProxyHostConnection (0.01s) +=== RUN TestProxyHostHandler_List_Error + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/proxyhost_service.go:120 sql: database is closed +[0.023ms] [rows:0] SELECT * FROM `proxy_hosts` ORDER BY updated_at desc +--- PASS: TestProxyHostHandler_List_Error (0.01s) +=== RUN TestProxyHostWithCaddyIntegration + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.091ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.082ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.073ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.074ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:85 no such table: security_configs +[1.034ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:93 no such table: security_rule_sets +[0.914ms] [rows:0] SELECT * FROM `security_rule_sets` + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:100 no such table: security_decisions +[2.777ms] [rows:0] SELECT * FROM `security_decisions` ORDER BY created_at desc + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/notification_service.go:81 no such table: notification_providers +[1.321ms] [rows:0] SELECT * FROM `notification_providers` WHERE enabled = true + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.065ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.070ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.061ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.060ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:85 no such table: security_configs +[0.060ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:93 no such table: security_rule_sets +[0.050ms] [rows:0] SELECT * FROM `security_rule_sets` + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:100 no such table: security_decisions +[0.031ms] [rows:0] SELECT * FROM `security_decisions` ORDER BY created_at desc + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.070ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.080ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.051ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.080ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:85 no such table: security_configs +[0.036ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:93 no such table: security_rule_sets +[0.020ms] [rows:0] SELECT * FROM `security_rule_sets` + +2025/12/03 13:11:21 /projects/Charon/backend/internal/caddy/manager.go:100 no such table: security_decisions +[0.021ms] [rows:0] SELECT * FROM `security_decisions` ORDER BY created_at desc + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/notification_service.go:81 no such table: notification_providers +[0.045ms] [rows:0] SELECT * FROM `notification_providers` WHERE enabled = true +--- PASS: TestProxyHostWithCaddyIntegration (0.03s) +=== RUN TestProxyHostHandler_BulkUpdateACL_Success +--- PASS: TestProxyHostHandler_BulkUpdateACL_Success (0.01s) +=== RUN TestProxyHostHandler_BulkUpdateACL_RemoveACL +--- PASS: TestProxyHostHandler_BulkUpdateACL_RemoveACL (0.01s) +=== RUN TestProxyHostHandler_BulkUpdateACL_PartialFailure + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/proxyhost_service.go:111 record not found +[0.081ms] [rows:0] SELECT * FROM `proxy_hosts` WHERE uuid = "9f316f2c-7793-4805-bb02-66dd5c5a647b" ORDER BY `proxy_hosts`.`id` LIMIT 1 +--- PASS: TestProxyHostHandler_BulkUpdateACL_PartialFailure (0.01s) +=== RUN TestProxyHostHandler_BulkUpdateACL_EmptyUUIDs +--- PASS: TestProxyHostHandler_BulkUpdateACL_EmptyUUIDs (0.01s) +=== RUN TestProxyHostHandler_BulkUpdateACL_InvalidJSON +--- PASS: TestProxyHostHandler_BulkUpdateACL_InvalidJSON (0.01s) +=== RUN TestProxyHostUpdate_AdvancedConfig_ClearAndBackup +--- PASS: TestProxyHostUpdate_AdvancedConfig_ClearAndBackup (0.01s) +=== RUN TestProxyHostUpdate_AdvancedConfig_InvalidJSON +--- PASS: TestProxyHostUpdate_AdvancedConfig_InvalidJSON (0.01s) +=== RUN TestProxyHostUpdate_SetCertificateID +--- PASS: TestProxyHostUpdate_SetCertificateID (0.01s) +=== RUN TestProxyHostUpdate_AdvancedConfig_SetBackup +--- PASS: TestProxyHostUpdate_AdvancedConfig_SetBackup (0.01s) +=== RUN TestProxyHostUpdate_ForwardPort_StringValue +--- PASS: TestProxyHostUpdate_ForwardPort_StringValue (0.01s) +=== RUN TestProxyHostUpdate_Locations_InvalidPayload +--- PASS: TestProxyHostUpdate_Locations_InvalidPayload (0.01s) +=== RUN TestProxyHostUpdate_SetBooleansAndApplication +--- PASS: TestProxyHostUpdate_SetBooleansAndApplication (0.01s) +=== RUN TestProxyHostUpdate_Locations_Replace +--- PASS: TestProxyHostUpdate_Locations_Replace (0.01s) +=== RUN TestProxyHostCreate_WithCertificateAndLocations +--- PASS: TestProxyHostCreate_WithCertificateAndLocations (0.01s) +=== RUN TestSanitizeForLog +--- PASS: TestSanitizeForLog (0.00s) +=== RUN TestSecurityHandler_GetConfigAndUpdateConfig + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/security_service.go:37 record not found +[0.081ms] [rows:0] SELECT * FROM `security_configs` ORDER BY `security_configs`.`id` LIMIT 1 + +2025/12/03 13:11:21 /projects/Charon/backend/internal/services/security_service.go:73 record not found +[0.098ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 +--- PASS: TestSecurityHandler_GetConfigAndUpdateConfig (0.01s) +=== RUN TestSecurityHandler_GetStatus_Clean +--- PASS: TestSecurityHandler_GetStatus_Clean (0.00s) +=== RUN TestSecurityHandler_Cerberus_DBOverride +--- PASS: TestSecurityHandler_Cerberus_DBOverride (0.00s) +=== RUN TestSecurityHandler_ACL_DBOverride +--- PASS: TestSecurityHandler_ACL_DBOverride (0.00s) +=== RUN TestSecurityHandler_GenerateBreakGlass_ReturnsToken + +2025/12/03 13:11:22 /projects/Charon/backend/internal/services/security_service.go:113 record not found +[0.213ms] [rows:0] SELECT * FROM `security_configs` WHERE name = "default" ORDER BY `security_configs`.`id` LIMIT 1 +--- PASS: TestSecurityHandler_GenerateBreakGlass_ReturnsToken (0.73s) +=== RUN TestSecurityHandler_ACL_DisabledWhenCerberusOff +--- PASS: TestSecurityHandler_ACL_DisabledWhenCerberusOff (0.01s) +=== RUN TestSecurityHandler_CrowdSec_Mode_DBOverride +--- PASS: TestSecurityHandler_CrowdSec_Mode_DBOverride (0.00s) +=== RUN TestSecurityHandler_CrowdSec_ExternalMappedToDisabled_DBOverride +--- PASS: TestSecurityHandler_CrowdSec_ExternalMappedToDisabled_DBOverride (0.01s) +=== RUN TestSecurityHandler_ExternalModeMappedToDisabled +--- PASS: TestSecurityHandler_ExternalModeMappedToDisabled (0.00s) +=== RUN TestSecurityHandler_Enable_Disable_WithAdminWhitelistAndToken +--- PASS: TestSecurityHandler_Enable_Disable_WithAdminWhitelistAndToken (1.54s) +=== RUN TestSecurityHandler_CreateAndListDecisionAndRulesets + +2025/12/03 13:11:23 /projects/Charon/backend/internal/services/security_service.go:204 record not found +[0.154ms] [rows:0] SELECT * FROM `security_rule_sets` WHERE name = "owasp-crs" ORDER BY `security_rule_sets`.`id` LIMIT 1 +--- PASS: TestSecurityHandler_CreateAndListDecisionAndRulesets (0.12s) +=== RUN TestSecurityHandler_UpsertDeleteTriggersApplyConfig + +2025/12/03 13:11:23 /projects/Charon/backend/internal/services/security_service.go:204 record not found +[0.127ms] [rows:0] SELECT * FROM `security_rule_sets` WHERE name = "owasp-crs" ORDER BY `security_rule_sets`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.527ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.080ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.100ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.083ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:68 record not found +[0.074ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.acme_email" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:75 record not found +[0.226ms] [rows:0] SELECT * FROM `settings` WHERE key = "caddy.ssl_provider" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:366 record not found +[0.197ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.cerberus.enabled" ORDER BY `settings`.`id` LIMIT 1 + +2025/12/03 13:11:23 /projects/Charon/backend/internal/caddy/manager.go:371 record not found +[0.111ms] [rows:0] SELECT * FROM `settings` WHERE key = "security.acl.enabled" ORDER BY `settings`.`id` LIMIT 1 +--- PASS: TestSecurityHandler_UpsertDeleteTriggersApplyConfig (0.03s) +=== RUN TestGetClientIPHeadersAndRemoteAddr +--- PASS: TestGetClientIPHeadersAndRemoteAddr (0.00s) +=== RUN TestGetMyIPHandler +--- PASS: TestGetMyIPHandler (0.00s) +=== RUN TestUpdateHandler_Check +--- PASS: TestUpdateHandler_Check (0.01s) +=== RUN TestUserHandler_GetSetupStatus +--- PASS: TestUserHandler_GetSetupStatus (0.01s) +=== RUN TestUserHandler_Setup +--- PASS: TestUserHandler_Setup (0.75s) +=== RUN TestUserHandler_Setup_DBError +--- PASS: TestUserHandler_Setup_DBError (0.00s) +=== RUN TestUserHandler_RegenerateAPIKey +--- PASS: TestUserHandler_RegenerateAPIKey (0.00s) +=== RUN TestUserHandler_GetProfile +--- PASS: TestUserHandler_GetProfile (0.00s) +=== RUN TestUserHandler_RegisterRoutes +--- PASS: TestUserHandler_RegisterRoutes (0.00s) +=== RUN TestUserHandler_Errors + +2025/12/03 13:11:24 /projects/Charon/backend/internal/api/handlers/user_handler.go:147 record not found +[0.091ms] [rows:0] SELECT * FROM `users` WHERE `users`.`id` = 99999 ORDER BY `users`.`id` LIMIT 1 + +2025/12/03 13:11:24 /projects/Charon/backend/internal/api/handlers/user_handler.go:130 no such table: users +[0.186ms] [rows:0] UPDATE `users` SET `api_key`="65b8b12e-6395-444a-af17-649186b1ac83",`updated_at`="2025-12-03 13:11:24.714" WHERE id = 99999 +--- PASS: TestUserHandler_Errors (0.00s) +=== RUN TestUserHandler_UpdateProfile +=== RUN TestUserHandler_UpdateProfile/Success_Name_Only +=== RUN TestUserHandler_UpdateProfile/Success_Email_Change +=== RUN TestUserHandler_UpdateProfile/Fail_Email_Change_No_Password +=== RUN TestUserHandler_UpdateProfile/Fail_Email_Change_Wrong_Password +=== RUN TestUserHandler_UpdateProfile/Fail_Email_In_Use +--- PASS: TestUserHandler_UpdateProfile (2.37s) + --- PASS: TestUserHandler_UpdateProfile/Success_Name_Only (0.00s) + --- PASS: TestUserHandler_UpdateProfile/Success_Email_Change (0.77s) + --- PASS: TestUserHandler_UpdateProfile/Fail_Email_Change_No_Password (0.00s) + --- PASS: TestUserHandler_UpdateProfile/Fail_Email_Change_Wrong_Password (0.84s) + --- PASS: TestUserHandler_UpdateProfile/Fail_Email_In_Use (0.00s) +=== RUN TestUserHandler_UpdateProfile_Errors + +2025/12/03 13:11:27 /projects/Charon/backend/internal/api/handlers/user_handler.go:183 record not found +[0.102ms] [rows:0] SELECT * FROM `users` WHERE `users`.`id` = 999 ORDER BY `users`.`id` LIMIT 1 +--- PASS: TestUserHandler_UpdateProfile_Errors (0.00s) +=== RUN TestUserLoginAfterEmailChange +--- PASS: TestUserLoginAfterEmailChange (3.56s) +=== RUN TestRemoteServerHandler_List +--- PASS: TestRemoteServerHandler_List (0.02s) +=== RUN TestRemoteServerHandler_Create +--- PASS: TestRemoteServerHandler_Create (0.02s) +=== RUN TestRemoteServerHandler_TestConnection +--- PASS: TestRemoteServerHandler_TestConnection (0.02s) +=== RUN TestRemoteServerHandler_Get +--- PASS: TestRemoteServerHandler_Get (0.02s) +=== RUN TestRemoteServerHandler_Update +--- PASS: TestRemoteServerHandler_Update (0.02s) +=== RUN TestRemoteServerHandler_Delete + +2025/12/03 13:11:30 /projects/Charon/backend/internal/services/remoteserver_service.go:77 record not found +[0.088ms] [rows:0] SELECT * FROM `remote_servers` WHERE uuid = "71f10185-8109-4781-9724-420affba4fc0" ORDER BY `remote_servers`.`id` LIMIT 1 +--- PASS: TestRemoteServerHandler_Delete (0.02s) +=== RUN TestProxyHostHandler_List +--- PASS: TestProxyHostHandler_List (0.02s) +=== RUN TestProxyHostHandler_Create +--- PASS: TestProxyHostHandler_Create (0.02s) +=== RUN TestProxyHostHandler_PartialUpdate_DoesNotWipeFields +--- PASS: TestProxyHostHandler_PartialUpdate_DoesNotWipeFields (0.01s) +=== RUN TestHealthHandler +--- PASS: TestHealthHandler (0.00s) +=== RUN TestRemoteServerHandler_Errors + +2025/12/03 13:11:30 /projects/Charon/backend/internal/services/remoteserver_service.go:77 record not found +[0.114ms] [rows:0] SELECT * FROM `remote_servers` WHERE uuid = "non-existent" ORDER BY `remote_servers`.`id` LIMIT 1 + +2025/12/03 13:11:30 /projects/Charon/backend/internal/services/remoteserver_service.go:77 record not found +[0.100ms] [rows:0] SELECT * FROM `remote_servers` WHERE uuid = "non-existent" ORDER BY `remote_servers`.`id` LIMIT 1 + +2025/12/03 13:11:30 /projects/Charon/backend/internal/services/remoteserver_service.go:77 record not found +[0.089ms] [rows:0] SELECT * FROM `remote_servers` WHERE uuid = "non-existent" ORDER BY `remote_servers`.`id` LIMIT 1 +--- PASS: TestRemoteServerHandler_Errors (0.02s) +=== RUN TestImportHandler_GetStatus + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:60 record not found +[0.221ms] [rows:0] SELECT * FROM `import_sessions` WHERE status IN ("pending","reviewing") ORDER BY created_at DESC,`import_sessions`.`id` LIMIT 1 + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:60 record not found +[0.119ms] [rows:0] SELECT * FROM `import_sessions` WHERE status IN ("pending","reviewing") ORDER BY created_at DESC,`import_sessions`.`id` LIMIT 1 + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:70 record not found +[0.131ms] [rows:0] SELECT * FROM `import_sessions` WHERE source_file = "/tmp/TestImportHandler_GetStatus223029045/001/mounted.caddyfile" AND status = "committed" ORDER BY committed_at DESC,`import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_GetStatus (0.01s) +=== RUN TestImportHandler_GetPreview + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:122 record not found +[0.203ms] [rows:0] SELECT * FROM `import_sessions` WHERE status IN ("pending","reviewing") ORDER BY created_at DESC,`import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_GetPreview (0.01s) +=== RUN TestImportHandler_Cancel +--- PASS: TestImportHandler_Cancel (0.01s) +=== RUN TestImportHandler_Commit +--- PASS: TestImportHandler_Commit (0.01s) +=== RUN TestImportHandler_Upload +--- PASS: TestImportHandler_Upload (0.01s) +=== RUN TestImportHandler_GetPreview_WithContent +--- PASS: TestImportHandler_GetPreview_WithContent (0.01s) +=== RUN TestImportHandler_Commit_Errors + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:583 record not found +[0.086ms] [rows:0] SELECT * FROM `import_sessions` WHERE uuid = "non-existent" AND status = "reviewing" ORDER BY `import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_Commit_Errors (0.01s) +=== RUN TestImportHandler_Cancel_Errors + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:734 record not found +[0.113ms] [rows:0] SELECT * FROM `import_sessions` WHERE uuid = "non-existent" ORDER BY `import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_Cancel_Errors (0.01s) +=== RUN TestCheckMountedImport +--- PASS: TestCheckMountedImport (0.01s) +=== RUN TestImportHandler_Upload_Failure +--- PASS: TestImportHandler_Upload_Failure (0.01s) +=== RUN TestImportHandler_Upload_Conflict +--- PASS: TestImportHandler_Upload_Conflict (0.02s) +=== RUN TestImportHandler_GetPreview_BackupContent +--- PASS: TestImportHandler_GetPreview_BackupContent (0.01s) +=== RUN TestImportHandler_RegisterRoutes + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:60 record not found +[0.199ms] [rows:0] SELECT * FROM `import_sessions` WHERE status IN ("pending","reviewing") ORDER BY created_at DESC,`import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_RegisterRoutes (0.01s) +=== RUN TestImportHandler_GetPreview_TransientMount + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:122 record not found +[0.681ms] [rows:0] SELECT * FROM `import_sessions` WHERE status IN ("pending","reviewing") ORDER BY created_at DESC,`import_sessions`.`id` LIMIT 1 + +2025/12/03 13:11:30 /projects/Charon/backend/internal/api/handlers/import_handler.go:167 record not found +[0.115ms] [rows:0] SELECT * FROM `import_sessions` WHERE source_file = "/tmp/TestImportHandler_GetPreview_TransientMount2275059922/001/mounted.caddyfile" AND status = "committed" ORDER BY committed_at DESC,`import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_GetPreview_TransientMount (0.02s) +=== RUN TestImportHandler_Commit_TransientUpload + +2025/12/03 13:11:31 /projects/Charon/backend/internal/api/handlers/import_handler.go:583 record not found +[0.166ms] [rows:0] SELECT * FROM `import_sessions` WHERE uuid = "f097ac93-08cd-485d-a620-b4511aef9ad4" AND status = "reviewing" ORDER BY `import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_Commit_TransientUpload (0.03s) +=== RUN TestImportHandler_Commit_TransientMount + +2025/12/03 13:11:31 /projects/Charon/backend/internal/api/handlers/import_handler.go:583 record not found +[0.125ms] [rows:0] SELECT * FROM `import_sessions` WHERE uuid = "01639183-afad-4cc5-b2cf-358a177609f4" AND status = "reviewing" ORDER BY `import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_Commit_TransientMount (0.02s) +=== RUN TestImportHandler_Cancel_TransientUpload + +2025/12/03 13:11:31 /projects/Charon/backend/internal/api/handlers/import_handler.go:734 record not found +[0.095ms] [rows:0] SELECT * FROM `import_sessions` WHERE uuid = "aad4278f-1dbe-4db0-8949-b83b94481003" ORDER BY `import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_Cancel_TransientUpload (0.02s) +=== RUN TestImportHandler_Errors + +2025/12/03 13:11:31 /projects/Charon/backend/internal/api/handlers/import_handler.go:583 record not found +[0.081ms] [rows:0] SELECT * FROM `import_sessions` WHERE uuid = "non-existent" AND status = "reviewing" ORDER BY `import_sessions`.`id` LIMIT 1 + +2025/12/03 13:11:31 /projects/Charon/backend/internal/api/handlers/import_handler.go:734 record not found +[0.072ms] [rows:0] SELECT * FROM `import_sessions` WHERE uuid = "non-existent" ORDER BY `import_sessions`.`id` LIMIT 1 +--- PASS: TestImportHandler_Errors (0.01s) +=== RUN TestImportHandler_DetectImports +=== RUN TestImportHandler_DetectImports/no_imports +=== RUN TestImportHandler_DetectImports/single_import +=== RUN TestImportHandler_DetectImports/multiple_imports +=== RUN TestImportHandler_DetectImports/import_with_comment +--- PASS: TestImportHandler_DetectImports (0.01s) + --- PASS: TestImportHandler_DetectImports/no_imports (0.00s) + --- PASS: TestImportHandler_DetectImports/single_import (0.00s) + --- PASS: TestImportHandler_DetectImports/multiple_imports (0.00s) + --- PASS: TestImportHandler_DetectImports/import_with_comment (0.00s) +=== RUN TestImportHandler_DetectImports_InvalidJSON +--- PASS: TestImportHandler_DetectImports_InvalidJSON (0.01s) +=== RUN TestImportHandler_UploadMulti +=== RUN TestImportHandler_UploadMulti/single_Caddyfile +=== RUN TestImportHandler_UploadMulti/Caddyfile_with_site_files +=== RUN TestImportHandler_UploadMulti/missing_Caddyfile +=== RUN TestImportHandler_UploadMulti/path_traversal_in_filename +=== RUN TestImportHandler_UploadMulti/empty_file_content +--- PASS: TestImportHandler_UploadMulti (0.02s) + --- PASS: TestImportHandler_UploadMulti/single_Caddyfile (0.00s) + --- PASS: TestImportHandler_UploadMulti/Caddyfile_with_site_files (0.00s) + --- PASS: TestImportHandler_UploadMulti/missing_Caddyfile (0.00s) + --- PASS: TestImportHandler_UploadMulti/path_traversal_in_filename (0.00s) + --- PASS: TestImportHandler_UploadMulti/empty_file_content (0.00s) +=== RUN TestNotificationHandler_List +--- PASS: TestNotificationHandler_List (0.01s) +=== RUN TestNotificationHandler_MarkAsRead +--- PASS: TestNotificationHandler_MarkAsRead (0.01s) +=== RUN TestNotificationHandler_MarkAllAsRead +--- PASS: TestNotificationHandler_MarkAllAsRead (0.01s) +=== RUN TestNotificationHandler_MarkAllAsRead_Error +--- PASS: TestNotificationHandler_MarkAllAsRead_Error (0.01s) +=== RUN TestNotificationHandler_DBError +--- PASS: TestNotificationHandler_DBError (0.01s) +=== RUN TestNotificationProviderHandler_CRUD +[GIN] 2025/12/03 - 13:11:31 | 201 | 414.902µs | | POST "/api/v1/notifications/providers" +[GIN] 2025/12/03 - 13:11:31 | 200 | 229.861µs | | GET "/api/v1/notifications/providers" +[GIN] 2025/12/03 - 13:11:31 | 200 | 384.911µs | | PUT "/api/v1/notifications/providers/978cd427-fd22-431e-93ae-e67b2e392313" +[GIN] 2025/12/03 - 13:11:31 | 200 | 213.951µs | | DELETE "/api/v1/notifications/providers/978cd427-fd22-431e-93ae-e67b2e392313" +--- PASS: TestNotificationProviderHandler_CRUD (0.01s) +=== RUN TestNotificationProviderHandler_Templates +[GIN] 2025/12/03 - 13:11:31 | 200 | 75.851µs | | GET "/api/v1/notifications/templates" +--- PASS: TestNotificationProviderHandler_Templates (0.00s) +=== RUN TestNotificationProviderHandler_Test +[GIN] 2025/12/03 - 13:11:31 | 400 | 257.281µs | | POST "/api/v1/notifications/providers/test" +--- PASS: TestNotificationProviderHandler_Test (0.01s) +=== RUN TestNotificationProviderHandler_Errors +[GIN] 2025/12/03 - 13:11:31 | 400 | 28.15µs | | POST "/api/v1/notifications/providers" +[GIN] 2025/12/03 - 13:11:31 | 400 | 16.339µs | | PUT "/api/v1/notifications/providers/123" +[GIN] 2025/12/03 - 13:11:31 | 400 | 14.72µs | | POST "/api/v1/notifications/providers/test" +--- PASS: TestNotificationProviderHandler_Errors (0.00s) +=== RUN TestNotificationProviderHandler_InvalidCustomTemplate_Rejects +[GIN] 2025/12/03 - 13:11:31 | 400 | 275.86µs | | POST "/api/v1/notifications/providers" +[GIN] 2025/12/03 - 13:11:31 | 201 | 510.481µs | | POST "/api/v1/notifications/providers" +[GIN] 2025/12/03 - 13:11:31 | 400 | 242.201µs | | PUT "/api/v1/notifications/providers/5a2df675-03c2-41ff-9778-991f7a650a79" +--- PASS: TestNotificationProviderHandler_InvalidCustomTemplate_Rejects (0.01s) +=== RUN TestNotificationProviderHandler_Preview +[GIN] 2025/12/03 - 13:11:31 | 200 | 519.073µs | | POST "/api/v1/notifications/providers/preview" +[GIN] 2025/12/03 - 13:11:31 | 400 | 283.401µs | | POST "/api/v1/notifications/providers/preview" +--- PASS: TestNotificationProviderHandler_Preview (0.01s) +=== RUN TestRemoteServerHandler_TestConnectionCustom +[GIN] 2025/12/03 - 13:11:31 | 200 | 593.793µs | | POST "/api/v1/remote-servers/test" +--- PASS: TestRemoteServerHandler_TestConnectionCustom (0.02s) +=== RUN TestRemoteServerHandler_FullCRUD +[GIN] 2025/12/03 - 13:11:31 | 201 | 979.364µs | | POST "/api/v1/remote-servers" +[GIN] 2025/12/03 - 13:11:31 | 200 | 322.731µs | | GET "/api/v1/remote-servers" +[GIN] 2025/12/03 - 13:11:31 | 200 | 255.851µs | | GET "/api/v1/remote-servers/957d8d6f-f4c6-4085-b565-9213e34f6c28" +[GIN] 2025/12/03 - 13:11:31 | 200 | 709.242µs | | PUT "/api/v1/remote-servers/957d8d6f-f4c6-4085-b565-9213e34f6c28" +[GIN] 2025/12/03 - 13:11:31 | 204 | 484.491µs | | DELETE "/api/v1/remote-servers/957d8d6f-f4c6-4085-b565-9213e34f6c28" +[GIN] 2025/12/03 - 13:11:31 | 400 | 32.161µs | | POST "/api/v1/remote-servers" + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/remoteserver_service.go:77 record not found +[0.102ms] [rows:0] SELECT * FROM `remote_servers` WHERE uuid = "non-existent-uuid" ORDER BY `remote_servers`.`id` LIMIT 1 +[GIN] 2025/12/03 - 13:11:31 | 404 | 627.072µs | | PUT "/api/v1/remote-servers/non-existent-uuid" + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/remoteserver_service.go:77 record not found +[0.505ms] [rows:0] SELECT * FROM `remote_servers` WHERE uuid = "non-existent-uuid" ORDER BY `remote_servers`.`id` LIMIT 1 +[GIN] 2025/12/03 - 13:11:31 | 404 | 616.742µs | | DELETE "/api/v1/remote-servers/non-existent-uuid" +--- PASS: TestRemoteServerHandler_FullCRUD (0.03s) +=== RUN TestSettingsHandler_GetSettings +--- PASS: TestSettingsHandler_GetSettings (0.00s) +=== RUN TestSettingsHandler_UpdateSettings +--- PASS: TestSettingsHandler_UpdateSettings (0.00s) +=== RUN TestSettingsHandler_Errors +--- PASS: TestSettingsHandler_Errors (0.00s) +=== RUN TestUptimeHandler_List +[GIN] 2025/12/03 - 13:11:31 | 200 | 420.652µs | | GET "/api/v1/uptime" +--- PASS: TestUptimeHandler_List (0.02s) +=== RUN TestUptimeHandler_GetHistory +[GIN] 2025/12/03 - 13:11:31 | 200 | 296.642µs | | GET "/api/v1/uptime/monitor-1/history" +--- PASS: TestUptimeHandler_GetHistory (0.02s) +=== RUN TestUptimeHandler_CheckMonitor +[GIN] 2025/12/03 - 13:11:31 | 200 | 339.442µs | | POST "/api/v1/uptime/check-mon-1/check" +--- PASS: TestUptimeHandler_CheckMonitor (0.02s) +=== RUN TestUptimeHandler_CheckMonitor_NotFound + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/uptime_service.go:819 record not found +[0.106ms] [rows:0] SELECT * FROM `uptime_monitors` WHERE id = "nonexistent" ORDER BY `uptime_monitors`.`id` LIMIT 1 +[GIN] 2025/12/03 - 13:11:31 | 404 | 233.831µs | | POST "/api/v1/uptime/nonexistent/check" +--- PASS: TestUptimeHandler_CheckMonitor_NotFound (0.02s) +=== RUN TestUptimeHandler_Update +=== RUN TestUptimeHandler_Update/success +[GIN] 2025/12/03 - 13:11:31 | 200 | 789.673µs | | PUT "/api/v1/uptime/monitor-update" +=== RUN TestUptimeHandler_Update/invalid_json +[GIN] 2025/12/03 - 13:11:31 | 400 | 48.03µs | | PUT "/api/v1/uptime/monitor-1" +=== RUN TestUptimeHandler_Update/not_found + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/uptime_service.go:833 record not found +[0.114ms] [rows:0] SELECT * FROM `uptime_monitors` WHERE id = "nonexistent" ORDER BY `uptime_monitors`.`id` LIMIT 1 +[GIN] 2025/12/03 - 13:11:31 | 500 | 263.372µs | | PUT "/api/v1/uptime/nonexistent" +--- PASS: TestUptimeHandler_Update (0.05s) + --- PASS: TestUptimeHandler_Update/success (0.02s) + --- PASS: TestUptimeHandler_Update/invalid_json (0.01s) + --- PASS: TestUptimeHandler_Update/not_found (0.02s) +=== RUN TestUptimeHandler_DeleteAndSync +=== RUN TestUptimeHandler_DeleteAndSync/delete_monitor +[GIN] 2025/12/03 - 13:11:31 | 200 | 2.158179ms | | DELETE "/api/v1/uptime/mon-delete" + +2025/12/03 13:11:31 /projects/Charon/backend/internal/api/handlers/uptime_handler_test.go:202 record not found +[0.088ms] [rows:0] SELECT * FROM `uptime_monitors` WHERE id = "mon-delete" ORDER BY `uptime_monitors`.`id` LIMIT 1 +=== RUN TestUptimeHandler_DeleteAndSync/sync_creates_monitor_for_proxy_host + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/uptime_service.go:110 record not found +[0.164ms] [rows:0] SELECT * FROM `uptime_monitors` WHERE proxy_host_id = 1 ORDER BY `uptime_monitors`.`id` LIMIT 1 + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/uptime_service.go:284 record not found +[0.105ms] [rows:0] SELECT * FROM `uptime_hosts` WHERE host = "127.0.0.1" ORDER BY `uptime_hosts`.`id` LIMIT 1 +[GIN] 2025/12/03 - 13:11:31 | 200 | 1.618067ms | | POST "/api/v1/uptime/sync" +=== RUN TestUptimeHandler_DeleteAndSync/update_enabled_via_PUT +[GIN] 2025/12/03 - 13:11:31 | 200 | 544.972µs | | PUT "/api/v1/uptime/mon-enable" +--- PASS: TestUptimeHandler_DeleteAndSync (0.07s) + --- PASS: TestUptimeHandler_DeleteAndSync/delete_monitor (0.02s) + --- PASS: TestUptimeHandler_DeleteAndSync/sync_creates_monitor_for_proxy_host (0.02s) + --- PASS: TestUptimeHandler_DeleteAndSync/update_enabled_via_PUT (0.02s) +=== RUN TestUptimeHandler_Sync_Success +[GIN] 2025/12/03 - 13:11:31 | 200 | 215.661µs | | POST "/api/v1/uptime/sync" +--- PASS: TestUptimeHandler_Sync_Success (0.02s) +=== RUN TestUptimeHandler_Delete_Error + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/uptime_service.go:861 no such table: uptime_monitors +[0.061ms] [rows:0] SELECT * FROM `uptime_monitors` WHERE id = "nonexistent" ORDER BY `uptime_monitors`.`id` LIMIT 1 +[GIN] 2025/12/03 - 13:11:31 | 500 | 523.692µs | | DELETE "/api/v1/uptime/nonexistent" +--- PASS: TestUptimeHandler_Delete_Error (0.02s) +=== RUN TestUptimeHandler_List_Error + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/uptime_service.go:813 no such table: uptime_monitors +[0.038ms] [rows:0] SELECT * FROM `uptime_monitors` ORDER BY name ASC +[GIN] 2025/12/03 - 13:11:31 | 500 | 226.291µs | | GET "/api/v1/uptime" +--- PASS: TestUptimeHandler_List_Error (0.02s) +=== RUN TestUptimeHandler_GetHistory_Error + +2025/12/03 13:11:31 /projects/Charon/backend/internal/services/uptime_service.go:827 no such table: uptime_heartbeats +[0.129ms] [rows:0] SELECT * FROM `uptime_heartbeats` WHERE monitor_id = "monitor-1" ORDER BY created_at desc LIMIT 50 +[GIN] 2025/12/03 - 13:11:31 | 500 | 325.741µs | | GET "/api/v1/uptime/monitor-1/history" +--- PASS: TestUptimeHandler_GetHistory_Error (0.01s) +PASS +coverage: 74.1% of statements +ok github.com/Wikid82/charon/backend/internal/api/handlers 20.180s coverage: 74.1% of statements +=== RUN TestAuthMiddleware_MissingHeader +--- PASS: TestAuthMiddleware_MissingHeader (0.00s) +=== RUN TestRequireRole_Success +--- PASS: TestRequireRole_Success (0.00s) +=== RUN TestRequireRole_Forbidden +--- PASS: TestRequireRole_Forbidden (0.00s) +=== RUN TestAuthMiddleware_Cookie +--- PASS: TestAuthMiddleware_Cookie (0.84s) +=== RUN TestAuthMiddleware_ValidToken +--- PASS: TestAuthMiddleware_ValidToken (0.86s) +=== RUN TestAuthMiddleware_InvalidToken +--- PASS: TestAuthMiddleware_InvalidToken (0.01s) +=== RUN TestRequireRole_MissingRoleInContext +--- PASS: TestRequireRole_MissingRoleInContext (0.00s) +=== RUN TestRecoveryLogsStacktraceVerbose +--- PASS: TestRecoveryLogsStacktraceVerbose (0.00s) +=== RUN TestRecoveryLogsBriefWhenNotVerbose +--- PASS: TestRecoveryLogsBriefWhenNotVerbose (0.00s) +=== RUN TestRecoverySanitizesHeadersAndPath +--- PASS: TestRecoverySanitizesHeadersAndPath (0.00s) +=== RUN TestRequestIDAddsHeaderAndLogger +--- PASS: TestRequestIDAddsHeaderAndLogger (0.00s) +=== RUN TestRequestLoggerSanitizesPath +--- PASS: TestRequestLoggerSanitizesPath (0.00s) +=== RUN TestRequestLoggerIncludesRequestID +--- PASS: TestRequestLoggerIncludesRequestID (0.00s) +PASS +coverage: 86.4% of statements +ok github.com/Wikid82/charon/backend/internal/api/middleware 2.772s coverage: 86.4% of statements +=== RUN TestRegister +time="2025-12-03T13:11:12Z" level=info msg="Cleaning up invalid Let's Encrypt certificate associations..." +time="2025-12-03T13:11:12Z" level=info msg="Using Caddy data directory for certificates scan" caddy_data_dir=/data +--- PASS: TestRegister (0.08s) +=== RUN TestRegisterImportHandler +time="2025-12-03T13:11:12Z" level=info msg="CertificateService: scanning cert directory" certRoot=/data/certificates +time="2025-12-03T13:11:12Z" level=info msg="CertificateService: cert directory does not exist" certRoot=/data/certificates +time="2025-12-03T13:11:12Z" level=info msg="CertificateService: disk sync complete" count=0 +--- PASS: TestRegisterImportHandler (0.02s) +PASS +coverage: 86.7% of statements +ok github.com/Wikid82/charon/backend/internal/api/routes 1.151s coverage: 86.7% of statements +=== RUN TestIntegration_WAF_BlockAndMonitor +time="2025-12-03T13:11:12Z" level=info msg="Cleaning up invalid Let's Encrypt certificate associations..." +time="2025-12-03T13:11:12Z" level=info msg="Using Caddy data directory for certificates scan" caddy_data_dir=data/caddy/data +time="2025-12-03T13:11:12Z" level=warning msg="WAF blocked request" decision=block mode=block path=/api/v1/remote-servers query="test=