Skip to content

Commit 458fce7

Browse files
sophiatllEvergreen Agent
authored andcommitted
SERVER-82544 Support unsigned token in mongoq simulator and change NTDI dollar tenant jscore passthrough
1 parent 36ea872 commit 458fce7

15 files changed

+326
-434
lines changed

buildscripts/resmokeconfig/suites/change_streams_multitenant_passthrough.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ executor:
7878
globalThis.testingReplication = true;
7979
await import('jstests/libs/override_methods/set_read_and_write_concerns.js');
8080
await import('jstests/libs/override_methods/enable_causal_consistency_without_read_pref.js');
81-
await import('jstests/libs/override_methods/inject_dollar_tenant.js');
81+
await import('jstests/libs/override_methods/simulate_mongoq.js');
8282
hooks:
8383
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
8484
# on the secondaries, so we run the ValidateCollections hook after it to ensure we're

buildscripts/resmokeconfig/suites/multitenancy_with_atlas_proxy_jscore_passthrough.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ executor:
5656
tenantId: "636d957b2646ddfaf9b5e13f"
5757
hashTestNamesForMultitenancy: true
5858
useSecurityToken: true
59+
useResponsePrefixChecking: true
5960
hooks:
6061
- class: CheckReplOplogs
6162
- class: CheckReplDBHash

buildscripts/resmokeconfig/suites/multitenancy_with_mongoq_jscore_passthrough.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ selector:
88
- jstests/core/**/*.js
99
- jstests/aggregation/**/*.js
1010
exclude_with_any_tags:
11+
# This passthrough uses the `simulate_mongoq` override, which some tests are incompatible with.
12+
- simulate_mongoq_incompatible
1113
# Exclude tests which use commands that aren't supported in Serverless.
1214
- command_not_supported_in_serverless
1315
# Exclude tests which we know use commands that don't support a security token.
@@ -58,13 +60,13 @@ selector:
5860
# defaultPrompt() calls buildInfo command which is not allowed with security token.
5961
- jstests/core/txns/shell_prompt_in_transaction.js
6062
# Cannot test the user is not allowed to create indexes in config.transactions as the
61-
# inject_security_token.js runs command on tenant's config.transactions.
63+
# simulate_mongoq.js runs command on tenant's config.transactions.
6264
- jstests/core/**/create_indexes.js
6365
# checkLog calls getLog command which is not allowed with security token.
6466
- jstests/core/**/doc_validation_options.js
65-
# exhaust does not use runCommand (required by the inject_security_token.js override).
67+
# exhaust does not use runCommand (required by the simulate_mongoq.js override).
6668
- jstests/core/**/exhaust.js
67-
# This test does not use same connection on same database (required by the inject_security_token.js override).
69+
# This test does not use same connection on same database (required by the simulate_mongoq.js override).
6870
- jstests/core/txns/write_conflicts_with_non_txns.js
6971
# In a multitenancy environment the catalog will always return tenant-prefixed entries, and the
7072
# override we use in this suite checks for the absence of a prefix breaking the list_catalog tests.
@@ -74,7 +76,7 @@ selector:
7476
# Queryable encryption test performs implicit encryption which issues commands that don't
7577
# include the security token.
7678
- jstests/core/queryable_encryption/**/*.js
77-
# These following tests use benchRun which does not use runCommand (required by the inject_security_token.js override).
79+
# These following tests use benchRun which does not use runCommand (required by the simulate_mongoq.js override).
7880
- jstests/core/**/bench_test1.js
7981
- jstests/core/**/bench_test2.js
8082
- jstests/core/**/benchrun_cmd_param_error.js
@@ -95,9 +97,11 @@ executor:
9597
shell_options:
9698
eval: |
9799
globalThis.testingReplication = true;
98-
await import('jstests/libs/override_methods/inject_security_token.js');
100+
await import('jstests/libs/override_methods/simulate_mongoq.js');
99101
global_vars:
100102
TestData: &TestData
103+
tenantId: "636d957b2646ddfaf9b5e13a"
104+
useSignedSecurityToken: true
101105
hashTestNamesForMultitenancy: true
102106
testOnlyValidatedTenancyScopeKey: secret
103107
hooks:
@@ -111,7 +115,7 @@ executor:
111115
n: 20
112116
fixture:
113117
class: ReplicaSetFixture
114-
num_nodes: 3
118+
num_nodes: 2
115119
mongod_options:
116120
set_parameters:
117121
enableTestCommands: 1
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
config_variables:
2-
- &keyFile jstests/libs/authTestsKey
3-
- &keyFileData Thiskeyisonlyforrunningthesuitewithauthenticationdontuseitinanytestsdirectly
4-
- &authOptions
5-
authenticationDatabase: local
6-
authenticationMechanism: SCRAM-SHA-256
7-
password: *keyFileData
8-
username: __system
9-
101
test_kind: js_test
112
description: |
123
Run test suites with a replica set and multitenancy enabled. Simulate the mongoq behavior
13-
by overriding and injecting "$tenant".
4+
by overriding and injecting unsigned security token.
145
156
selector:
167
roots:
178
- jstests/core/**/*.js
189
exclude_with_any_tags:
10+
# This passthrough uses the `simulate_mongoq` override, which some tests are incompatible with.
11+
- simulate_mongoq_incompatible
1912
# Exclude tests which use commands that aren't supported in Serverless.
2013
- command_not_supported_in_serverless
2114
# Theses tests expect replication is not enabled.
@@ -25,21 +18,21 @@ selector:
2518
# Server side javascript (such as $where, $function, $accumulator and map-reduce) is not allowed in Serverless.
2619
- requires_scripting
2720
- uses_map_reduce_with_temp_collections
28-
# This test suite creates connection with user "__system", so cannot be authenticated again with different user.
21+
# Skip any tests that run with auth explicitly.
2922
- requires_auth
3023
# Sharding commands are not tenant aware.
3124
- requires_sharding
3225
# Columnstore indexes are under development and cannot be used without enabling the feature flag
3326
- featureFlagColumnstoreIndexes
3427
exclude_files:
35-
# The "exhaust" function does not use runCommand (required by the inject_security_token.js override).
28+
# The "exhaust" function does not use runCommand (required by the simulate_mongoq.js override).
3629
- jstests/core/**/exhaust.js
37-
# These following tests use benchRun which does not use runCommand (required by the inject_dollar_tenant.js override).
30+
# These following tests use benchRun which does not use runCommand (required by the simulate_mongoq.js override).
3831
- jstests/core/**/bench_test1.js
3932
- jstests/core/**/bench_test2.js
4033
- jstests/core/**/benchrun_cmd_param_error.js
4134
- jstests/core/**/benchrun_pipeline_updates.js
42-
# These tests run "applyOps" command which does not depend on $tenant to pass in tenant information.
35+
# These tests run "applyOps" command which does not depend on unsigned security token pass in tenant information.
4336
# The tenantId is provided in the oplog entries provided to the applyOps command.
4437
- jstests/core/**/apply_ops*.js
4538
- jstests/core/**/bypass_doc_validation.js
@@ -58,8 +51,6 @@ selector:
5851
- jstests/core/views/view_with_invalid_dbname.js
5952
- jstests/core/views/views_all_commands.js
6053
- jstests/core/views/invalid_view_prevents_creating_new_view.js
61-
# This test expects a specific error message, which does not match the error message generated in authentication mode.
62-
- jstests/core/**/commands_with_uuid.js
6354
# Sharding command "splictVector" is not tenant aware.
6455
- jstests/core/**/splitvector.js
6556
# Sharding command "_shardsvrCreateGlobalIndex" is not tenant aware.
@@ -75,7 +66,7 @@ selector:
7566
# In a multitenancy environment the catalog will always return tenant-prefixed entries, so the
7667
# list_catalog test will be broken as it checks for non-tenant-prefixed entries.
7768
- jstests/core/**/list_catalog.js
78-
# These tests create a new thread, so $tenant won't be properly injected.
69+
# These tests create a new thread, so unsigned security token won't be properly injected.
7970
- jstests/core/txns/transactions_block_ddl.js
8071
- jstests/core/txns/write_conflicts_with_non_txns.js
8172
- jstests/core/txns/kill_op_on_txn_expiry.js
@@ -85,8 +76,14 @@ selector:
8576
# the requests causes the test to fails due to a mismatch.
8677
- jstests/core/api//apitest_db_profile_level.js
8778
# Queryable encryption test requires an internal connection for the keyvault that does not
88-
# inject a $tenant.
79+
# inject a security token.
8980
- jstests/core/queryable_encryption/**/*.js
81+
# TODO SERVER-82748: make "configureFailPoint" support unsigned security token.
82+
- jstests/core/administrative/profile/profile_hide_index.js
83+
- jstests/core/failcommand_failpoint.js
84+
- jstests/core/comment_field.js
85+
# TODO SERVER-81009: fix VTS missing from opCtx for distinct transactions.
86+
- jstests/core/txns/view_reads_in_transaction.js
9087

9188
executor:
9289
archive:
@@ -97,48 +94,26 @@ executor:
9794
- ValidateCollections
9895
config:
9996
shell_options:
100-
# In order to use $tenant, connect mongod with user "_system" which can be authenticated with ActionType::useTenant.
101-
<<: *authOptions
10297
eval: |
103-
jsTest.authenticate(db.getMongo());
10498
globalThis.testingReplication = true;
105-
await import('jstests/libs/override_methods/inject_dollar_tenant.js');
99+
await import('jstests/libs/override_methods/simulate_mongoq.js');
106100
global_vars:
107101
TestData: &TestData
108102
tenantId: "636d957b2646ddfaf9b5e13f"
103+
useSignedSecurityToken: false
109104
hashTestNamesForMultitenancy: true
110-
auth: true
111-
authMechanism: SCRAM-SHA-256
112-
keyFile: *keyFile
113-
keyFileData: *keyFileData
114-
roleGraphInvalidationIsFatal: true
115105
hooks:
116106
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
117107
# on the secondaries, so we run the ValidateCollections hook after it to ensure we're
118108
# validating the entire contents of the collection.
119109
- class: CheckReplOplogs
120-
shell_options:
121-
global_vars:
122-
TestData: *TestData
123-
eval: jsTest.authenticate(db.getMongo())
124-
<<: *authOptions
125110
- class: CheckReplDBHash
126-
shell_options:
127-
global_vars:
128-
TestData: *TestData
129-
eval: jsTest.authenticate(db.getMongo())
130-
<<: *authOptions
131111
- class: ValidateCollections
132-
shell_options:
133-
global_vars:
134-
TestData: *TestData
135-
eval: jsTest.authenticate(db.getMongo())
136-
<<: *authOptions
137112
- class: CleanEveryN
138113
n: 20
139114
fixture:
140115
class: ReplicaSetFixture
141-
num_nodes: 3
116+
num_nodes: 2
142117
mongod_options:
143118
set_parameters:
144119
enableTestCommands: 1
@@ -147,7 +122,4 @@ executor:
147122
featureFlagRequireTenantID: true
148123
logComponentVerbosity:
149124
command: 2
150-
auth: ''
151-
keyFile: *keyFile
152125
noscripting: ''
153-
auth_options: *authOptions

etc/evergreen_yml_components/definitions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6851,7 +6851,7 @@ tasks:
68516851
use_large_distro: "true"
68526852

68536853
- <<: *gen_task_template
6854-
name: native_tenant_data_isolation_with_dollar_tenant_jscore_passthrough_gen
6854+
name: multitenancy_with_mongoq_unsigned_token_jscore_passthrough_gen
68556855
tags: ["serverless"]
68566856
commands:
68576857
- func: "generate resmoke tasks"

jstests/aggregation/explain_per_stage_exec_stats.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
* @tags: [
77
* # The response to `$changeStream` will contain a db name different from the one requested.
88
* # This expected behavior is incompatible with the prefix matching check between the request
9-
* # and reply used by ‘simluate_atlas_proxy’.
9+
* # and reply used by simulate_atlas_proxy and simulate_mongoq overrides.
1010
* simulate_atlas_proxy_incompatible,
11+
* simulate_mongoq_incompatible,
1112
* ]
1213
*/
1314

jstests/core/administrative/builtin_roles_external.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/**
22
* Attempting to enumerate roles on the $external database should return an empty set.
3-
* @tags: [requires_fcv_60,tenant_migration_incompatible]
3+
* @tags: [
4+
* requires_fcv_60,
5+
* tenant_migration_incompatible,
6+
* # `rolesInfo` response has empty database name that doesn't work with the response checker of
7+
* # simulate_mongoq override.
8+
* simulate_mongoq_incompatible,
9+
* ]
410
*/
511
function assertBuiltinRoles(dbname, shouldHaveRoles) {
612
const allRoles = assert

jstests/core/index/geo/geo_big_polygon3.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
// requires_non_retryable_writes,
2020
// # This test has statements that do not support non-local read concern.
2121
// does_not_support_causal_consistency,
22+
// # Uses mapReduce.
23+
// requires_scripting,
2224
// ]
2325

2426
import {FixtureHelpers} from "jstests/libs/fixture_helpers.js";

jstests/core/roles_info.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// not_allowed_with_security_token,
66
// requires_multi_updates,
77
// requires_non_retryable_commands,
8+
// # `rolesInfo` response has empty database name that doesn't work with the response checker of
9+
// # simulate_mongoq override.
10+
// simulate_mongoq_incompatible,
811
// ]
912

1013
// Setup some sample roles.

jstests/libs/override_methods/inject_dollar_tenant.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)