Extend commands_lib framework to allow testing for non-auth failures

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Do
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Security
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When trying to implement tests for SERVER-123564, I was running into an issue with the auth test framework in jstests/auth/lib/commands_lib.js.

      I was trying to add test cases for some commands, with these test cases expecting non-auth return codes when running the commands. I was using expectFail for this ref , setting expectFail to true.

      However, when running a command that was supposed to fail with a FailedToParse error that happened during/after authorization, the newly added test cases failed with

      [js_test:commands_builtin_roles_replset] [jsTest] applyOps_truncateRange: expected authorization failure but received   result {
      [js_test:commands_builtin_roles_replset] [jsTest]   "ok" : 0,
      [js_test:commands_builtin_roles_replset] [jsTest]   "errmsg" : "Unrecognized command in op",
      [js_test:commands_builtin_roles_replset] [jsTest]   "code" : 9,
      [js_test:commands_builtin_roles_replset] [jsTest]   "codeName" : "FailedToParse",
      ... 

      The problem is that I was expecting a FailedToParse error and not an authorization failure here. I wasn't able to get this to work using the framework, so ultimately I wrote standalone tests for my use case.

      But it would be good if the framework made it easy to cover such test cases too, without having to reimplement the wheel in separate tests.

            Assignee:
            Unassigned
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: