HADOOP-11535 TableMapping related tests failed due to 'successful' resolving of invalid test hostname
This commit is contained in:
parent
644548f201
commit
1425e3d37c
@ -873,6 +873,9 @@ Release 2.7.0 - UNRELEASED
|
|||||||
HADOOP-11526. Memory leak in Bzip2Compressor and Bzip2Decompressor.
|
HADOOP-11526. Memory leak in Bzip2Compressor and Bzip2Decompressor.
|
||||||
(Anu Engineer via cnauroth)
|
(Anu Engineer via cnauroth)
|
||||||
|
|
||||||
|
HADOOP-11535 TableMapping related tests failed due to 'successful'
|
||||||
|
resolving of invalid test hostname. (Kai Zheng via stevel)
|
||||||
|
|
||||||
Release 2.6.1 - UNRELEASED
|
Release 2.6.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -34,12 +34,15 @@
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestTableMapping {
|
public class TestTableMapping {
|
||||||
|
private String hostName1 = "1.2.3.4";
|
||||||
|
private String hostName2 = "5.6.7.8";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testResolve() throws IOException {
|
public void testResolve() throws IOException {
|
||||||
File mapFile = File.createTempFile(getClass().getSimpleName() +
|
File mapFile = File.createTempFile(getClass().getSimpleName() +
|
||||||
".testResolve", ".txt");
|
".testResolve", ".txt");
|
||||||
Files.write("a.b.c /rack1\n" +
|
Files.write(hostName1 + " /rack1\n" +
|
||||||
"1.2.3.4\t/rack2\n", mapFile, Charsets.UTF_8);
|
hostName2 + "\t/rack2\n", mapFile, Charsets.UTF_8);
|
||||||
mapFile.deleteOnExit();
|
mapFile.deleteOnExit();
|
||||||
TableMapping mapping = new TableMapping();
|
TableMapping mapping = new TableMapping();
|
||||||
|
|
||||||
@ -48,8 +51,8 @@ public void testResolve() throws IOException {
|
|||||||
mapping.setConf(conf);
|
mapping.setConf(conf);
|
||||||
|
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
names.add("a.b.c");
|
names.add(hostName1);
|
||||||
names.add("1.2.3.4");
|
names.add(hostName2);
|
||||||
|
|
||||||
List<String> result = mapping.resolve(names);
|
List<String> result = mapping.resolve(names);
|
||||||
assertEquals(names.size(), result.size());
|
assertEquals(names.size(), result.size());
|
||||||
@ -61,8 +64,8 @@ public void testResolve() throws IOException {
|
|||||||
public void testTableCaching() throws IOException {
|
public void testTableCaching() throws IOException {
|
||||||
File mapFile = File.createTempFile(getClass().getSimpleName() +
|
File mapFile = File.createTempFile(getClass().getSimpleName() +
|
||||||
".testTableCaching", ".txt");
|
".testTableCaching", ".txt");
|
||||||
Files.write("a.b.c /rack1\n" +
|
Files.write(hostName1 + " /rack1\n" +
|
||||||
"1.2.3.4\t/rack2\n", mapFile, Charsets.UTF_8);
|
hostName2 + "\t/rack2\n", mapFile, Charsets.UTF_8);
|
||||||
mapFile.deleteOnExit();
|
mapFile.deleteOnExit();
|
||||||
TableMapping mapping = new TableMapping();
|
TableMapping mapping = new TableMapping();
|
||||||
|
|
||||||
@ -71,8 +74,8 @@ public void testTableCaching() throws IOException {
|
|||||||
mapping.setConf(conf);
|
mapping.setConf(conf);
|
||||||
|
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
names.add("a.b.c");
|
names.add(hostName1);
|
||||||
names.add("1.2.3.4");
|
names.add(hostName2);
|
||||||
|
|
||||||
List<String> result1 = mapping.resolve(names);
|
List<String> result1 = mapping.resolve(names);
|
||||||
assertEquals(names.size(), result1.size());
|
assertEquals(names.size(), result1.size());
|
||||||
@ -94,8 +97,8 @@ public void testNoFile() {
|
|||||||
mapping.setConf(conf);
|
mapping.setConf(conf);
|
||||||
|
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
names.add("a.b.c");
|
names.add(hostName1);
|
||||||
names.add("1.2.3.4");
|
names.add(hostName2);
|
||||||
|
|
||||||
List<String> result = mapping.resolve(names);
|
List<String> result = mapping.resolve(names);
|
||||||
assertEquals(names.size(), result.size());
|
assertEquals(names.size(), result.size());
|
||||||
@ -112,8 +115,8 @@ public void testFileDoesNotExist() {
|
|||||||
mapping.setConf(conf);
|
mapping.setConf(conf);
|
||||||
|
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
names.add("a.b.c");
|
names.add(hostName1);
|
||||||
names.add("1.2.3.4");
|
names.add(hostName2);
|
||||||
|
|
||||||
List<String> result = mapping.resolve(names);
|
List<String> result = mapping.resolve(names);
|
||||||
assertEquals(names.size(), result.size());
|
assertEquals(names.size(), result.size());
|
||||||
@ -125,8 +128,8 @@ public void testFileDoesNotExist() {
|
|||||||
public void testClearingCachedMappings() throws IOException {
|
public void testClearingCachedMappings() throws IOException {
|
||||||
File mapFile = File.createTempFile(getClass().getSimpleName() +
|
File mapFile = File.createTempFile(getClass().getSimpleName() +
|
||||||
".testClearingCachedMappings", ".txt");
|
".testClearingCachedMappings", ".txt");
|
||||||
Files.write("a.b.c /rack1\n" +
|
Files.write(hostName1 + " /rack1\n" +
|
||||||
"1.2.3.4\t/rack2\n", mapFile, Charsets.UTF_8);
|
hostName2 + "\t/rack2\n", mapFile, Charsets.UTF_8);
|
||||||
mapFile.deleteOnExit();
|
mapFile.deleteOnExit();
|
||||||
|
|
||||||
TableMapping mapping = new TableMapping();
|
TableMapping mapping = new TableMapping();
|
||||||
@ -136,8 +139,8 @@ public void testClearingCachedMappings() throws IOException {
|
|||||||
mapping.setConf(conf);
|
mapping.setConf(conf);
|
||||||
|
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
names.add("a.b.c");
|
names.add(hostName1);
|
||||||
names.add("1.2.3.4");
|
names.add(hostName2);
|
||||||
|
|
||||||
List<String> result = mapping.resolve(names);
|
List<String> result = mapping.resolve(names);
|
||||||
assertEquals(names.size(), result.size());
|
assertEquals(names.size(), result.size());
|
||||||
@ -149,8 +152,8 @@ public void testClearingCachedMappings() throws IOException {
|
|||||||
mapping.reloadCachedMappings();
|
mapping.reloadCachedMappings();
|
||||||
|
|
||||||
names = new ArrayList<String>();
|
names = new ArrayList<String>();
|
||||||
names.add("a.b.c");
|
names.add(hostName1);
|
||||||
names.add("1.2.3.4");
|
names.add(hostName2);
|
||||||
|
|
||||||
result = mapping.resolve(names);
|
result = mapping.resolve(names);
|
||||||
assertEquals(names.size(), result.size());
|
assertEquals(names.size(), result.size());
|
||||||
@ -172,8 +175,8 @@ public void testBadFile() throws IOException {
|
|||||||
mapping.setConf(conf);
|
mapping.setConf(conf);
|
||||||
|
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
names.add("a.b.c");
|
names.add(hostName1);
|
||||||
names.add("1.2.3.4");
|
names.add(hostName2);
|
||||||
|
|
||||||
List<String> result = mapping.resolve(names);
|
List<String> result = mapping.resolve(names);
|
||||||
assertEquals(names.size(), result.size());
|
assertEquals(names.size(), result.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user