184 lines
8.8 KiB
Gherkin
184 lines
8.8 KiB
Gherkin
@phase2 @a2a @server-stubs
|
|
Feature: Server Client Stubs and Connection Config
|
|
As a developer
|
|
I want protocol stubs for server communication
|
|
So that the server client interfaces are defined before implementation
|
|
|
|
# -----------------------------------------------------------------------
|
|
# ServerConnectionConfig validation
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: ServerConnectionConfig accepts valid HTTPS URL
|
|
When I create a ServerConnectionConfig with url "https://agents.example.com"
|
|
Then the config server_url should be "https://agents.example.com"
|
|
And the config namespace should be "default"
|
|
And the config tls_verify should be true
|
|
|
|
Scenario: ServerConnectionConfig accepts valid HTTP URL
|
|
When I create a ServerConnectionConfig with url "http://localhost:8080"
|
|
Then the config server_url should be "http://localhost:8080"
|
|
|
|
Scenario: ServerConnectionConfig accepts custom namespace
|
|
When I create a ServerConnectionConfig with url "https://agents.example.com" and namespace "my-team"
|
|
Then the config namespace should be "my-team"
|
|
|
|
Scenario: ServerConnectionConfig accepts auth_token_ref
|
|
When I create a ServerConnectionConfig with url "https://agents.example.com" and auth_token_ref "CLEVERAGENTS_SERVER_TOKEN"
|
|
Then the config auth_token_ref should be "CLEVERAGENTS_SERVER_TOKEN"
|
|
|
|
Scenario: ServerConnectionConfig rejects empty URL
|
|
When I try to create a ServerConnectionConfig with empty url
|
|
Then a server config validation error should be raised
|
|
|
|
Scenario: ServerConnectionConfig rejects non-HTTP URL
|
|
When I try to create a ServerConnectionConfig with url "ftp://agents.example.com"
|
|
Then a server config validation error should be raised
|
|
|
|
Scenario: ServerConnectionConfig rejects whitespace-only URL
|
|
When I try to create a ServerConnectionConfig with url " "
|
|
Then a server config validation error should be raised
|
|
|
|
Scenario: ServerConnectionConfig rejects empty namespace
|
|
When I try to create a ServerConnectionConfig with url "https://ok.com" and empty namespace
|
|
Then a server config validation error should be raised
|
|
|
|
Scenario: ServerConnectionConfig is frozen
|
|
When I create a ServerConnectionConfig with url "https://agents.example.com"
|
|
Then the config should be immutable
|
|
|
|
Scenario: ServerConnectionConfig tls_verify defaults to true
|
|
When I create a ServerConnectionConfig with url "https://agents.example.com"
|
|
Then the config tls_verify should be true
|
|
|
|
Scenario: ServerConnectionConfig with tls_verify false
|
|
When I create a ServerConnectionConfig with url "http://localhost:8080" and tls_verify false
|
|
Then the config tls_verify should be false
|
|
|
|
# -----------------------------------------------------------------------
|
|
# StubServerClient — all methods raise NotImplementedError
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: StubServerClient health_check raises NotImplementedError
|
|
Given a new StubServerClient
|
|
When I call health_check on the stub server client
|
|
Then a NotImplementedError should be raised with message containing "not yet implemented"
|
|
|
|
Scenario: StubServerClient get_version raises NotImplementedError
|
|
Given a new StubServerClient
|
|
When I call get_version on the stub server client
|
|
Then a NotImplementedError should be raised with message containing "not yet implemented"
|
|
|
|
# -----------------------------------------------------------------------
|
|
# StubRemoteExecutionClient — all methods raise NotImplementedError
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: StubRemoteExecutionClient execute_plan raises NotImplementedError
|
|
Given a new StubRemoteExecutionClient
|
|
When I call execute_plan with plan_id "PLAN001" on the stub execution client
|
|
Then a NotImplementedError should be raised with message containing "not yet implemented"
|
|
|
|
Scenario: StubRemoteExecutionClient get_plan_status raises NotImplementedError
|
|
Given a new StubRemoteExecutionClient
|
|
When I call get_plan_status with plan_id "PLAN001" on the stub execution client
|
|
Then a NotImplementedError should be raised with message containing "not yet implemented"
|
|
|
|
Scenario: StubRemoteExecutionClient cancel_plan raises NotImplementedError
|
|
Given a new StubRemoteExecutionClient
|
|
When I call cancel_plan with plan_id "PLAN001" on the stub execution client
|
|
Then a NotImplementedError should be raised with message containing "not yet implemented"
|
|
|
|
Scenario: StubRemoteExecutionClient rejects empty plan_id
|
|
Given a new StubRemoteExecutionClient
|
|
When I call execute_plan with empty plan_id on the stub execution client
|
|
Then a ValueError should be raised for empty plan_id
|
|
|
|
# -----------------------------------------------------------------------
|
|
# StubAuthClient — all methods raise NotImplementedError
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: StubAuthClient authenticate raises NotImplementedError
|
|
Given a new StubAuthClient
|
|
When I call authenticate with token "tok_test" on the stub auth client
|
|
Then a NotImplementedError should be raised with message containing "not yet implemented"
|
|
|
|
Scenario: StubAuthClient validate_token raises NotImplementedError
|
|
Given a new StubAuthClient
|
|
When I call validate_token with token "tok_test" on the stub auth client
|
|
Then a NotImplementedError should be raised with message containing "not yet implemented"
|
|
|
|
Scenario: StubAuthClient rejects empty token
|
|
Given a new StubAuthClient
|
|
When I call authenticate with empty token on the stub auth client
|
|
Then a ValueError should be raised for empty token
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Protocol conformance
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: StubServerClient conforms to ServerClient protocol
|
|
Then StubServerClient should be a runtime instance of ServerClient
|
|
|
|
Scenario: StubRemoteExecutionClient conforms to RemoteExecutionClient protocol
|
|
Then StubRemoteExecutionClient should be a runtime instance of RemoteExecutionClient
|
|
|
|
Scenario: StubAuthClient conforms to AuthClient protocol
|
|
Then StubAuthClient should be a runtime instance of AuthClient
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Config keys registration
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: server.url config key is registered
|
|
Then config key "server.url" should be registered
|
|
|
|
Scenario: server.token config key is registered
|
|
Then config key "server.token" should be registered
|
|
|
|
Scenario: server.tls-verify config key is registered
|
|
Then config key "server.tls-verify" should be registered
|
|
|
|
Scenario: server.namespace config key is registered
|
|
Then config key "server.namespace" should be registered
|
|
|
|
Scenario: server.tls-verify defaults to true
|
|
Then config key "server.tls-verify" should have default true
|
|
|
|
Scenario: server.namespace defaults to "default"
|
|
Then config key "server.namespace" should have default "default"
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Config keys load from environment
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: server.url loads from CLEVERAGENTS_SERVER_URL environment
|
|
Then config key "server.url" should use env var "CLEVERAGENTS_SERVER_URL"
|
|
|
|
Scenario: server.tls-verify loads from CLEVERAGENTS_SERVER_TLS_VERIFY environment
|
|
Then config key "server.tls-verify" should use env var "CLEVERAGENTS_SERVER_TLS_VERIFY"
|
|
|
|
Scenario: server.namespace loads from CLEVERAGENTS_SERVER_NAMESPACE environment
|
|
Then config key "server.namespace" should use env var "CLEVERAGENTS_SERVER_NAMESPACE"
|
|
|
|
# -----------------------------------------------------------------------
|
|
# CLI connect command
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: CLI server connect prints stub warning
|
|
Given a temporary home directory for server tests
|
|
When I invoke server connect with url "https://stub.example.com" and format "json"
|
|
Then the server connect output should contain "not yet implemented"
|
|
And the server connect output should contain "stubbed"
|
|
|
|
Scenario: CLI server connect rejects invalid URL
|
|
Given a temporary home directory for server tests
|
|
When I invoke server connect with url "ftp://bad-url" and format "json"
|
|
Then the server connect should exit with non-zero code
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Server mode resolution
|
|
# -----------------------------------------------------------------------
|
|
|
|
Scenario: resolve_server_mode returns disabled when no URL configured
|
|
Given no server URL is configured
|
|
Then resolve_server_mode should return "disabled"
|