bson/testdata/versioned-api/test-commands-strict-mode.yml
2025-03-17 20:58:26 +01:00

47 lines
1.2 KiB
YAML

description: "Test commands: strict mode"
schemaVersion: "1.4"
runOnRequirements:
- minServerVersion: "4.9"
serverParameters:
enableTestCommands: true
# serverless gives a different error for unrecognized testVersion2 command
serverless: "forbid"
createEntities:
- client:
id: &client client
observeEvents:
- commandStartedEvent
serverApi:
version: "1"
strict: true
- database:
id: &database database
client: *client
databaseName: &databaseName versioned-api-tests
tests:
- description: "Running a command that is not part of the versioned API results in an error"
operations:
- name: runCommand
object: *database
arguments:
commandName: testVersion2
command:
testVersion2: 1
expectError:
isError: true
errorContains: "command testVersion2 is not in API Version 1"
errorCodeName: "APIStrictError"
expectEvents:
- client: *client
events:
- commandStartedEvent:
command:
testVersion2: 1
apiVersion: "1"
apiStrict: true
apiDeprecationErrors: { $$unsetOrMatches: false }