Search in sources :

Example 11 with ValidationTaskResult

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

the class HdfsProxyUserValidationTaskTest method proxyUserNotWildcard.

@Test
public void proxyUserNotWildcard() {
    String userName = System.getProperty("user.name");
    // Configured proxy users and groups, but not wildcard
    String proxyUserKey = String.format("hadoop.proxyuser.%s.users", userName);
    String proxyGroupKey = String.format("hadoop.proxyuser.%s.groups", userName);
    prepareHdfsConfFiles(ImmutableMap.of(proxyUserKey, "user1,user2", proxyGroupKey, "groups"));
    HdfsProxyUserValidationTask task = new HdfsProxyUserValidationTask("hdfs://namenode:9000/alluxio", mConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.WARNING, result.getState());
    assertThat(result.getResult(), containsString(String.format("%s=user1,user2 and %s=groups", proxyUserKey, proxyGroupKey)));
    assertThat(result.getAdvice(), containsString("Please make sure that includes all users/groups Alluxio needs to impersonate as."));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test)

Example 12 with ValidationTaskResult

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

the class HdfsVersionValidationTaskTest method versionMatched.

@Test
public void versionMatched() throws Exception {
    PowerMockito.mockStatic(ShellUtils.class);
    String[] cmd = new String[] { "hadoop", "version" };
    BDDMockito.given(ShellUtils.execCommand(cmd)).willReturn("Hadoop 2.6");
    sConf.set(PropertyKey.UNDERFS_VERSION, "2.6");
    HdfsVersionValidationTask task = new HdfsVersionValidationTask(sConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.OK, result.getState());
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 13 with ValidationTaskResult

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

the class HdfsVersionValidationTaskTest method minorVersionAccepted.

@Test
public void minorVersionAccepted() throws Exception {
    PowerMockito.mockStatic(ShellUtils.class);
    String[] cmd = new String[] { "hadoop", "version" };
    // The minor version is not defined in Alluxio, which should work
    BDDMockito.given(ShellUtils.execCommand(cmd)).willReturn("Hadoop 2.6.2");
    sConf.set(PropertyKey.UNDERFS_VERSION, "2.6");
    HdfsVersionValidationTask task = new HdfsVersionValidationTask(sConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.OK, result.getState());
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 14 with ValidationTaskResult

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

the class HdfsVersionValidationTaskTest method versionNotMatchedDefault.

@Test
public void versionNotMatchedDefault() throws Exception {
    PowerMockito.mockStatic(ShellUtils.class);
    String[] cmd = new String[] { "hadoop", "version" };
    BDDMockito.given(ShellUtils.execCommand(cmd)).willReturn("Hadoop 2.2");
    HdfsVersionValidationTask task = new HdfsVersionValidationTask(sConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.FAILED, result.getState());
    assertThat(result.getResult(), containsString("2.2 does not match alluxio.underfs.version"));
    assertThat(result.getAdvice(), containsString("configure alluxio.underfs.version"));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 15 with ValidationTaskResult

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

the class HdfsVersionValidationTaskTest method minorVersionConflict.

@Test
public void minorVersionConflict() throws Exception {
    PowerMockito.mockStatic(ShellUtils.class);
    String[] cmd = new String[] { "hadoop", "version" };
    // Alluxio defines a different minor version, which should not work
    BDDMockito.given(ShellUtils.execCommand(cmd)).willReturn("Hadoop 2.6.2");
    sConf.set(PropertyKey.UNDERFS_VERSION, "2.6.3");
    HdfsVersionValidationTask task = new HdfsVersionValidationTask(sConf);
    ValidationTaskResult result = task.validateImpl(ImmutableMap.of());
    assertEquals(ValidationUtils.State.FAILED, result.getState());
    assertThat(result.getResult(), containsString("Hadoop version 2.6.2 does not match alluxio.underfs.version=2.6.3"));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ValidationTaskResult(alluxio.cli.ValidationTaskResult) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

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