Skip to content

[api] Move test_server to agdb_api and add it to typedef #1780#1792

Merged
michaelvlach merged 9 commits intomainfrom
1780-api-define-tests-to-be-part-of-the-api-type_def
May 1, 2026
Merged

[api] Move test_server to agdb_api and add it to typedef #1780#1792
michaelvlach merged 9 commits intomainfrom
1780-api-define-tests-to-be-part-of-the-api-type_def

Conversation

@michaelvlach
Copy link
Copy Markdown
Collaborator

No description provided.

@michaelvlach michaelvlach requested review from agnesoft and Copilot May 1, 2026 18:37
@michaelvlach michaelvlach linked an issue May 1, 2026 that may be closed by this pull request
@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agdb Ready Ready Preview, Comment May 1, 2026 7:04pm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the test_server test harness and shared server configuration types into agdb_api so agdb_server integration tests can reuse them and so the types can participate in agdb’s type-definition reflection.

Changes:

  • Refactors agdb_server integration tests to use agdb_api::test_server::* utilities instead of local test helpers.
  • Centralizes server configuration constants/struct (ConfigImpl, limits, SALT_LEN) under agdb_api::config_impl and updates server code to consume it.
  • Extends agdb type-definition coverage (e.g., Arc<T>, arrays, PathBuf) and updates the derive parser to treat bail! as a call-like macro.

Reviewed changes

Copilot reviewed 57 out of 57 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
agdb_server/tests/tls/mod.rs Switches TLS tests to use agdb_api’s moved test_server + config_impl APIs.
agdb_server/tests/tests.rs Adds integration test crate root that includes routes and optional tls modules.
agdb_server/tests/routes/user_status.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/user_logout_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/user_login_test.rs Updates imports and reqwest_client() usage to agdb_api::test_server.
agdb_server/tests/routes/user_change_password_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/misc_routes.rs Updates imports and config construction to use agdb_api::{test_server, config_impl}.
agdb_server/tests/routes/db_user_remove_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_user_list.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_user_add_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_rename_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_remove_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_optimize_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_list_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_exec_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_delete_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_copy_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_convert_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_clear_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_backup_restore_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_audit_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/db_add_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/cluster_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_user_logout_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_user_logout_all.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_user_list_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_user_delete_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_user_change_password_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_user_add_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_status_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_set_log_level_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_user_remove_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_user_list_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_user_add_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_rename_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_remove_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_optimize_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_list_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_exec_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_delete_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_copy_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_convert_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_clear_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_backup_restore_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_audit_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/tests/routes/admin_db_add_test.rs Updates imports to use agdb_api::test_server helpers.
agdb_server/src/password.rs Uses shared SALT_LEN from agdb_api::config_impl.
agdb_server/src/config.rs Replaces local ConfigImpl/constants and config serialization with agdb_api::config_impl.
agdb_server/Cargo.toml Adds agdb_api dev-dependency with test_server feature for integration tests.
agdb_derive/src/type_def_parser/expression_parser.rs Treats bail! as a call-like macro during type-def parsing.
agdb_api/rust/src/test_server/test_error.rs Introduces TestError + local bail! macro for test_server errors.
agdb_api/rust/src/test_server.rs Adds/migrates test_server harness into agdb_api, plus type-def hooks.
agdb_api/rust/src/lib.rs Exposes test_server module behind test_server feature; re-exports config_impl.
agdb_api/rust/src/api_types/config_impl.rs Adds shared ConfigImpl + defaults + config string serializer.
agdb_api/rust/src/api_types.rs Exposes the new config_impl API types module.
agdb_api/rust/Cargo.toml Adds test_server feature and optional tokio dependency.
agdb/src/type_def.rs Adds type-definition impls for Arc<T>, arrays, and PathBuf.
Comments suppressed due to low confidence (4)

agdb_api/rust/src/test_server.rs:125

  • The #[agdb::impl_def]-annotated impl blocks in this module won't be surfaced via TypeDefinition::impl_defs() unless the corresponding structs are annotated with #[type_def(...)] (e.g. #[type_def(inherent)], #[type_def(inherent, Drop)]). As-is, the generated __*_impl_def helper fns will be unused (potential dead_code warnings) and the impl signatures won't appear in reflection.
    agdb_api/rust/src/test_server.rs:431
  • The timeout message uses {TEST_TIMEOUT}seconds, but TEST_TIMEOUT is compared against now.elapsed().as_millis() (so it is milliseconds). This message should either convert to seconds (TEST_TIMEOUT / 1000) or change the wording to milliseconds, and also add a space before the unit for readability.
    agdb_api/rust/src/test_server.rs:13
  • This module unconditionally imports agdb::type_def::{Struct, TypeDefinition}, but agdb::type_def only exists with the agdb/api feature. If agdb_api is built with test_server but without api, this will fail to compile. Consider gating these imports and the related TypeDefinition impls behind cfg(feature = "api"), or make test_server imply api.
    agdb_api/rust/src/test_server.rs:89
  • TestServer, TestServerImpl, and TestCluster derive agdb::TypeDef unconditionally. The TypeDef derive is only re-exported by agdb when the agdb/api feature is enabled, so this will not compile for consumers enabling only agdb_api's test_server feature. Gate these derives with cfg_attr(feature = "api", derive(...)) (or make test_server depend on api).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agdb/src/type_def.rs Outdated
Comment thread agdb_api/rust/Cargo.toml
Comment thread agdb_api/rust/src/test_server/test_error.rs Outdated
@michaelvlach michaelvlach merged commit 9f0af99 into main May 1, 2026
11 checks passed
@michaelvlach michaelvlach deleted the 1780-api-define-tests-to-be-part-of-the-api-type_def branch May 1, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[api] Move test_server to agdb_api and add it to typedef

3 participants