Skip to content

Commit

Permalink
DLP: Updates test cases of risk job samples with mock approach (#3413)
Browse files Browse the repository at this point in the history
* DLP: Updates test cases of risk job samples with mock approach
Samples included are
-dlp_categorical_stats
-dlp_k_anonymity
-dlp_k_map
-dlp_l_diversity
-dlp_numerical_stats

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
dinesh-crest and gcf-owl-bot[bot] authored Aug 21, 2023
1 parent eaa04d1 commit 5eb2504
Show file tree
Hide file tree
Showing 7 changed files with 1,053 additions and 117 deletions.
10 changes: 7 additions & 3 deletions dlp/categoricalRiskAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// description: Computes risk metrics of a column of data in a Google BigQuery table.
// usage: node categoricalRiskAnalysis.js my-project nhtsa_traffic_fatalities accident_2015 state_name my-topic my-subscription bigquery-public-data

function main(
async function main(
projectId,
tableProjectId,
datasetId,
Expand Down Expand Up @@ -150,12 +150,16 @@ function main(
});
}

categoricalRiskAnalysis();
await categoricalRiskAnalysis();
// [END dlp_categorical_stats]
}

main(...process.argv.slice(2));
// TODO(developer): Please uncomment below line before running sample
// main(...process.argv.slice(2));

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});

module.exports = main;
10 changes: 7 additions & 3 deletions dlp/kAnonymityAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// description: Computes the k-anonymity of a column set in a Google BigQuery table
// usage: node kAnonymityAnalysis.js my-project tableProjectId datasetId tableId topicId subscriptionId quasiIds

function main(
async function main(
projectId,
tableProjectId,
datasetId,
Expand Down Expand Up @@ -141,11 +141,13 @@ function main(
});
});
}
kAnonymityAnalysis();
await kAnonymityAnalysis();
// [END dlp_k_anonymity]
}

main(...process.argv.slice(2));
// TODO(developer): Please uncomment below line before running sample
// main(...process.argv.slice(2));

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
Expand All @@ -164,3 +166,5 @@ function transformCLI(quasiIds) {
: undefined;
return quasiIds;
}

module.exports = main;
10 changes: 7 additions & 3 deletions dlp/kMapEstimationAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// description: Computes the k-map risk estimation of a column set in a Google BigQuery table.
// usage: node kMapEstimationAnalysis.js my-project tableProjectId datasetId tableId topicId subscriptionId regionCode quasiIds

function main(
async function main(
projectId,
tableProjectId,
datasetId,
Expand Down Expand Up @@ -151,10 +151,12 @@ function main(
});
}

kMapEstimationAnalysis();
await kMapEstimationAnalysis();
// [END dlp_k_map]
}
main(...process.argv.slice(2));
// TODO(developer): Please uncomment below line before running sample
// main(...process.argv.slice(2));

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
Expand All @@ -178,3 +180,5 @@ function transformCLI(quasiIds, infoTypes) {

return quasiIds;
}

module.exports = main;
10 changes: 7 additions & 3 deletions dlp/lDiversityAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// description: Computes the l-diversity of a column set in a Google BigQuery table.
// usage: node lDiversityAnalysis.js my-project tableProjectId datasetId tableId topicId subscriptionId sensitiveAttribute quasiIds

function main(
async function main(
projectId,
tableProjectId,
datasetId,
Expand Down Expand Up @@ -156,11 +156,13 @@ function main(
});
}

lDiversityAnalysis();
await lDiversityAnalysis();
// [END dlp_l_diversity]
}

main(...process.argv.slice(2));
// TODO(developer): Please uncomment below line before running sample
// main(...process.argv.slice(2));

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
Expand All @@ -179,3 +181,5 @@ function transformCLI(quasiIds) {
: undefined;
return quasiIds;
}

module.exports = main;
10 changes: 7 additions & 3 deletions dlp/numericalRiskAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// description: Computes risk metrics of a column of numbers in a Google BigQuery table.
// usage: node numericalRiskAnalysis.js my-project tableProjectId datasetId tableId columnName topicId subscriptionId

function main(
async function main(
projectId,
tableProjectId,
datasetId,
Expand Down Expand Up @@ -151,12 +151,16 @@ function main(
});
}

numericalRiskAnalysis();
await numericalRiskAnalysis();
// [END dlp_numerical_stats]
}

main(...process.argv.slice(2));
// TODO(developer): Please uncomment below line before running sample
// main(...process.argv.slice(2));

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});

module.exports = main;
Loading

0 comments on commit 5eb2504

Please sign in to comment.