Search in sources :

Example 6 with ValidationTaskResult

use of alluxio.cli.ValidationTaskResult in project alluxio by Alluxio.

the class HdfsConfValidationTaskTest method missingBoth.

@Test
public void missingBoth() {
    sConf.set(PropertyKey.UNDERFS_HDFS_CONFIGURATION, "/conf/");
    HdfsConfValidationTask task = new HdfsConfValidationTask("hdfs://namenode:9000/alluxio", sConf);
    ValidationTaskResult result = task.loadHdfsConfig();
    assertEquals(result.getState(), ValidationUtils.State.SKIPPED);
    assertThat(result.getResult(), containsString("hdfs-site.xml is not configured"));
    assertThat(result.getResult(), containsString("core-site.xml is not configured"));
    assertThat(result.getAdvice(), containsString("hdfs-site.xml"));
    assertThat(result.getAdvice(), containsString("core-site.xml"));
}
Also used : ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test)

Example 7 with ValidationTaskResult

use of alluxio.cli.ValidationTaskResult in project alluxio by Alluxio.

the class HdfsConfValidationTaskTest method loadedConf.

@Test
public void loadedConf() {
    String hdfsSite = Paths.get(sTestDir.toPath().toString(), "hdfs-site.xml").toString();
    ValidationTestUtils.writeXML(hdfsSite, ImmutableMap.of("key2", "value2"));
    String coreSite = Paths.get(sTestDir.toPath().toString(), "core-site.xml").toString();
    ValidationTestUtils.writeXML(coreSite, ImmutableMap.of("key1", "value1"));
    sConf.set(PropertyKey.UNDERFS_HDFS_CONFIGURATION, hdfsSite + HdfsConfValidationTask.SEPARATOR + coreSite);
    HdfsConfValidationTask task = new HdfsConfValidationTask("hdfs://namenode:9000/alluxio", sConf);
    ValidationTaskResult result = task.loadHdfsConfig();
    assertEquals(result.getState(), ValidationUtils.State.OK);
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test)

Example 8 with ValidationTaskResult

use of alluxio.cli.ValidationTaskResult in project alluxio by Alluxio.

the class HdfsConfValidationTaskTest method inconsistentConf.

@Test
public void inconsistentConf() {
    String hdfsSite = Paths.get(sTestDir.toPath().toString(), "hdfs-site.xml").toString();
    ValidationTestUtils.writeXML(hdfsSite, ImmutableMap.of("key1", "value2"));
    String coreSite = Paths.get(sTestDir.toPath().toString(), "core-site.xml").toString();
    ValidationTestUtils.writeXML(coreSite, ImmutableMap.of("key1", "value1"));
    sConf.set(PropertyKey.UNDERFS_HDFS_CONFIGURATION, hdfsSite + HdfsConfValidationTask.SEPARATOR + coreSite);
    HdfsConfValidationTask task = new HdfsConfValidationTask("hdfs://namenode:9000/alluxio", sConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.FAILED, result.getState());
    assertThat(result.getResult(), containsString("key1"));
    assertThat(result.getResult(), containsString("value1 in core-site.xml"));
    assertThat(result.getResult(), containsString("value2 in hdfs-site.xml"));
    assertThat(result.getAdvice(), containsString("fix the inconsistency"));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test)

Example 9 with ValidationTaskResult

use of alluxio.cli.ValidationTaskResult in project alluxio by Alluxio.

the class HdfsProxyUserValidationTaskTest method proxyUsersAndGroupsAllMissing.

@Test
public void proxyUsersAndGroupsAllMissing() {
    String userName = System.getProperty("user.name");
    // Proxyuser configured for bob, not the running user
    prepareHdfsConfFiles(ImmutableMap.of("hadoop.proxyuser.bob.users", "user1,user3", "hadoop.proxyuser.bob.groups", "*"));
    HdfsProxyUserValidationTask task = new HdfsProxyUserValidationTask("hdfs://namenode:9000/alluxio", mConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.FAILED, result.getState());
    assertThat(result.getResult(), containsString("Alluxio is not able to perform impersonation."));
    assertThat(result.getAdvice(), containsString(String.format("Please enable Alluxio user %s to impersonate", userName)));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test)

Example 10 with ValidationTaskResult

use of alluxio.cli.ValidationTaskResult in project alluxio by Alluxio.

the class HdfsProxyUserValidationTaskTest method missingProxyUser.

@Test
public void missingProxyUser() {
    String userName = System.getProperty("user.name");
    // No proxy user definition in core-site.xml
    prepareHdfsConfFiles(ImmutableMap.of("key1", "value1"));
    HdfsProxyUserValidationTask task = new HdfsProxyUserValidationTask("hdfs://namenode:9000/alluxio", mConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.FAILED, result.getState());
    assertThat(result.getResult(), containsString("Alluxio is not able to perform impersonation."));
    assertThat(result.getAdvice(), containsString(String.format("Please enable Alluxio user %s to impersonate", userName)));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test)

Aggregations

ValidationTaskResult (alluxio.cli.ValidationTaskResult)28 Test (org.junit.Test)19 StringContains.containsString (org.hamcrest.core.StringContains.containsString)16 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 Pair (alluxio.collections.Pair)4 IOException (java.io.IOException)3 IMetaStoreClient (org.apache.hadoop.hive.metastore.IMetaStoreClient)3 List (java.util.List)2 AbstractValidationTask (alluxio.cli.AbstractValidationTask)1 ApplicableUfsType (alluxio.cli.ApplicableUfsType)1 ValidationUtils (alluxio.cli.ValidationUtils)1 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)1 PropertyKey (alluxio.conf.PropertyKey)1 InvalidPathException (alluxio.exception.InvalidPathException)1 ValidationResult (alluxio.hub.proto.ValidationResult)1 BaseHubTest (alluxio.hub.test.BaseHubTest)1 PathUtils (alluxio.util.io.PathUtils)1 RandomAccessFile (java.io.RandomAccessFile)1 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 URI (java.net.URI)1