From bf725ced633a07646e484d2723cc7618f0735291 Mon Sep 17 00:00:00 2001 From: Sijie Date: Tue, 16 Jan 2024 15:23:46 -0800 Subject: [PATCH] add updateIndex logic --- .../lib/storage/mongo/MongoStorageStartUpTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java b/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java index 719f7491..9f8a8da2 100644 --- a/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java +++ b/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java @@ -169,9 +169,10 @@ public void indexesConfig() { @Test public void indexesConfigApp() { final Set indexes = new HashSet<>(); - db.getCollection("config_app").listIndexes().forEach((Consumer) indexes::add); +// db.getCollection("config_app").listIndexes().forEach((Consumer) indexes::add); // indexes.forEach(doc -> doc.remove("ns")); // indexes.forEach(this::updateInt2Long); + updateIndexes("config_app", indexes); display(indexes); final Set expected = set( // new Document("v", indexVer) @@ -418,6 +419,13 @@ public void indexesTestUsers() { ))); } + public void updateIndexes(final String name, final Set indexes) { + for (Document index: db.getCollection(name).listIndexes()) { + index.remove("ns"); + indexes.add(index); + } + } + public void updateInt2Long(final Document doc) { for (Map.Entry entry : doc.entrySet()) { String key = entry.getKey();