private static void updateDerivedConfigs(final Props azkabanSettings) { final boolean isSslEnabled = azkabanSettings.getBoolean("jetty.use.ssl", true); final int port = isSslEnabled ? azkabanSettings.getInt("jetty.ssl.port", DEFAULT_SSL_PORT_NUMBER) : azkabanSettings.getInt("jetty.port", DEFAULT_PORT_NUMBER); // setting stats configuration for connectors final String hostname = azkabanSettings.getString("jetty.hostname", "localhost"); azkabanSettings.put("server.hostname", hostname); azkabanSettings.put("server.port", port); azkabanSettings.put("server.useSSL", String.valueOf(isSslEnabled)); }
/** * this job should fail because it sets user.to.proxy = root which is black listed */ @Test(expected = RuntimeException.class) public void testOneUnixCommandWithRootUser() throws Exception { // Initialize the Props this.props.removeLocal(CommonJobProperties.SUBMIT_USER); this.props.put(JobProperties.USER_TO_PROXY, "root"); this.props.put("execute.as.user", "true"); this.props.put(ProcessJob.COMMAND, "ls -al"); this.job.run(); }
/** * this job should fail because it sets user.to.proxy = azkaban which is black listed */ @Test(expected = RuntimeException.class) public void testOneUnixCommandWithAzkabanUser() throws Exception { // Initialize the Props this.props.removeLocal(CommonJobProperties.SUBMIT_USER); this.props.put(JobProperties.USER_TO_PROXY, "azkaban"); this.props.put("execute.as.user", "true"); this.props.put(ProcessJob.COMMAND, "ls -al"); this.job.run(); }
private ExecutorManager createMultiExecutorManagerInstance() throws Exception { this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true"); this.props.put(Constants.ConfigurationKeys.QUEUEPROCESSING_ENABLED, "false"); this.loader.addExecutor("localhost", 12345); this.loader.addExecutor("localhost", 12346); return createExecutorManager(); }
/** * this job should run fine if the props contain user.to.proxy */ @Test public void testOneUnixCommandWithProxyUserInsteadOfSubmitUser() throws Exception { // Initialize the Props this.props.removeLocal(CommonJobProperties.SUBMIT_USER); this.props.put(JobProperties.USER_TO_PROXY, "test_user"); this.props.put(ProcessJob.COMMAND, "ls -al"); this.job.run(); }
@Test public void testLocalExecutorScenario() { this.props.put(ConfigurationKeys.EXECUTOR_PORT, 12345); final Throwable thrown = catchThrowable(() -> createExecutorManager()); assertThat(thrown).isInstanceOf(IllegalArgumentException.class); assertThat(thrown.getMessage()).isEqualTo( "azkaban.use.multiple.executors must be true. Single executor mode is not supported any more."); }
@Test public void testOneUnixCommand() throws Exception { // Initialize the Props this.props.put(ProcessJob.COMMAND, "ls -al"); this.job.run(); }
@Before public void setup() { this.serverProps = new Props(); this.serverProps .put(MAX_CALLBACK_COUNT_PROPERTY_KEY, DEFAULT_MAX_CALLBACK_COUNT); }
/** * Make sure that URLs for analyzers and logviewers are fetched correctly by setting it manually * and then fetching them */ @Test public void testFetchURL() { this.azkProps.put(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_TOPIC_URL .replace("${topic}", "someTopic"), "This is a link"); assertTrue( ExternalLinkUtils.getURLForTopic("someTopic", this.azkProps).equals("This is a link")); } }
@Before public void setUp() { // Empty server configuration this.azkProps = new Props(); // Job configuration consisting of only an exec id and job id this.jobProps = new Props(); this.jobProps.put(Constants.FlowProperties.AZKABAN_FLOW_EXEC_ID, 1); this.jobId = "Some + job"; this.mockRequest = mock(HttpServletRequest.class); }
@Test public void testFailedUnixCommand() throws Exception { // Initialize the Props this.props.put(ProcessJob.COMMAND, "xls -al"); try { this.job.run(); } catch (final RuntimeException e) { Assert.assertTrue(true); e.printStackTrace(); } }
@Before public void setUp() throws Exception { final Props props = new Props(); props.put(PROJECT_TEMP_DIR, this.TEMP_DIR.getRoot().getAbsolutePath()); this.storageManager = mock(StorageManager.class); this.projectLoader = mock(ProjectLoader.class); this.executorLoader = mock(ExecutorLoader.class); this.azkabanProjectLoader = new AzkabanProjectLoader(props, this.projectLoader, this.storageManager, new FlowLoaderFactory(props), this.executorLoader); }
/** * this job should fail because there is no user.to.proxy and no CommonJobProperties.SUBMIT_USER */ @Test(expected = RuntimeException.class) public void testOneUnixCommandWithNoUser() throws Exception { // Initialize the Props this.props.removeLocal(CommonJobProperties.SUBMIT_USER); this.props.put(ProcessJob.COMMAND, "ls -al"); this.job.run(); }
public static UserManager createTestXmlUserManager() { final Props props = new Props(); props.put(XmlUserManager.XML_FILE_PARAM, ExecutionsTestUtil.getDataRootDir() + "azkaban-users.xml"); final UserManager manager = new XmlUserManager(props); return manager; }
@Test public void testNoCleanupCase2() throws Exception { final Props props = new Props(); props.put(AZKABAN_STORAGE_ARTIFACT_MAX_RETENTION, 10); final StorageCleaner storageCleaner = new StorageCleaner(props, this.storage, this.databaseOperator); assertTrue(storageCleaner.isCleanupPermitted()); storageCleaner.cleanupProjectArtifacts(TEST_PROJECT_ID); verify(this.storage, never()).delete(anyString()); }
@Test public void testMultipleExecutorScenario() throws Exception { this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true"); final Executor executor1 = this.loader.addExecutor("localhost", 12345); final Executor executor2 = this.loader.addExecutor("localhost", 12346); final ExecutorManager manager = createExecutorManager(); final Set<Executor> activeExecutors = new HashSet(manager.getAllActiveExecutors()); Assert.assertArrayEquals(activeExecutors.toArray(), new Executor[]{ executor1, executor2}); }