예제 #1
0
static Modules getModules(const string& libraryName, const string& moduleName)
{
  Modules modules;
  Modules::Library* library = modules.add_libraries();
  library->set_file(os::libraries::expandName(libraryName));
  library->add_modules(moduleName);
  return modules;
}
예제 #2
0
 ModuleTest()
   : module(None())
 {
   Modules::Library* library = defaultModules.add_libraries();
   library->set_file(path::join(
       libraryDirectory,
       os::libraries::expandName(DEFAULT_MODULE_LIBRARY_NAME)));
   library->add_modules(DEFAULT_MODULE_NAME);
 }
예제 #3
0
// Test that loading a duplicate module fails.
TEST_F(ModuleTest, DuplicateModule)
{
  // Add duplicate module.
  Modules::Library* library = defaultModules.add_libraries();
  library->set_name(DEFAULT_MODULE_LIBRARY_NAME);
  library->add_modules(DEFAULT_MODULE_NAME);

  EXPECT_ERROR(ModuleManager::load(defaultModules));
}
예제 #4
0
// Test that a module library gets loaded with just library name if
// found in LD_LIBRARY_PATH.
TEST_F(ModuleTest, LibraryNameWithExtension)
{
  Modules modules;
  Modules::Library* library = modules.add_libraries();
  library->set_file(os::libraries::expandName(DEFAULT_MODULE_LIBRARY_NAME));
  library->add_modules(DEFAULT_MODULE_NAME);

  EXPECT_SOME(ModuleManager::load(modules));
}
예제 #5
0
// Add available Allocator modules.
static void addAllocatorModules(Modules* modules)
{
  CHECK_NOTNULL(modules);

  // Now add our allocator module.
  Modules::Library* library = modules->add_libraries();
  library->set_file(getModulePath("testallocator"));

  // To add a new module from this library, create a new ModuleID enum
  // and tie it with a module name.
  addModule(library, TestDRFAllocator, "org_apache_mesos_TestDRFAllocator");
}
예제 #6
0
// Add available ContainerLogger modules.
static void addContainerLoggerModules(Modules* modules)
{
  CHECK_NOTNULL(modules);

  const string libraryDirectory = path::join(
      tests::flags.build_dir,
      "src",
      ".libs");

  const string sandboxLoggerPath = path::join(
      libraryDirectory,
      os::libraries::expandName("testcontainer_logger"));

  // Add our test container logger module.
  Modules::Library* library = modules->add_libraries();
  library->set_file(sandboxLoggerPath);

  // To add a new module from this library, create a new ModuleID enum
  // and tie it with a module name.
  addModule(library,
            TestSandboxContainerLogger,
            "org_apache_mesos_TestSandboxContainerLogger");

  const string logrotateLoggerPath = path::join(
      libraryDirectory,
      os::libraries::expandName("logrotate_container_logger"));

  // Add the second container logger module.
  library = modules->add_libraries();
  library->set_file(logrotateLoggerPath);

  addModule(library,
            LogrotateContainerLogger,
            "org_apache_mesos_LogrotateContainerLogger");

  // Pass in the directory for the binary test sources.
  Modules::Library::Module* module = library->mutable_modules(0);
  mesos::Parameter* moduleParameter = module->add_parameters();
  moduleParameter->set_key("launcher_dir");
  moduleParameter->set_value(path::join(tests::flags.build_dir, "src"));

  // Set the size and number of log files to keep.
  moduleParameter = module->add_parameters();
  moduleParameter->set_key("max_stdout_size");
  moduleParameter->set_value(stringify(Megabytes(2)));

  // NOTE: This is a 'logrotate' configuration option.
  // It means to "rotate" a file 4 times before removal.
  moduleParameter = module->add_parameters();
  moduleParameter->set_key("logrotate_stdout_options");
  moduleParameter->set_value("rotate 4");
}
예제 #7
0
// Add available Isolator modules.
static void addIsolatorModules(Modules* modules)
{
  CHECK_NOTNULL(modules);

  // Now add our test CPU and Memory isolator modules.
  Modules::Library* library = modules->add_libraries();
  library->set_file(getModulePath("testisolator"));

  // To add a new module from this library, create a new ModuleID enum
  // and tie it with a module name.
  addModule(library, TestCpuIsolator, "org_apache_mesos_TestCpuIsolator");
  addModule(library, TestMemIsolator, "org_apache_mesos_TestMemIsolator");
}
예제 #8
0
// Add available Authentication modules.
static void addAuthenticationModules(Modules* modules)
{
  CHECK_NOTNULL(modules);

  // Now add our test authentication modules.
  Modules::Library* library = modules->add_libraries();
  library->set_file(getModulePath("testauthentication"));

  // To add a new module from this library, create a new ModuleID enum
  // and tie it with a module name.
  addModule(library,
            TestCRAMMD5Authenticatee,
            "org_apache_mesos_TestCRAMMD5Authenticatee");
  addModule(library,
            TestCRAMMD5Authenticator,
            "org_apache_mesos_TestCRAMMD5Authenticator");
}
예제 #9
0
// Add available Allocator modules.
static void addAllocatorModules(Modules* modules)
{
  CHECK_NOTNULL(modules);

  const string libraryPath = path::join(
      tests::flags.build_dir,
      "src",
      ".libs",
      os::libraries::expandName("testallocator"));

  // Now add our allocator module.
  Modules::Library* library = modules->add_libraries();
  library->set_file(libraryPath);

  // To add a new module from this library, create a new ModuleID enum
  // and tie it with a module name.
  addModule(library, TestDRFAllocator, "org_apache_mesos_TestDRFAllocator");
}