Search in sources :

Example 1 with NoopJournalSystem

use of alluxio.master.journal.noop.NoopJournalSystem in project alluxio by Alluxio.

the class BlockMasterTest method before.

/**
 * Sets up the dependencies before a test runs.
 */
@Before
public void before() throws Exception {
    mRegistry = new MasterRegistry();
    mMetrics = Lists.newArrayList();
    JournalSystem journalSystem = new NoopJournalSystem();
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext();
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
    mClock = new ManualClock();
    mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestBlockMaster-%d", true));
    mBlockMaster = new DefaultBlockMaster(mMetricsMaster, masterContext, mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
    mRegistry.add(BlockMaster.class, mBlockMaster);
    mRegistry.start(true);
}
Also used : ManualClock(alluxio.clock.ManualClock) CoreMasterContext(alluxio.master.CoreMasterContext) JournalSystem(alluxio.master.journal.JournalSystem) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MasterRegistry(alluxio.master.MasterRegistry) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Example 2 with NoopJournalSystem

use of alluxio.master.journal.noop.NoopJournalSystem in project alluxio by Alluxio.

the class AlluxioMasterProcessTest method stopAfterStandbyTransition.

@Test
@Ignore
public void stopAfterStandbyTransition() throws Exception {
    ControllablePrimarySelector primarySelector = new ControllablePrimarySelector();
    primarySelector.setState(PrimarySelector.State.PRIMARY);
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_EXIT_ON_DEMOTION, true);
    FaultTolerantAlluxioMasterProcess master = new FaultTolerantAlluxioMasterProcess(new NoopJournalSystem(), primarySelector);
    Thread t = new Thread(() -> {
        try {
            master.start();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    });
    t.start();
    waitForSocketServing(ServiceType.MASTER_RPC);
    waitForSocketServing(ServiceType.MASTER_WEB);
    assertTrue(isBound(mRpcPort));
    assertTrue(isBound(mWebPort));
    primarySelector.setState(PrimarySelector.State.STANDBY);
    t.join(10000);
    CommonUtils.waitFor("Master to be stopped", () -> !master.isRunning(), WaitForOptions.defaults().setTimeoutMs(3 * Constants.MINUTE_MS));
    CommonUtils.waitFor("Master to be stopped", () -> !isBound(mRpcPort), WaitForOptions.defaults().setTimeoutMs(Constants.MINUTE_MS));
    CommonUtils.waitFor("Master to be stopped", () -> !isBound(mWebPort), WaitForOptions.defaults().setTimeoutMs(Constants.MINUTE_MS));
}
Also used : NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) TimeoutException(java.util.concurrent.TimeoutException) BindException(java.net.BindException) ConnectException(java.net.ConnectException) ExpectedException(org.junit.rules.ExpectedException) IOException(java.io.IOException) UnavailableException(alluxio.exception.status.UnavailableException) PowerMockIgnore(org.powermock.core.classloader.annotations.PowerMockIgnore) Ignore(org.junit.Ignore) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with NoopJournalSystem

use of alluxio.master.journal.noop.NoopJournalSystem in project alluxio by Alluxio.

the class AlluxioMasterProcessTest method startStopStandby.

@Test
public void startStopStandby() throws Exception {
    FaultTolerantAlluxioMasterProcess master = new FaultTolerantAlluxioMasterProcess(new NoopJournalSystem(), new AlwaysStandbyPrimarySelector());
    Thread t = new Thread(() -> {
        try {
            master.start();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    });
    t.start();
    startStopTest(master, ServerConfiguration.getBoolean(PropertyKey.STANDBY_MASTER_WEB_ENABLED), ServerConfiguration.getBoolean(PropertyKey.STANDBY_MASTER_METRICS_SINK_ENABLED));
}
Also used : NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) TimeoutException(java.util.concurrent.TimeoutException) BindException(java.net.BindException) ConnectException(java.net.ConnectException) ExpectedException(org.junit.rules.ExpectedException) IOException(java.io.IOException) UnavailableException(alluxio.exception.status.UnavailableException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with NoopJournalSystem

use of alluxio.master.journal.noop.NoopJournalSystem in project alluxio by Alluxio.

the class PermissionCheckTest method before.

@Before
public void before() throws Exception {
    ServerConfiguration.set(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS, mTestFolder.newFolder());
    GroupMappingServiceTestUtils.resetCache();
    mRegistry = new MasterRegistry();
    mRegistry.add(MetricsMaster.class, mMetricsMaster);
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext(new NoopJournalSystem(), new TestUserState(TEST_USER_ADMIN.getUser(), ServerConfiguration.global()));
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
    new BlockMasterFactory().create(mRegistry, masterContext);
    mFileSystemMaster = new FileSystemMasterFactory().create(mRegistry, masterContext);
    mRegistry.start(true);
    createDirAndFileForTest();
}
Also used : BlockMasterFactory(alluxio.master.block.BlockMasterFactory) CoreMasterContext(alluxio.master.CoreMasterContext) TestUserState(alluxio.security.user.TestUserState) MasterRegistry(alluxio.master.MasterRegistry) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Example 5 with NoopJournalSystem

use of alluxio.master.journal.noop.NoopJournalSystem in project alluxio by Alluxio.

the class AlluxioMasterProcessTest method startMastersThrowsUnavailableException.

@Test
public void startMastersThrowsUnavailableException() throws InterruptedException, IOException {
    ControllablePrimarySelector primarySelector = new ControllablePrimarySelector();
    primarySelector.setState(PrimarySelector.State.PRIMARY);
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_EXIT_ON_DEMOTION, true);
    FaultTolerantAlluxioMasterProcess master = new FaultTolerantAlluxioMasterProcess(new NoopJournalSystem(), primarySelector);
    FaultTolerantAlluxioMasterProcess spy = PowerMockito.spy(master);
    PowerMockito.doAnswer(invocation -> {
        throw new UnavailableException("unavailable");
    }).when(spy).startMasters(true);
    AtomicBoolean success = new AtomicBoolean(true);
    Thread t = new Thread(() -> {
        try {
            spy.start();
        } catch (UnavailableException ue) {
            success.set(false);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    });
    t.start();
    // in ms
    final int WAIT_TIME_TO_THROW_EXC = 500;
    t.join(WAIT_TIME_TO_THROW_EXC);
    t.interrupt();
    Assert.assertTrue(success.get());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) UnavailableException(alluxio.exception.status.UnavailableException) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) TimeoutException(java.util.concurrent.TimeoutException) BindException(java.net.BindException) ConnectException(java.net.ConnectException) ExpectedException(org.junit.rules.ExpectedException) IOException(java.io.IOException) UnavailableException(alluxio.exception.status.UnavailableException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

NoopJournalSystem (alluxio.master.journal.noop.NoopJournalSystem)10 Test (org.junit.Test)7 UnavailableException (alluxio.exception.status.UnavailableException)4 MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)4 IOException (java.io.IOException)4 BindException (java.net.BindException)4 ConnectException (java.net.ConnectException)4 TimeoutException (java.util.concurrent.TimeoutException)4 Before (org.junit.Before)4 ExpectedException (org.junit.rules.ExpectedException)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 CoreMasterContext (alluxio.master.CoreMasterContext)3 MasterRegistry (alluxio.master.MasterRegistry)3 DefaultBlockMaster (alluxio.master.block.DefaultBlockMaster)2 MutableInodeFile (alluxio.master.file.meta.MutableInodeFile)2 HeapBlockStore (alluxio.master.metastore.heap.HeapBlockStore)2 HeapInodeStore (alluxio.master.metastore.heap.HeapInodeStore)2 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 ArrayList (java.util.ArrayList)2