...

Text file src/go.mongodb.org/mongo-driver/testdata/versioned-api/test-commands-strict-mode.yml

Documentation: go.mongodb.org/mongo-driver/testdata/versioned-api

     1description: "Test commands: strict mode"
     2
     3schemaVersion: "1.4"
     4
     5runOnRequirements:
     6  - minServerVersion: "4.9"
     7    serverParameters:
     8      enableTestCommands: true
     9    # serverless gives a different error for unrecognized testVersion2 command
    10    serverless: "forbid"
    11
    12createEntities:
    13  - client:
    14      id: &client client
    15      observeEvents:
    16        - commandStartedEvent
    17      serverApi:
    18        version: "1"
    19        strict: true
    20  - database:
    21      id: &database database
    22      client: *client
    23      databaseName: &databaseName versioned-api-tests
    24
    25tests:
    26  - description: "Running a command that is not part of the versioned API results in an error"
    27    operations:
    28      - name: runCommand
    29        object: *database
    30        arguments:
    31          commandName: testVersion2
    32          command:
    33            testVersion2: 1
    34        expectError:
    35          isError: true
    36          errorContains: "command testVersion2 is not in API Version 1"
    37          errorCodeName: "APIStrictError"
    38    expectEvents:
    39      - client: *client
    40        events:
    41          - commandStartedEvent:
    42              command:
    43                testVersion2: 1
    44                apiVersion: "1"
    45                apiStrict: true
    46                apiDeprecationErrors: { $$unsetOrMatches: false }

View as plain text