summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2023-05-03 13:36:39 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-03 14:38:45 +0000
commit8e79f414b58d1ca97027312cd721dfecb636ce69 (patch)
tree0ab65b51b07a51277a1a3a58ca1c943f564ff030 /jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js
parent280c055694d28c5eb8a88f9f676a92c67dc2f72f (diff)
downloadmongo-8e79f414b58d1ca97027312cd721dfecb636ce69.tar.gz
SERVER-76424 Replace 'redact' with 'hmac' in $telemetry syntax
Diffstat (limited to 'jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js')
-rw-r--r--jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js41
1 files changed, 21 insertions, 20 deletions
diff --git a/jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js b/jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js
index 013f9e6380d..c4f785abf6a 100644
--- a/jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js
+++ b/jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js
@@ -1,5 +1,5 @@
/**
- * Test the $telemetry redaction properties.
+ * Test the $telemetry hmac properties.
* @tags: [featureFlagTelemetry]
*/
@@ -9,11 +9,11 @@ load("jstests/libs/telemetry_utils.js");
(function() {
"use strict";
-// Assert the expected telemetry key with no redaction.
-function assertUnredactedTelemetryKey(telemetryKey) {
- assert.eq(telemetryKey.queryShape.filter, {"foo": {"$lte": "?number"}});
- assert.eq(telemetryKey.queryShape.sort, {"bar": -1});
- assert.eq(telemetryKey.queryShape.limit, "?number");
+// Assert the expected telemetry key with no hmac.
+function assertTelemetryKeyWithoutHmac(telemetryKey) {
+ assert.eq(telemetryKey.filter, {"foo": {"$lte": "?number"}});
+ assert.eq(telemetryKey.sort, {"bar": -1});
+ assert.eq(telemetryKey.limit, "?number");
}
function runTest(conn) {
@@ -23,22 +23,23 @@ function runTest(conn) {
coll.insert({foo: 1});
coll.find({foo: {$lte: 2}}).sort({bar: -1}).limit(2).toArray();
- // Default is no redaction.
- assertUnredactedTelemetryKey(getTelemetry(conn)[0].key);
+ // Default is no hmac.
+ assertTelemetryKeyWithoutHmac(getTelemetry(conn)[0].key.queryShape);
- // Turning on redaction should redact field names on all entries, even previously cached ones.
+ // Turning on hmac should apply hmac to all field names on all entries, even previously cached
+ // ones.
const telemetryKey = getTelemetryRedacted(conn)[0]["key"];
assert.eq(telemetryKey.queryShape.filter,
{"fNWkKfogMv6MJ77LpBcuPrO7Nq+R+7TqtD+Lgu3Umc4=": {"$lte": "?number"}});
assert.eq(telemetryKey.queryShape.sort, {"CDDQIXZmDehLKmQcRxtdOQjMqoNqfI2nGt2r4CgJ52o=": -1});
assert.eq(telemetryKey.queryShape.limit, "?number");
- // Turning redaction back off should preserve field names on all entries, even previously cached
+ // Turning hmac back off should preserve field names on all entries, even previously cached
// ones.
- assertUnredactedTelemetryKey(getTelemetry(conn)[0]["key"]);
+ assertTelemetryKeyWithoutHmac(getTelemetry(conn)[0]["key"].queryShape);
- // Explicitly set redactIdentifiers to false.
- assertUnredactedTelemetryKey(getTelemetryRedacted(conn, false)[0]["key"]);
+ // Explicitly set applyHmacToIdentifiers to false.
+ assertTelemetryKeyWithoutHmac(getTelemetryRedacted(conn, false)[0]["key"].queryShape);
// Wrong parameter name throws error.
let pipeline = [{$telemetry: {redactFields: true}}];
@@ -46,30 +47,30 @@ function runTest(conn) {
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry parameters object may only contain 'redactIdentifiers' or 'redactionKey' options. Found: redactFields");
+ "$telemetry parameters object may only contain 'applyHmacToIdentifiers' or 'hmacKey' options. Found: redactFields");
// Wrong parameter type throws error.
- pipeline = [{$telemetry: {redactIdentifiers: 1}}];
+ pipeline = [{$telemetry: {applyHmacToIdentifiers: 1}}];
assertAdminDBErrCodeAndErrMsgContains(
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry redactIdentifiers parameter must be boolean. Found type: double");
+ "$telemetry applyHmacToIdentifiers parameter must be boolean. Found type: double");
- pipeline = [{$telemetry: {redactionKey: 1}}];
+ pipeline = [{$telemetry: {hmacKey: 1}}];
assertAdminDBErrCodeAndErrMsgContains(
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry redactionKey parameter must be bindata of length 32 or greater. Found type: double");
+ "$telemetry hmacKey parameter must be bindata of length 32 or greater. Found type: double");
// Parameter object with unrecognized key throws error.
- pipeline = [{$telemetry: {redactIdentifiers: true, redactionStrategy: "on"}}];
+ pipeline = [{$telemetry: {applyHmacToIdentifiers: true, hmacStrategy: "on"}}];
assertAdminDBErrCodeAndErrMsgContains(
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry parameters object may only contain 'redactIdentifiers' or 'redactionKey' options. Found: redactionStrategy");
+ "$telemetry parameters object may only contain 'applyHmacToIdentifiers' or 'hmacKey' options. Found: hmacStrategy");
}
const conn = MongoRunner.runMongod({