Skip to content

Commit

Permalink
Adding unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sarat Vemulapalli <[email protected]>
  • Loading branch information
saratvemulapalli committed Sep 24, 2024
1 parent de0a633 commit 7d18f48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.maxmind.geoip2.model.AbstractResponse;

import org.opensearch.common.network.InetAddresses;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.env.TestEnvironment;
import org.opensearch.ingest.Processor;
Expand Down Expand Up @@ -126,6 +127,12 @@ public void testAllowListNotSpecified() throws IOException {
}
}

public void testSettingsRegistration() {
final IngestGeoIpModulePlugin plugin = new IngestGeoIpModulePlugin();
final List<Setting<?>> settings = plugin.getSettings();
assertTrue(settings.contains(IngestGeoIpModulePlugin.PROCESSORS_ALLOWLIST_SETTING));
}

private void runAllowListTest(List<String> allowList) throws IOException {
Settings.Builder settingsBuilder = Settings.builder();
createDb(settingsBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.ingest.useragent;

import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.env.TestEnvironment;
import org.opensearch.ingest.Processor;
Expand Down Expand Up @@ -89,6 +90,12 @@ public void testAllowListNotSpecified() throws IOException {
}
}

public void testSettingsRegistration() {
final IngestUserAgentModulePlugin plugin = new IngestUserAgentModulePlugin();
final List<Setting<?>> settings = plugin.getSettings();
assertTrue(settings.contains(IngestUserAgentModulePlugin.PROCESSORS_ALLOWLIST_SETTING));
}

private void runAllowListTest(List<String> allowList) throws IOException {
final Settings settings = settingsBuilder.putList(IngestUserAgentModulePlugin.PROCESSORS_ALLOWLIST_SETTING.getKey(), allowList)
.build();
Expand Down

0 comments on commit 7d18f48

Please sign in to comment.