aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject [1/8] aurora git commit: Use a simpler command line argument system
Date Wed, 11 Oct 2017 00:29:10 GMT
Repository: aurora
Updated Branches:
  refs/heads/master cb8e956f1 -> 519e3df73


http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/config/CommandLineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/config/CommandLineTest.java b/src/test/java/org/apache/aurora/scheduler/config/CommandLineTest.java
new file mode 100644
index 0000000..9b4f2ad
--- /dev/null
+++ b/src/test/java/org/apache/aurora/scheduler/config/CommandLineTest.java
@@ -0,0 +1,479 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.aurora.scheduler.config;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.InetSocketAddress;
+import java.util.List;
+import java.util.Map;
+
+import javax.security.auth.kerberos.KerberosPrincipal;
+
+import com.beust.jcommander.Parameter;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+import org.apache.aurora.common.quantity.Data;
+import org.apache.aurora.common.quantity.Time;
+import org.apache.aurora.gen.Container;
+import org.apache.aurora.gen.DockerParameter;
+import org.apache.aurora.gen.Mode;
+import org.apache.aurora.gen.Volume;
+import org.apache.aurora.scheduler.app.MoreModules;
+import org.apache.aurora.scheduler.app.SchedulerMain.Options.DriverKind;
+import org.apache.aurora.scheduler.config.types.DataAmount;
+import org.apache.aurora.scheduler.config.types.TimeAmount;
+import org.apache.aurora.scheduler.http.api.security.HttpSecurityModule.Options.HttpAuthenticationMechanism;
+import org.apache.aurora.scheduler.http.api.security.ShiroIniConverterTest;
+import org.apache.aurora.scheduler.offers.OfferOrder;
+import org.apache.aurora.scheduler.sla.MetricCalculator.MetricCategory;
+import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
+import org.apache.shiro.config.Ini;
+import org.apache.shiro.config.Ini.Section;
+import org.apache.shiro.web.filter.authc.AnonymousFilter;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.apache.aurora.scheduler.http.api.security.ShiroIniConverterTest.EXAMPLE_RESOURCE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class CommandLineTest {
+  @Before
+  public void setUp() {
+    CommandLine.initializeForTest();
+  }
+
+  @Test
+  public void testCustomOptions() {
+    CommandLine.clearForTest();
+
+    // Ensures that a custom module can register command line arguments.
+
+    CliOptions options = CommandLine.parseOptions(
+        "-task_assigner_modules=org.apache.aurora.scheduler.config.CustomModule",
+        "-cluster_name=test",
+        "-mesos_master_address=localhost:8080",
+        "-backup_dir=/dev/null",
+        "-serverset_path=/tmp",
+        "-zk_endpoints=localhost:2181",
+        "-custom_flag=customValue");
+
+    Injector injector = Guice.createInjector(
+        MoreModules.instantiateAll(options.state.taskAssignerModules, options));
+
+    assertEquals("customValue", injector.getInstance(CustomModule.BINDING_KEY));
+  }
+
+  public static class NoopModule extends AbstractModule {
+    @Override
+    protected void configure() {
+      // No-op.
+    }
+  }
+
+  private static final TimeAmount TEST_TIME = new TimeAmount(42, Time.DAYS);
+  private static final DataAmount TEST_DATA = new DataAmount(42, Data.GB);
+
+  @Test
+  public void testParseAllOptions() {
+    File tempFile;
+    try {
+      tempFile = File.createTempFile(getClass().getCanonicalName(), null);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+    tempFile.deleteOnExit();
+
+    CliOptions expected = new CliOptions();
+    expected.reconciliation.transientTaskStateTimeout = TEST_TIME;
+    expected.reconciliation.initialTaskKillRetryInterval = TEST_TIME;
+    expected.reconciliation.reconciliationInitialDelay = TEST_TIME;
+    expected.reconciliation.reconciliationExplicitInterval = TEST_TIME;
+    expected.reconciliation.reconciliationImplicitInterval = TEST_TIME;
+    expected.reconciliation.reconciliationScheduleSpread = TEST_TIME;
+    expected.reconciliation.reconciliationBatchSize = 42;
+    expected.reconciliation.reconciliationBatchInterval = TEST_TIME;
+    expected.offer.minOfferHoldTime = TEST_TIME;
+    expected.offer.offerHoldJitterWindow = TEST_TIME;
+    expected.offer.offerFilterDuration = TEST_TIME;
+    expected.offer.unavailabilityThreshold = TEST_TIME;
+    expected.offer.offerOrder = ImmutableList.of(OfferOrder.CPU, OfferOrder.DISK);
+    expected.offer.offerOrderModules = ImmutableList.of(NoopModule.class);
+    expected.executor.customExecutorConfig = tempFile;
+    expected.executor.thermosExecutorPath = "testing";
+    expected.executor.thermosExecutorResources = ImmutableList.of("testing");
+    expected.executor.thermosExecutorFlags = "testing";
+    expected.executor.thermosHomeInSandbox = true;
+    expected.executor.executorOverheadCpus = 42;
+    expected.executor.executorOverheadRam = new DataAmount(42, Data.GB);
+    expected.executor.globalContainerMounts =
+        ImmutableList.of(new Volume("/container", "/host", Mode.RO));
+    expected.executor.populateDiscoveryInfo = true;
+    expected.app.maxTasksPerJob = 42;
+    expected.app.maxUpdateInstanceFailures = 42;
+    expected.app.allowedContainerTypes = ImmutableList.of(Container._Fields.DOCKER);
+    expected.app.enableDockerParameters = true;
+    expected.app.defaultDockerParameters = ImmutableList.of(new DockerParameter("a", "testing"));
+    expected.app.requireDockerUseExecutor = false;
+    expected.app.enableMesosFetcher = true;
+    expected.app.allowContainerVolumes = true;
+    expected.main.clusterName = "testing";
+    expected.main.serversetPath = "testing";
+    expected.main.serversetEndpointName = "testing";
+    expected.main.statsUrlPrefix = "testing";
+    expected.main.allowGpuResource = true;
+    expected.main.driverImpl = DriverKind.V0_DRIVER;
+    expected.scheduling.maxScheduleAttemptsPerSec = 42;
+    expected.scheduling.flappingThreshold = TEST_TIME;
+    expected.scheduling.initialFlappingDelay = TEST_TIME;
+    expected.scheduling.maxFlappingDelay = TEST_TIME;
+    expected.scheduling.maxReschedulingDelay = new TimeAmount(42, Time.DAYS);
+    expected.scheduling.firstScheduleDelay = TEST_TIME;
+    expected.scheduling.initialSchedulePenalty = TEST_TIME;
+    expected.scheduling.maxSchedulePenalty = TEST_TIME;
+    expected.scheduling.reservationDuration = TEST_TIME;
+    expected.scheduling.schedulingMaxBatchSize = 42;
+    expected.scheduling.maxTasksPerScheduleAttempt = 42;
+    expected.async.asyncWorkerThreads = 42;
+    expected.zk.useCurator = false;
+    expected.zk.inProcess = true;
+    expected.zk.zkEndpoints = ImmutableList.of(InetSocketAddress.createUnresolved("testing", 42));
+    expected.zk.chrootPath = "testing";
+    expected.zk.sessionTimeout = TEST_TIME;
+    expected.zk.digestCredentials = "testing";
+    expected.updater.enableAffinity = true;
+    expected.updater.affinityExpiration = TEST_TIME;
+    expected.state.taskAssignerModules = ImmutableList.of(NoopModule.class);
+    expected.db.useDbTaskStore = true;
+    expected.db.enableDbMetrics = false;
+    expected.db.slowQueryLogThreshold = TEST_TIME;
+    expected.db.dbRowGcInterval = TEST_TIME;
+    expected.db.h2LockTimeout = TEST_TIME;
+    expected.db.mybatisMaxActiveConnectionCount = 42;
+    expected.db.mybatisMaxIdleConnectionCount = 42;
+    expected.logStorage.shutdownGracePeriod = TEST_TIME;
+    expected.logStorage.snapshotInterval = TEST_TIME;
+    expected.logStorage.maxLogEntrySize = TEST_DATA;
+    expected.logStorage.hydrateSnapshotFields = ImmutableSet.of("testing");
+    expected.backup.backupInterval = TEST_TIME;
+    expected.backup.maxSavedBackups = 42;
+    expected.backup.backupDir = new File("testing");
+    expected.aop.methodInterceptorModules = ImmutableList.of(NoopModule.class);
+    expected.pruning.historyPruneThreshold = TEST_TIME;
+    expected.pruning.historyMaxPerJobThreshold = 42;
+    expected.pruning.historyMinRetentionThreshold = TEST_TIME;
+    expected.pruning.jobUpdateHistoryPerJobThreshold = 42;
+    expected.pruning.jobUpdateHistoryPruningInterval = TEST_TIME;
+    expected.pruning.jobUpdateHistoryPruningThreshold = TEST_TIME;
+    expected.driver.mesosMasterAddress = "testing";
+    expected.driver.frameworkAuthenticationFile = new File("testing");
+    expected.driver.frameworkFailoverTimeout = TEST_TIME;
+    expected.driver.frameworkAnnouncePrincipal = true;
+    expected.driver.frameworkName = "testing";
+    expected.driver.executorUser = "testing";
+    expected.driver.receiveRevocableResources = true;
+    expected.driver.mesosRole = "testing";
+    expected.jetty.hostnameOverride = "testing";
+    expected.jetty.httpPort = 42;
+    expected.jetty.listenIp = "testing";
+    expected.httpSecurity.shiroRealmModule = ImmutableList.of(NoopModule.class);
+    expected.httpSecurity.shiroAfterAuthFilter = AnonymousFilter.class;
+    expected.httpSecurity.httpAuthenticationMechanism = HttpAuthenticationMechanism.NEGOTIATE;
+    expected.kerberos.serverKeytab = new File("testing");
+    expected.kerberos.serverPrincipal =
+        new KerberosPrincipal("HTTP/aurora.example.com@EXAMPLE.COM");
+    expected.kerberos.kerberosDebug = true;
+
+    Ini testIni = new Ini();
+    Section users = testIni.addSection("users");
+    users.putAll(ImmutableMap.of(
+        "root", "secret, admin",
+        "wfarner", "password, eng",
+        "ksweeney", "12345"));
+    users.put("root", "secret, admin");
+    Section roles = testIni.addSection("roles");
+    roles.putAll(ImmutableMap.of(
+        "admin", "*",
+        "eng", "thrift.AuroraSchedulerManager:*"));
+
+    expected.iniShiroRealm.shiroIniPath = testIni;
+    expected.iniShiroRealm.shiroCredentialsMatcher = AllowAllCredentialsMatcher.class;
+    expected.api.enableCorsFor = "testing";
+    expected.h2Console.enableH2Console = true;
+    expected.preemptor.enablePreemptor = false;
+    expected.preemptor.preemptionDelay = TEST_TIME;
+    expected.preemptor.preemptionSlotHoldTime = TEST_TIME;
+    expected.preemptor.preemptionSlotSearchInterval = TEST_TIME;
+    expected.preemptor.reservationMaxBatchSize = 42;
+    expected.preemptor.slotFinderModules = ImmutableList.of(NoopModule.class);
+    expected.mesosLog.quorumSize = 42;
+    expected.mesosLog.logPath = new File("testing");
+    expected.mesosLog.zkLogGroupPath = "testing";
+    expected.mesosLog.coordinatorElectionTimeout = TEST_TIME;
+    expected.mesosLog.coordinatorElectionRetries = 42;
+    expected.mesosLog.readTimeout = TEST_TIME;
+    expected.mesosLog.writeTimeout = TEST_TIME;
+    expected.sla.slaRefreshInterval = TEST_TIME;
+    expected.sla.slaProdMetrics = ImmutableList.of(MetricCategory.JOB_UPTIMES);
+    expected.sla.slaNonProdMetrics = ImmutableList.of(MetricCategory.JOB_UPTIMES);
+    expected.webhook.webhookConfigFile = tempFile;
+    expected.scheduler.maxRegistrationDelay = TEST_TIME;
+    expected.scheduler.maxLeadingDuration = TEST_TIME;
+    expected.scheduler.maxStatusUpdateBatchSize = 42;
+    expected.scheduler.maxTaskEventBatchSize = 42;
+    expected.tiers.tierConfigFile = tempFile;
+    expected.asyncStats.taskStatInterval = TEST_TIME;
+    expected.asyncStats.slotStatInterval = TEST_TIME;
+    expected.stats.samplingInterval = TEST_TIME;
+    expected.stats.retentionPeriod = TEST_TIME;
+    expected.cron.cronSchedulerNumThreads = 42;
+    expected.cron.cronTimezone = "testing";
+    expected.cron.cronStartInitialBackoff = TEST_TIME;
+    expected.cron.cronStartMaxBackoff = TEST_TIME;
+    expected.cron.cronMaxBatchSize = 42;
+    expected.resourceSettings.enableRevocableCpus = false;
+    expected.resourceSettings.enableRevocableRam = true;
+
+    assertAllNonDefaultParameters(expected);
+
+    CliOptions parsed = CommandLine.parseOptions(
+        "-transient_task_state_timeout=42days",
+        "-initial_task_kill_retry_interval=42days",
+        "-reconciliation_initial_delay=42days",
+        "-reconciliation_explicit_interval=42days",
+        "-reconciliation_implicit_interval=42days",
+        "-reconciliation_schedule_spread=42days",
+        "-reconciliation_explicit_batch_size=42",
+        "-reconciliation_explicit_batch_interval=42days",
+        "-min_offer_hold_time=42days",
+        "-offer_hold_jitter_window=42days",
+        "-offer_filter_duration=42days",
+        "-unavailability_threshold=42days",
+        "-offer_order=CPU,DISK",
+        "-offer_order_modules=org.apache.aurora.scheduler.config.CommandLineTest$NoopModule",
+        "-custom_executor_config=" + tempFile.getAbsolutePath(),
+        "-thermos_executor_path=testing",
+        "-thermos_executor_resources=testing",
+        "-thermos_executor_flags=testing",
+        "-thermos_home_in_sandbox=true",
+        "-thermos_executor_cpu=42",
+        "-thermos_executor_ram=42GB",
+        "-global_container_mounts=/host:/container:ro",
+        "-populate_discovery_info=true",
+        "-max_tasks_per_job=42",
+        "-max_update_instance_failures=42",
+        "-allowed_container_types=DOCKER",
+        "-allow_docker_parameters=true",
+        "-default_docker_parameters=a=testing",
+        "-require_docker_use_executor=false",
+        "-enable_mesos_fetcher=true",
+        "-allow_container_volumes=true",
+        "-cluster_name=testing",
+        "-serverset_path=testing",
+        "-serverset_endpoint_name=testing",
+        "-viz_job_url_prefix=testing",
+        "-allow_gpu_resource=true",
+        "-mesos_driver=V0_DRIVER",
+        "-max_schedule_attempts_per_sec=42",
+        "-flapping_task_threshold=42days",
+        "-initial_flapping_task_delay=42days",
+        "-max_flapping_task_delay=42days",
+        "-max_reschedule_task_delay_on_startup=42days",
+        "-first_schedule_delay=42days",
+        "-initial_schedule_penalty=42days",
+        "-max_schedule_penalty=42days",
+        "-offer_reservation_duration=42days",
+        "-scheduling_max_batch_size=42",
+        "-max_tasks_per_schedule_attempt=42",
+        "-async_worker_threads=42",
+        "-zk_use_curator=false",
+        "-zk_in_proc=true",
+        "-zk_endpoints=testing:42",
+        "-zk_chroot_path=testing",
+        "-zk_session_timeout=42days",
+        "-zk_digest_credentials=testing",
+        "-enable_update_affinity=true",
+        "-update_affinity_reservation_hold_time=42days",
+        "-task_assigner_modules=org.apache.aurora.scheduler.config.CommandLineTest$NoopModule",
+        "-use_beta_db_task_store=true",
+        "-enable_db_metrics=false",
+        "-slow_query_log_threshold=42days",
+        "-db_row_gc_interval=42days",
+        "-db_lock_timeout=42days",
+        "-db_max_active_connection_count=42",
+        "-db_max_idle_connection_count=42",
+        "-dlog_shutdown_grace_period=42days",
+        "-dlog_snapshot_interval=42days",
+        "-dlog_max_entry_size=42GB",
+        "-snapshot_hydrate_stores=testing",
+        "-backup_interval=42days",
+        "-max_saved_backups=42",
+        "-backup_dir=testing",
+        "-thrift_method_interceptor_modules="
+            + "org.apache.aurora.scheduler.config.CommandLineTest$NoopModule",
+        "-history_prune_threshold=42days",
+        "-history_max_per_job_threshold=42",
+        "-history_min_retention_threshold=42days",
+        "-job_update_history_per_job_threshold=42",
+        "-job_update_history_pruning_interval=42days",
+        "-job_update_history_pruning_threshold=42days",
+        "-mesos_master_address=testing",
+        "-framework_authentication_file=testing",
+        "-framework_failover_timeout=42days",
+        "-framework_announce_principal=true",
+        "-framework_name=testing",
+        "-executor_user=testing",
+        "-receive_revocable_resources=true",
+        "-mesos_role=testing",
+        "-hostname=testing",
+        "-http_port=42",
+        "-ip=testing",
+        "-shiro_realm_modules=org.apache.aurora.scheduler.config.CommandLineTest$NoopModule",
+        "-shiro_after_auth_filter=org.apache.shiro.web.filter.authc.AnonymousFilter",
+        "-http_authentication_mechanism=NEGOTIATE",
+        "-kerberos_server_keytab=testing",
+        "-kerberos_server_principal=HTTP/aurora.example.com@EXAMPLE.COM",
+        "-kerberos_debug=true",
+        "-shiro_ini_path=" + ShiroIniConverterTest.class.getResource(EXAMPLE_RESOURCE).toString(),
+        "-shiro_credentials_matcher="
+            + "org.apache.shiro.authc.credential.AllowAllCredentialsMatcher",
+        "-enable_cors_for=testing",
+        "-enable_h2_console=true",
+        "-enable_preemptor=false",
+        "-preemption_delay=42days",
+        "-preemption_slot_hold_time=42days",
+        "-preemption_slot_search_interval=42days",
+        "-preemption_reservation_max_batch_size=42",
+        "-preemption_slot_finder_modules="
+            + "org.apache.aurora.scheduler.config.CommandLineTest$NoopModule",
+        "-native_log_quorum_size=42",
+        "-native_log_file_path=testing",
+        "-native_log_zk_group_path=testing",
+        "-native_log_election_timeout=42days",
+        "-native_log_election_retries=42",
+        "-native_log_read_timeout=42days",
+        "-native_log_write_timeout=42days",
+        "-sla_stat_refresh_interval=42days",
+        "-sla_prod_metrics=JOB_UPTIMES",
+        "-sla_non_prod_metrics=JOB_UPTIMES",
+        "-webhook_config=" + tempFile.getAbsolutePath(),
+        "-max_registration_delay=42days",
+        "-max_leading_duration=42days",
+        "-max_status_update_batch_size=42",
+        "-max_task_event_batch_size=42",
+        "-tier_config=" + tempFile.getAbsolutePath(),
+        "-async_task_stat_update_interval=42days",
+        "-async_slot_stat_update_interval=42days",
+        "-stat_sampling_interval=42days",
+        "-stat_retention_period=42days",
+        "-cron_scheduler_num_threads=42",
+        "-cron_timezone=testing",
+        "-cron_start_initial_backoff=42days",
+        "-cron_start_max_backoff=42days",
+        "-cron_scheduling_max_batch_size=42",
+        "-enable_revocable_cpus=false",
+        "-enable_revocable_ram=true"
+    );
+    assertEqualOptions(expected, parsed);
+  }
+
+  private static void assertEqualOptions(CliOptions expected, CliOptions actual) {
+    List<Object> actualObjects = CommandLine.getOptionsObjects(actual);
+    for (Object expectedOptionContainer : CommandLine.getOptionsObjects(expected)) {
+      Iterable<Field> paramFields = FluentIterable
+          .from(expectedOptionContainer.getClass().getDeclaredFields())
+          .filter(f -> f.getAnnotation(Parameter.class) != null);
+      Object actualOptionContainer = FluentIterable.from(actualObjects)
+          .firstMatch(Predicates.instanceOf(expectedOptionContainer.getClass()))
+          .get();
+      for (Field field : paramFields) {
+        Parameter declaration = field.getAnnotation(Parameter.class);
+        try {
+          assertEquals(String.format("Value for %s does not match", declaration.names()[0]),
+              field.get(expectedOptionContainer),
+              field.get(actualOptionContainer));
+        } catch (IllegalAccessException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    }
+  }
+
+  private static void assertAllNonDefaultParameters(CliOptions testCase) {
+    // This is a safety check for the test setup itself.  We want to ensure that all options are
+    // set up to parse correctly (e.g. have types that the parsing system is set up to handle).
+    // To do this, check that the expected parse result sets all parameter fields to non-default
+    // values.
+    List<Object> defaultContainers = CommandLine.getOptionsObjects(new CliOptions());
+
+    List<String> errors = Lists.newArrayList();
+
+    for (Object testCaseContainer : CommandLine.getOptionsObjects(testCase)) {
+      Iterable<Field> paramFields = FluentIterable
+          .from(testCaseContainer.getClass().getDeclaredFields())
+          .filter(f -> f.getAnnotation(Parameter.class) != null);
+      Object defaultObject = FluentIterable.from(defaultContainers)
+          .firstMatch(Predicates.instanceOf(testCaseContainer.getClass()))
+          .get();
+      for (Field field : paramFields) {
+        Parameter declaration = field.getAnnotation(Parameter.class);
+        try {
+          String desc =
+              String.format("for field %s (option %s)", field.getName(), declaration.names()[0]);
+          Object testCaseOptionValue = field.get(testCaseContainer);
+          if (testCaseOptionValue == null) {
+            errors.add(String.format("Test case value may not be null %s", desc));
+            continue;
+          }
+          if (testCaseOptionValue instanceof Iterable) {
+            Iterable<?> value = (Iterable<?>) testCaseOptionValue;
+            if (Iterables.isEmpty(value)) {
+              errors.add(String.format("Test case value may not be empty %s", desc));
+              continue;
+            }
+          }
+          if (testCaseOptionValue instanceof Map) {
+            Map<?, ?> value = (Map<?, ?>) testCaseOptionValue;
+            if (value.isEmpty()) {
+              errors.add(String.format("Test case value may not be empty %s", desc));
+              continue;
+            }
+          }
+          if (testCaseOptionValue.equals(field.get(defaultObject))) {
+            errors.add(String.format("Test case may not use default option value %s", desc));
+          }
+        } catch (IllegalAccessException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    }
+
+    if (!errors.isEmpty()) {
+      fail("Test case is incomplete:\n  " + Joiner.on("\n  ").join(errors));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/config/CustomModule.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/config/CustomModule.java b/src/test/java/org/apache/aurora/scheduler/config/CustomModule.java
new file mode 100644
index 0000000..8bb016b
--- /dev/null
+++ b/src/test/java/org/apache/aurora/scheduler/config/CustomModule.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.aurora.scheduler.config;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import com.google.inject.AbstractModule;
+import com.google.inject.Key;
+import com.google.inject.name.Names;
+
+public class CustomModule extends AbstractModule {
+  static final Key<String> BINDING_KEY = Key.get(String.class, Names.named("custom_test"));
+
+  private final Options options;
+
+  @Parameters(separators = "=")
+  public static class Options {
+    @Parameter(names = "-custom_flag")
+    String customFlag = "default";
+  }
+
+  static {
+    // Statically register custom options for CLI parsing.
+    CommandLine.registerCustomOptions(new Options());
+  }
+
+  public CustomModule(CliOptions options) {
+    // Consume parsed and populated options.
+    this.options = options.getCustom(Options.class);
+  }
+
+  @Override
+  protected void configure() {
+    bind(BINDING_KEY).toInstance(options.customFlag);
+  }
+}

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java b/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
index 50d7499..265e87e 100644
--- a/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/configuration/ConfigurationManagerTest.java
@@ -17,7 +17,6 @@ import java.util.List;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
 import com.google.common.collect.ImmutableSet;
 
 import org.apache.aurora.gen.AppcImage;
@@ -121,7 +120,7 @@ public class ConfigurationManagerTest {
       new ConfigurationManagerSettings(
           ALL_CONTAINER_TYPES,
           false,
-          ImmutableMultimap.of(),
+          ImmutableList.of(),
           true,
           false,
           true,
@@ -133,7 +132,7 @@ public class ConfigurationManagerTest {
       new ConfigurationManagerSettings(
           ALL_CONTAINER_TYPES,
           true,
-          ImmutableMultimap.of("foo", "bar"),
+          ImmutableList.of(new DockerParameter("foo", "bar")),
           false,
           true,
           true,
@@ -286,7 +285,7 @@ public class ConfigurationManagerTest {
         new ConfigurationManagerSettings(
             ALL_CONTAINER_TYPES,
             true,
-            ImmutableMultimap.of("foo", "bar"),
+            ImmutableList.of(new DockerParameter("foo", "bar")),
             false,
             false,
             false,
@@ -309,7 +308,7 @@ public class ConfigurationManagerTest {
             new ConfigurationManagerSettings(
                     ALL_CONTAINER_TYPES,
                     true,
-                    ImmutableMultimap.of("foo", "bar"),
+                ImmutableList.of(new DockerParameter("foo", "bar")),
                     false,
                     false,
                     false,

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/cron/quartz/CronIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/cron/quartz/CronIT.java b/src/test/java/org/apache/aurora/scheduler/cron/quartz/CronIT.java
index 8556253..459d6be 100644
--- a/src/test/java/org/apache/aurora/scheduler/cron/quartz/CronIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/cron/quartz/CronIT.java
@@ -85,7 +85,7 @@ public class CronIT extends EasyMockTest {
     injector = Guice.createInjector(
         // Override to verify that Guice is actually used for construction of the AuroraCronJob.
         // TODO(ksweeney): Use the production class here.
-        Modules.override(new CronModule()).with(new AbstractModule() {
+        Modules.override(new CronModule(new CronModule.Options())).with(new AbstractModule() {
           @Override
           protected void configure() {
             bind(AuroraCronJob.class).toInstance(auroraCronJob);

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java b/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
index 827aa2d..2906b08 100644
--- a/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
@@ -231,14 +231,22 @@ public class WebhookTest {
     webhook.taskChangedState(CHANGE_OLD_STATE);
   }
 
+  private static final String TEST_CONFIG = "{\n"
+      + "  \"headers\": {\n"
+      + "    \"Content-Type\": \"application/vnd.kafka.json.v1+json\",\n"
+      + "    \"Producer-Type\": \"reliable\"\n"
+      + "  },\n"
+      + "  \"targetURL\": \"http://localhost:8080/\",\n"
+      + "  \"timeoutMsec\": 5000\n"
+      + "}\n";
+
   @Test
   public void testParsingWebhookInfo() throws Exception {
     WebhookInfo webhookInfo = WEBHOOK_INFO_BUILDER
         .setTargetURL(STATIC_URL)
         .build();
 
-    WebhookInfo parsedWebhookInfo = WebhookModule.parseWebhookConfig(
-        WebhookModule.readWebhookFile());
+    WebhookInfo parsedWebhookInfo = WebhookModule.parseWebhookConfig(TEST_CONFIG);
     // Verifying the WebhookInfo parsed from webhook.json file is identical to the WebhookInfo
     // built from WebhookInfoBuilder.
     assertEquals(parsedWebhookInfo.toString(), webhookInfo.toString());

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java b/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
index fb03f25..6e77857 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
@@ -50,6 +50,7 @@ import org.apache.aurora.scheduler.TierManager;
 import org.apache.aurora.scheduler.app.LifecycleModule;
 import org.apache.aurora.scheduler.app.ServiceGroupMonitor;
 import org.apache.aurora.scheduler.async.AsyncModule;
+import org.apache.aurora.scheduler.config.CliOptions;
 import org.apache.aurora.scheduler.cron.CronJobManager;
 import org.apache.aurora.scheduler.http.api.GsonMessageBodyHandler;
 import org.apache.aurora.scheduler.offers.OfferManager;
@@ -97,11 +98,13 @@ public abstract class AbstractJettyTest extends EasyMockTest {
 
     ServiceGroupMonitor serviceGroupMonitor = createMock(ServiceGroupMonitor.class);
 
+    CliOptions options = new CliOptions();
+
     injector = Guice.createInjector(
-        new StatsModule(),
+        new StatsModule(options.stats),
         new LifecycleModule(),
         new SchedulerServicesModule(),
-        new AsyncModule(),
+        new AsyncModule(options.async),
         new AbstractModule() {
           <T> T bindMock(Class<T> clazz) {
             T mock = createMock(clazz);
@@ -137,7 +140,7 @@ public abstract class AbstractJettyTest extends EasyMockTest {
             });
           }
         },
-        new JettyServerModule(false));
+        new JettyServerModule(options, false));
 
     schedulers = new AtomicReference<>(ImmutableSet.of());
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
index ccef4ab..e8ef6bd 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
@@ -66,7 +66,7 @@ public class ApiBetaTest extends AbstractJettyTest {
   @Override
   protected Module getChildServletModule() {
     return Modules.combine(
-        new ApiModule(),
+        new ApiModule(new ApiModule.Options()),
         new AbstractModule() {
           @Override
           protected void configure() {

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/ApiIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/ApiIT.java b/src/test/java/org/apache/aurora/scheduler/http/api/ApiIT.java
index 0a3ff05..43fa315 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/ApiIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/ApiIT.java
@@ -51,7 +51,7 @@ public class ApiIT extends AbstractJettyTest {
   @Override
   protected Module getChildServletModule() {
     return Modules.combine(
-        new ApiModule(),
+        new ApiModule(new ApiModule.Options()),
         new AbstractModule() {
           @Override
           protected void configure() {

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
index f3d5336..86bcab2 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
@@ -156,7 +156,7 @@ public class HttpSecurityIT extends AbstractJettyTest {
   @Override
   protected Module getChildServletModule() {
     return Modules.combine(
-        new ApiModule(),
+        new ApiModule(new ApiModule.Options()),
         new H2ConsoleModule(true),
         new HttpSecurityModule(
             new IniShiroRealmModule(ini, credentialsMatcher),

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalConverterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalConverterTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalConverterTest.java
new file mode 100644
index 0000000..d8e2470
--- /dev/null
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalConverterTest.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aurora.scheduler.http.api.security;
+
+import javax.security.auth.kerberos.KerberosPrincipal;
+
+import com.beust.jcommander.ParameterException;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class KerberosPrincipalConverterTest {
+  @Test
+  public void testValidPrincipal() {
+    String principal = "HTTP/example.com@EXAMPLE.COM";
+    assertEquals(
+        new KerberosPrincipal(principal),
+        new KerberosPrincipalConverter().convert(principal));
+  }
+
+  @Test(expected = ParameterException.class)
+  public void testInvalidPrincipal() {
+    new KerberosPrincipalConverter().convert("@HTTP/example.com");
+  }
+}

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalParserTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalParserTest.java
deleted file mode 100644
index 7e55ef8..0000000
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/KerberosPrincipalParserTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.scheduler.http.api.security;
-
-import javax.security.auth.kerberos.KerberosPrincipal;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class KerberosPrincipalParserTest {
-  @Test
-  public void testValidPrincipal() {
-    String principal = "HTTP/example.com@EXAMPLE.COM";
-    assertEquals(
-        new KerberosPrincipal(principal),
-        new KerberosPrincipalParser().doParse(principal));
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testInvalidPrincipal() {
-    new KerberosPrincipalParser().doParse("@HTTP/example.com");
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/security/ModuleParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/ModuleParserTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/ModuleParserTest.java
deleted file mode 100644
index baaeb23..0000000
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/ModuleParserTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.scheduler.http.api.security;
-
-import com.google.inject.Binder;
-import com.google.inject.Module;
-
-import org.junit.Test;
-
-public class ModuleParserTest {
-  static class NoOpModule implements Module {
-    NoOpModule() {
-      // No-op.
-    }
-
-    @Override
-    public void configure(Binder binder) {
-      // No-op.
-    }
-  }
-
-  static class NoNullaryConstructorModule implements Module {
-    private final String name;
-
-    NoNullaryConstructorModule(String name) {
-      this.name = name;
-    }
-
-    @Override
-    public void configure(Binder binder) {
-      binder.bind(String.class).toInstance(name);
-    }
-  }
-
-  static class ThrowingConstructorModule implements Module {
-    ThrowingConstructorModule() {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void configure(Binder binder) {
-      // Unreachable.
-    }
-  }
-
-  @Test
-  public void testDoParseSuccess() {
-    new ModuleParser().doParse(NoOpModule.class.getName());
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testDoParseClassNotFound() {
-    new ModuleParser().doParse("invalid.class.name");
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testDoParseNotModule() {
-    new ModuleParser().doParse(String.class.getCanonicalName());
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testDoParseNoNullaryConstructor() {
-    new ModuleParser().doParse(NoNullaryConstructorModule.class.getCanonicalName());
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testDoParseThrowingConstructorModule() {
-    new ModuleParser().doParse(ThrowingConstructorModule.class.getCanonicalName());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniConverterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniConverterTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniConverterTest.java
new file mode 100644
index 0000000..d6eab33
--- /dev/null
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniConverterTest.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aurora.scheduler.http.api.security;
+
+import com.beust.jcommander.ParameterException;
+import com.google.common.collect.ImmutableSet;
+
+import org.apache.aurora.scheduler.http.api.security.ShiroIniConverter.ExtraSectionsException;
+import org.apache.aurora.scheduler.http.api.security.ShiroIniConverter.MissingSectionsException;
+import org.apache.shiro.io.ResourceUtils;
+import org.apache.shiro.realm.text.IniRealm;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ShiroIniConverterTest {
+  private ShiroIniConverter parser;
+
+  public static final String EXAMPLE_RESOURCE = "shiro-example.ini";
+  private static final String EXTRA_SECTIONS_SHIRO_INI = "shiro-malformed-extra-sections.ini";
+  private static final String MISSING_SECTIONS_SHIRO_INI = "shiro-missing-sections.ini";
+  private static final String NONEXISTENT_RESOURCE = "shiro-nonexistent.ini";
+  private static final String NO_SECTIONS_SHURO_INI = "shiro-malformed-no-sections.ini";
+
+  @Before
+  public void setUp() {
+    parser = new ShiroIniConverter();
+  }
+
+  @Test
+  public void testDoParseSuccess() {
+    assertEquals(
+        ShiroIniConverter.ALLOWED_SECTION_NAMES,
+        parser.convert(
+            ShiroIniConverterTest.class.getResource(EXAMPLE_RESOURCE).toString())
+            .getSectionNames());
+  }
+
+  @Test
+  public void testDoParseOptionalSections() {
+    assertEquals(
+        ImmutableSet.of(IniRealm.ROLES_SECTION_NAME),
+        parser
+            .convert(ShiroIniConverterTest.class.getResource(MISSING_SECTIONS_SHIRO_INI).toString())
+            .getSectionNames());
+  }
+
+  @Test(expected = ParameterException.class)
+  public void testDoParseNonexistent() {
+    parser.convert(ResourceUtils.CLASSPATH_PREFIX + NONEXISTENT_RESOURCE);
+  }
+
+  @Test(expected = ExtraSectionsException.class)
+  public void testDoParseExtraSections() {
+    parser.convert(getClass().getResource(EXTRA_SECTIONS_SHIRO_INI).toString());
+  }
+
+  @Test(expected = MissingSectionsException.class)
+  public void testDoParseMissingSections() {
+    parser.convert(getClass().getResource(NO_SECTIONS_SHURO_INI).toString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniParserTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniParserTest.java
deleted file mode 100644
index 3ca8c86..0000000
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/ShiroIniParserTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.scheduler.http.api.security;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.aurora.scheduler.http.api.security.ShiroIniParser.ExtraSectionsException;
-import org.apache.aurora.scheduler.http.api.security.ShiroIniParser.MissingSectionsException;
-import org.apache.aurora.scheduler.http.api.security.ShiroIniParser.ShiroConfigurationException;
-import org.apache.shiro.io.ResourceUtils;
-import org.apache.shiro.realm.text.IniRealm;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class ShiroIniParserTest {
-  private ShiroIniParser parser;
-
-  private static final String EXAMPLE_RESOURCE = "shiro-example.ini";
-  private static final String EXTRA_SECTIONS_SHIRO_INI = "shiro-malformed-extra-sections.ini";
-  private static final String MISSING_SECTIONS_SHIRO_INI = "shiro-missing-sections.ini";
-  private static final String NONEXISTENT_RESOURCE = "shiro-nonexistent.ini";
-  private static final String NO_SECTIONS_SHURO_INI = "shiro-malformed-no-sections.ini";
-
-  @Before
-  public void setUp() {
-    parser = new ShiroIniParser();
-  }
-
-  @Test
-  public void testDoParseSuccess() {
-    assertEquals(
-        ShiroIniParser.ALLOWED_SECTION_NAMES,
-        parser.doParse(
-            ShiroIniParserTest.class.getResource(EXAMPLE_RESOURCE).toString()).getSectionNames());
-  }
-
-  @Test
-  public void testDoParseOptionalSections() {
-    assertEquals(
-        ImmutableSet.of(IniRealm.ROLES_SECTION_NAME),
-        parser
-            .doParse(ShiroIniParserTest.class.getResource(MISSING_SECTIONS_SHIRO_INI).toString())
-            .getSectionNames());
-  }
-
-  @Test(expected = ShiroConfigurationException.class)
-  public void testDoParseNonexistent() {
-    parser.doParse(ResourceUtils.CLASSPATH_PREFIX + NONEXISTENT_RESOURCE);
-  }
-
-  @Test(expected = ExtraSectionsException.class)
-  public void testDoParseExtraSections() {
-    parser.doParse(getClass().getResource(EXTRA_SECTIONS_SHIRO_INI).toString());
-  }
-
-  @Test(expected = MissingSectionsException.class)
-  public void testDoParseMissingSections() {
-    parser.doParse(getClass().getResource(NO_SECTIONS_SHURO_INI).toString());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/mesos/CommandLineDriverSettingsModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/mesos/CommandLineDriverSettingsModuleTest.java b/src/test/java/org/apache/aurora/scheduler/mesos/CommandLineDriverSettingsModuleTest.java
index d2c829e..7b04291 100644
--- a/src/test/java/org/apache/aurora/scheduler/mesos/CommandLineDriverSettingsModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/mesos/CommandLineDriverSettingsModuleTest.java
@@ -26,6 +26,8 @@ import org.apache.aurora.common.quantity.Time;
 import org.apache.mesos.v1.Protos;
 import org.junit.Test;
 
+import static org.apache.aurora.scheduler.mesos.CommandLineDriverSettingsModule.Options.PRINCIPAL_KEY;
+import static org.apache.aurora.scheduler.mesos.CommandLineDriverSettingsModule.Options.SECRET_KEY;
 import static org.apache.mesos.v1.Protos.FrameworkInfo.Capability.Type.GPU_RESOURCES;
 import static org.apache.mesos.v1.Protos.FrameworkInfo.Capability.Type.REVOCABLE_RESOURCES;
 import static org.junit.Assert.assertEquals;
@@ -39,7 +41,7 @@ public class CommandLineDriverSettingsModuleTest {
   @Test(expected = IllegalStateException.class)
   public void testMissingPropertiesParsing() {
     Properties testProperties = new Properties();
-    testProperties.put(CommandLineDriverSettingsModule.PRINCIPAL_KEY, "aurora-scheduler");
+    testProperties.put(PRINCIPAL_KEY, "aurora-scheduler");
 
     ByteArrayOutputStream propertiesStream = new ByteArrayOutputStream();
     try {
@@ -55,8 +57,8 @@ public class CommandLineDriverSettingsModuleTest {
   @Test
   public void testPropertiesParsing() {
     Properties testProperties = new Properties();
-    testProperties.put(CommandLineDriverSettingsModule.PRINCIPAL_KEY, "aurora-scheduler");
-    testProperties.put(CommandLineDriverSettingsModule.SECRET_KEY, "secret");
+    testProperties.put(PRINCIPAL_KEY, "aurora-scheduler");
+    testProperties.put(SECRET_KEY, "secret");
 
     ByteArrayOutputStream propertiesStream = new ByteArrayOutputStream();
     try {

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java b/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
index 93cc34c..d91b540 100644
--- a/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
@@ -155,6 +155,8 @@ public class MesosTaskFactoryImplTest extends EasyMockTest {
   public void setUp() {
     config = THERMOS_EXECUTOR;
     tierManager = createMock(TierManager.class);
+
+    ResourceType.initializeEmptyCliArgsForTest();
   }
 
   private static ExecutorInfo populateDynamicFields(ExecutorInfo executor, IAssignedTask task) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/offers/OfferManagerImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/offers/OfferManagerImplTest.java b/src/test/java/org/apache/aurora/scheduler/offers/OfferManagerImplTest.java
index b92ad35..2cfdc09 100644
--- a/src/test/java/org/apache/aurora/scheduler/offers/OfferManagerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/offers/OfferManagerImplTest.java
@@ -33,6 +33,7 @@ import org.apache.aurora.scheduler.events.PubsubEvent.DriverDisconnected;
 import org.apache.aurora.scheduler.events.PubsubEvent.HostAttributesChanged;
 import org.apache.aurora.scheduler.mesos.Driver;
 import org.apache.aurora.scheduler.offers.OfferManager.OfferManagerImpl;
+import org.apache.aurora.scheduler.resources.ResourceType;
 import org.apache.aurora.scheduler.storage.entities.IHostAttributes;
 import org.apache.aurora.scheduler.storage.entities.IScheduledTask;
 import org.apache.aurora.scheduler.testing.FakeScheduledExecutor;
@@ -460,6 +461,7 @@ public class OfferManagerImplTest extends EasyMockTest {
 
   @Test
   public void testRevocableCPUOrdering() throws Exception {
+    ResourceType.initializeEmptyCliArgsForTest();
     OfferManager cpuManager = createOrderedManager(ImmutableList.of(OfferOrder.REVOCABLE_CPU));
 
     HostOffer small = setMode(new HostOffer(

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
index b8d7506..fa74fb6 100644
--- a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilterTest.java
@@ -121,6 +121,7 @@ public class PreemptionVictimFilterTest extends EasyMockTest {
     preemptorMetrics = new PreemptorMetrics(new CachedCounters(statsProvider));
     tierManager = createMock(TierManager.class);
     clock = new FakeClock();
+    ResourceType.initializeEmptyCliArgsForTest();
   }
 
   private Optional<ImmutableSet<PreemptionVictim>> runFilter(

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
index 3317133..97c238c 100644
--- a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
@@ -14,16 +14,15 @@
 package org.apache.aurora.scheduler.preemptor;
 
 import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableList;
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.Module;
 
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
 import org.apache.aurora.gen.AssignedTask;
+import org.apache.aurora.scheduler.config.CliOptions;
 import org.apache.aurora.scheduler.filter.AttributeAggregate;
 import org.apache.aurora.scheduler.filter.SchedulingFilter;
 import org.apache.aurora.scheduler.state.StateManager;
@@ -65,20 +64,24 @@ public class PreemptorModuleTest extends EasyMockTest {
         });
   }
 
+  public static class FakeSlotFinder extends AbstractModule {
+    @Override
+    protected void configure() {
+      Runnable alwaysThrow = () -> {
+        throw new RuntimeException("I should not run");
+      };
+      bind(Runnable.class).annotatedWith(PreemptorModule.PreemptionSlotFinder.class)
+          .toInstance(alwaysThrow);
+    }
+  }
+
   @Test
   public void testPreemptorDisabled() throws Exception {
-    Injector injector = createInjector(new PreemptorModule(
-        false,
-        Amount.of(0L, Time.SECONDS),
-        Amount.of(0L, Time.SECONDS),
-        5,
-        ImmutableSet.of(new AbstractModule() {
-          @Override
-          protected void configure() {
-            bind(Runnable.class).annotatedWith(PreemptorModule.PreemptionSlotFinder.class)
-                .toInstance(createMock(Runnable.class));
-          }
-        })));
+    CliOptions options = new CliOptions();
+    options.preemptor.enablePreemptor = false;
+    options.preemptor.slotFinderModules = ImmutableList.of(FakeSlotFinder.class);
+
+    Injector injector = createInjector(new PreemptorModule(options));
 
     control.replay();
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java b/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
index dded9c3..c47f7c9 100644
--- a/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/resources/AcceptedOfferTest.java
@@ -25,6 +25,7 @@ import org.apache.aurora.scheduler.TierInfo;
 import org.apache.aurora.scheduler.storage.entities.IAssignedTask;
 import org.apache.mesos.v1.Protos;
 import org.apache.mesos.v1.Protos.Resource;
+import org.junit.Before;
 import org.junit.Test;
 
 import static org.apache.aurora.scheduler.base.TaskTestUtil.DEV_TIER;
@@ -52,6 +53,11 @@ public class AcceptedOfferTest {
       EXECUTOR_BAG.add(bagFromResources(TASK.getTask().getResources()));
   private static final Integer[] TASK_PORTS = {TASK.getAssignedPorts().get("http")};
 
+  @Before
+  public void setUp() {
+    ResourceType.initializeEmptyCliArgsForTest();
+  }
+
   @Test
   public void testReservedPredicates() {
     Protos.Resource withRole = mesosScalar(CPUS, TEST_ROLE, false, 1.0);

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/resources/ResourceManagerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/resources/ResourceManagerTest.java b/src/test/java/org/apache/aurora/scheduler/resources/ResourceManagerTest.java
index b8b8edb..37dfcbc 100644
--- a/src/test/java/org/apache/aurora/scheduler/resources/ResourceManagerTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/resources/ResourceManagerTest.java
@@ -48,8 +48,10 @@ import static org.apache.mesos.v1.Protos.Value.Type.SCALAR;
 import static org.junit.Assert.assertEquals;
 
 public class ResourceManagerTest {
+
   @Test
   public void testGetOfferResources() {
+    ResourceType.initializeEmptyCliArgsForTest();
     Protos.Resource resource1 = Protos.Resource.newBuilder()
         .setType(SCALAR)
         .setName(CPUS.getMesosName())

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculatorImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculatorImplTest.java b/src/test/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculatorImplTest.java
index 2d34729..0dec633 100644
--- a/src/test/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculatorImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/scheduling/RescheduleCalculatorImplTest.java
@@ -19,7 +19,6 @@ import com.google.common.base.Function;
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableMap;
 
-import org.apache.aurora.common.quantity.Amount;
 import org.apache.aurora.common.quantity.Time;
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
 import org.apache.aurora.common.util.BackoffStrategy;
@@ -28,6 +27,7 @@ import org.apache.aurora.gen.ScheduledTask;
 import org.apache.aurora.gen.TaskEvent;
 import org.apache.aurora.scheduler.base.TaskTestUtil;
 import org.apache.aurora.scheduler.base.Tasks;
+import org.apache.aurora.scheduler.config.types.TimeAmount;
 import org.apache.aurora.scheduler.scheduling.RescheduleCalculator.RescheduleCalculatorImpl;
 import org.apache.aurora.scheduler.storage.entities.IScheduledTask;
 import org.apache.aurora.scheduler.storage.testing.StorageTestUtil;
@@ -45,8 +45,8 @@ import static org.junit.Assert.assertEquals;
 
 public class RescheduleCalculatorImplTest extends EasyMockTest {
 
-  private static final Amount<Long, Time> FLAPPING_THRESHOLD = Amount.of(1L, Time.MINUTES);
-  private static final Amount<Integer, Time> MAX_STARTUP_DELAY = Amount.of(10, Time.MINUTES);
+  private static final TimeAmount FLAPPING_THRESHOLD = new TimeAmount(1, Time.MINUTES);
+  private static final TimeAmount MAX_STARTUP_DELAY = new TimeAmount(10, Time.MINUTES);
 
   private StorageTestUtil storageUtil;
   private BackoffStrategy backoff;

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java b/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
index 341e346..d37e7a0 100644
--- a/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
@@ -19,14 +19,12 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.Key;
 import com.google.inject.Module;
 
-import org.apache.aurora.common.quantity.Amount;
 import org.apache.aurora.common.quantity.Time;
 import org.apache.aurora.common.stats.StatsProvider;
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
@@ -34,6 +32,7 @@ import org.apache.aurora.common.util.Clock;
 import org.apache.aurora.common.util.testing.FakeClock;
 import org.apache.aurora.scheduler.app.LifecycleModule;
 import org.apache.aurora.scheduler.base.Query;
+import org.apache.aurora.scheduler.config.types.TimeAmount;
 import org.apache.aurora.scheduler.sla.SlaModule.SlaUpdater;
 import org.apache.aurora.scheduler.storage.Storage;
 import org.apache.aurora.scheduler.storage.testing.StorageTestUtil;
@@ -62,10 +61,11 @@ public class SlaModuleTest extends EasyMockTest {
     storageUtil = new StorageTestUtil(this);
     clock = new FakeClock();
     statsProvider = createMock(StatsProvider.class);
-    module = new SlaModule(
-        Amount.of(5L, Time.MILLISECONDS),
-        ImmutableSet.of(JOB_UPTIMES, MEDIANS, PLATFORM_UPTIME),
-        ImmutableSet.of(JOB_UPTIMES, MEDIANS, PLATFORM_UPTIME));
+    SlaModule.Options options = new SlaModule.Options();
+    options.slaRefreshInterval = new TimeAmount(5L, Time.MILLISECONDS);
+    options.slaProdMetrics = ImmutableList.of(JOB_UPTIMES, MEDIANS, PLATFORM_UPTIME);
+    options.slaNonProdMetrics = ImmutableList.of(JOB_UPTIMES, MEDIANS, PLATFORM_UPTIME);
+    module = new SlaModule(options);
     injector = Guice.createInjector(
         ImmutableList.<Module>builder()
             .add(module)

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java b/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
index 50a09a6..f8e8023 100644
--- a/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/stats/AsyncStatsModuleTest.java
@@ -20,9 +20,11 @@ import org.apache.aurora.gen.HostAttributes;
 import org.apache.aurora.scheduler.HostOffer;
 import org.apache.aurora.scheduler.offers.OfferManager;
 import org.apache.aurora.scheduler.resources.ResourceTestUtil;
+import org.apache.aurora.scheduler.resources.ResourceType;
 import org.apache.aurora.scheduler.stats.SlotSizeCounter.MachineResource;
 import org.apache.aurora.scheduler.storage.entities.IHostAttributes;
 import org.apache.mesos.v1.Protos;
+import org.junit.Before;
 import org.junit.Test;
 
 import static org.apache.aurora.scheduler.resources.ResourceTestUtil.mesosScalar;
@@ -34,6 +36,12 @@ import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
 
 public class AsyncStatsModuleTest extends EasyMockTest {
+
+  @Before
+  public void setUp() {
+    ResourceType.initializeEmptyCliArgsForTest();
+  }
+
   @Test
   public void testOfferAdapter() {
     OfferManager offerManager = createMock(OfferManager.class);

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/storage/db/RowGarbageCollectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/db/RowGarbageCollectorTest.java b/src/test/java/org/apache/aurora/scheduler/storage/db/RowGarbageCollectorTest.java
index caaba9b..74c9d1d 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/db/RowGarbageCollectorTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/db/RowGarbageCollectorTest.java
@@ -57,7 +57,7 @@ public class RowGarbageCollectorTest {
   public void setUp() {
     Injector injector = Guice.createInjector(
         DbModule.testModuleWithWorkQueue(),
-        new DbModule.GarbageCollectorModule(),
+        new DbModule.GarbageCollectorModule(new DbModule.Options()),
         new AbstractModule() {
           @Override
           protected void configure() {

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImplIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImplIT.java b/src/test/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImplIT.java
index 7f41430..b2c333e 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImplIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/log/SnapshotStoreImplIT.java
@@ -57,6 +57,7 @@ import org.apache.aurora.scheduler.base.TaskTestUtil;
 import org.apache.aurora.scheduler.resources.ResourceBag;
 import org.apache.aurora.scheduler.storage.SnapshotStore;
 import org.apache.aurora.scheduler.storage.Storage;
+import org.apache.aurora.scheduler.storage.db.DbModule;
 import org.apache.aurora.scheduler.storage.db.EnumBackfill;
 import org.apache.aurora.scheduler.storage.db.MigrationManager;
 import org.apache.aurora.scheduler.storage.entities.IHostAttributes;
@@ -100,7 +101,9 @@ public class SnapshotStoreImplIT {
       injector = createStorageInjector(testModuleWithWorkQueue());
     } else {
       injector = createStorageInjector(
-          testModuleWithWorkQueue(PLAIN, Optional.of(new InMemStoresModule(PLAIN))));
+          testModuleWithWorkQueue(
+              PLAIN,
+              Optional.of(new InMemStoresModule(new DbModule.Options(), PLAIN))));
     }
 
     storage = injector.getInstance(Storage.class);

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/storage/mem/InMemTaskStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/mem/InMemTaskStoreTest.java b/src/test/java/org/apache/aurora/scheduler/storage/mem/InMemTaskStoreTest.java
index 02719c3..84fa3ff 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/mem/InMemTaskStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/mem/InMemTaskStoreTest.java
@@ -43,7 +43,9 @@ public class InMemTaskStoreTest extends AbstractTaskStoreTest {
   protected Module getStorageModule() {
     statsProvider = new FakeStatsProvider();
     return Modules.combine(
-        DbModule.testModuleWithWorkQueue(PLAIN, Optional.of(new InMemStoresModule(PLAIN))),
+        DbModule.testModuleWithWorkQueue(
+            PLAIN,
+            Optional.of(new InMemStoresModule(new DbModule.Options(), PLAIN))),
         new AbstractModule() {
           @Override
           protected void configure() {

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStoreTest.java b/src/test/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStoreTest.java
index 26fe429..91e591f 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStoreTest.java
@@ -40,7 +40,9 @@ public class MemCronJobStoreTest extends AbstractCronJobStoreTest {
   protected Module getStorageModule() {
     statsProvider = new FakeStatsProvider();
     return Modules.combine(
-        DbModule.testModuleWithWorkQueue(PLAIN, Optional.of(new InMemStoresModule(PLAIN))),
+        DbModule.testModuleWithWorkQueue(
+            PLAIN,
+            Optional.of(new InMemStoresModule(new DbModule.Options(), PLAIN))),
         new AbstractModule() {
           @Override
           protected void configure() {

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java b/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
index 6b4b17f..2cd19d5 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
@@ -14,10 +14,10 @@
 package org.apache.aurora.scheduler.thrift;
 
 import java.util.Optional;
+
 import javax.inject.Singleton;
 
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMultimap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.inject.AbstractModule;
@@ -47,6 +47,7 @@ import org.apache.aurora.scheduler.app.SchedulerMain;
 import org.apache.aurora.scheduler.app.ServiceGroupMonitor;
 import org.apache.aurora.scheduler.app.local.FakeNonVolatileStorage;
 import org.apache.aurora.scheduler.base.TaskTestUtil;
+import org.apache.aurora.scheduler.config.CliOptions;
 import org.apache.aurora.scheduler.configuration.ConfigurationManager.ConfigurationManagerSettings;
 import org.apache.aurora.scheduler.configuration.executor.ExecutorSettings;
 import org.apache.aurora.scheduler.cron.quartz.CronModule;
@@ -58,6 +59,7 @@ import org.apache.aurora.scheduler.mesos.FrameworkInfoFactory.FrameworkInfoFacto
 import org.apache.aurora.scheduler.mesos.TestExecutorSettings;
 import org.apache.aurora.scheduler.quota.QuotaModule;
 import org.apache.aurora.scheduler.resources.ResourceTestUtil;
+import org.apache.aurora.scheduler.resources.ResourceType;
 import org.apache.aurora.scheduler.stats.StatsModule;
 import org.apache.aurora.scheduler.storage.Storage;
 import org.apache.aurora.scheduler.storage.Storage.NonVolatileStorage;
@@ -67,12 +69,13 @@ import org.apache.aurora.scheduler.storage.db.DbModule;
 import org.apache.aurora.scheduler.storage.entities.IResourceAggregate;
 import org.apache.aurora.scheduler.storage.entities.IServerInfo;
 import org.apache.aurora.scheduler.thrift.aop.AnnotatedAuroraAdmin;
+import org.apache.aurora.scheduler.thrift.aop.AopModule;
 import org.apache.mesos.v1.Protos.FrameworkInfo;
 import org.apache.shiro.subject.Subject;
 import org.junit.Test;
 
 import static org.apache.aurora.gen.ResponseCode.OK;
-import static org.apache.aurora.scheduler.app.SchedulerMain.DriverKind.SCHEDULER_DRIVER;
+import static org.apache.aurora.scheduler.app.SchedulerMain.Options.DriverKind.SCHEDULER_DRIVER;
 import static org.junit.Assert.assertEquals;
 
 public class ThriftIT extends EasyMockTest {
@@ -84,8 +87,11 @@ public class ThriftIT extends EasyMockTest {
   private AuroraAdmin.Iface thrift;
 
   private void createThrift(ConfigurationManagerSettings configurationManagerSettings) {
+    ResourceType.initializeEmptyCliArgsForTest();
+    CliOptions options = new CliOptions();
     Injector injector = Guice.createInjector(
         new ThriftModule(),
+        new AopModule(options),
         new AbstractModule() {
           private <T> T bindMock(Class<T> clazz) {
             T mock = createMock(clazz);
@@ -95,16 +101,17 @@ public class ThriftIT extends EasyMockTest {
 
           @Override
           protected void configure() {
+            bind(CliOptions.class).toInstance(options);
             install(new LifecycleModule());
-            install(new StatsModule());
+            install(new StatsModule(options.stats));
             install(DbModule.testModule());
             install(new QuotaModule());
-            install(new CronModule());
+            install(new CronModule(options.cron));
             install(new TierModule(TaskTestUtil.TIER_CONFIG));
             bind(ExecutorSettings.class).toInstance(TestExecutorSettings.THERMOS_EXECUTOR);
 
-            install(new AppModule(configurationManagerSettings, SCHEDULER_DRIVER));
-            install(new SchedulerMain.ProtocolModule());
+            install(new AppModule(configurationManagerSettings, SCHEDULER_DRIVER, options));
+            install(new SchedulerMain.ProtocolModule(new SchedulerMain.Options()));
 
             bind(NonVolatileStorage.class).to(FakeNonVolatileStorage.class);
 
@@ -166,7 +173,7 @@ public class ThriftIT extends EasyMockTest {
     ConfigurationManagerSettings configurationManagerSettings = new ConfigurationManagerSettings(
         ImmutableSet.of(_Fields.DOCKER),
         true,
-        ImmutableMultimap.of(),
+        ImmutableList.of(),
         false,
         true,
         true,

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java b/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
index 04a6e1e..453366e 100644
--- a/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/updater/JobUpdaterIT.java
@@ -68,6 +68,7 @@ import org.apache.aurora.scheduler.base.JobKeys;
 import org.apache.aurora.scheduler.base.Query;
 import org.apache.aurora.scheduler.base.TaskTestUtil;
 import org.apache.aurora.scheduler.base.Tasks;
+import org.apache.aurora.scheduler.config.types.TimeAmount;
 import org.apache.aurora.scheduler.events.EventSink;
 import org.apache.aurora.scheduler.events.PubsubEvent;
 import org.apache.aurora.scheduler.mesos.Driver;
@@ -141,7 +142,7 @@ public class JobUpdaterIT extends EasyMockTest {
   private static final IJobUpdateKey UPDATE_ID =
       IJobUpdateKey.build(new JobUpdateKey(JOB.newBuilder(), "update_id"));
   private static final Amount<Long, Time> WATCH_TIMEOUT = Amount.of(2000L, Time.MILLISECONDS);
-  private static final Amount<Long, Time> FLAPPING_THRESHOLD = Amount.of(1L, Time.MILLISECONDS);
+  private static final TimeAmount FLAPPING_THRESHOLD = new TimeAmount(1L, Time.MILLISECONDS);
   private static final Amount<Long, Time> ONE_DAY = Amount.of(1L, Time.DAYS);
   private static final Amount<Long, Time> ONE_HOUR = Amount.of(1L, Time.HOURS);
   private static final Amount<Long, Time> ONE_MINUTE = Amount.of(1L, Time.MINUTES);
@@ -179,8 +180,11 @@ public class JobUpdaterIT extends EasyMockTest {
     eventBus = new EventBus();
     TaskEventBatchWorker batchWorker = createMock(TaskEventBatchWorker.class);
 
+    UpdaterModule.Options options = new UpdaterModule.Options();
+    options.enableAffinity = true;
+
     Injector injector = Guice.createInjector(
-        new UpdaterModule(executor, true),
+        new UpdaterModule(executor, options),
         DbModule.testModuleWithWorkQueue(),
         new AbstractModule() {
           @Override
@@ -196,7 +200,7 @@ public class JobUpdaterIT extends EasyMockTest {
                     new TruncatedBinaryBackoff(
                         Amount.of(1L, Time.SECONDS), Amount.of(1L, Time.MINUTES)),
                     FLAPPING_THRESHOLD,
-                    Amount.of(1, Time.MINUTES)));
+                    new TimeAmount(1, Time.MINUTES)));
             bind(EventSink.class).toInstance(eventBus::post);
             bind(LockManager.class).to(LockManagerImpl.class);
             bind(UUIDGenerator.class).to(UUIDGeneratorImpl.class);

http://git-wip-us.apache.org/repos/asf/aurora/blob/519e3df7/src/test/sh/org/apache/aurora/e2e/Dockerfile.python
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/Dockerfile.python b/src/test/sh/org/apache/aurora/e2e/Dockerfile.python
index 86eac35..96be893 100644
--- a/src/test/sh/org/apache/aurora/e2e/Dockerfile.python
+++ b/src/test/sh/org/apache/aurora/e2e/Dockerfile.python
@@ -12,6 +12,6 @@
 # limitations under the License.
 #
 
-FROM python:2.7
+FROM python:2.7-slim
 
-COPY http_example.py /tmp/
\ No newline at end of file
+COPY http_example.py /tmp/


Mime
View raw message