5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-17 01:11:07 +08:00

SQOOP-143. Simplify test configuration.

This change removes the test that asserts the presence of a non-default hosts
file configuration. It also adds the necessary comments to the PostgresqlTest
to allow configuring the server for default hosts file configuration.

From: Arvind Prabhakar <arvind@cloudera.com>

git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1150003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Bayer 2011-07-22 20:04:25 +00:00
parent 1d5b7011a9
commit fbb283f54d
4 changed files with 11 additions and 75 deletions

View File

@ -349,10 +349,8 @@ public void importTable(ImportJobContext context)
}
}
if (!DirectImportUtils.isLocalhost(hostname)) {
args.add("--host");
args.add(hostname);
}
args.add("--host");
args.add(hostname);
if (port != -1) {
args.add("--port");

View File

@ -35,7 +35,6 @@
import com.cloudera.sqoop.metastore.TestSavedJobs;
import com.cloudera.sqoop.orm.TestClassWriter;
import com.cloudera.sqoop.orm.TestParseMethods;
import com.cloudera.sqoop.util.TestDirectImportUtils;
import junit.framework.Test;
import junit.framework.TestSuite;
@ -74,7 +73,6 @@ public static Test suite() {
suite.addTestSuite(TestBlobRef.class);
suite.addTestSuite(TestClobRef.class);
suite.addTestSuite(TestLargeObjectLoader.class);
suite.addTestSuite(TestDirectImportUtils.class);
suite.addTestSuite(TestLobFile.class);
suite.addTestSuite(TestExportUpdate.class);
suite.addTestSuite(TestSavedJobs.class);

View File

@ -57,8 +57,14 @@
* following in /etc/postgresql/8.3/main/pg_hba.conf:
* local all all trust
* host all all 127.0.0.1/32 trust
*
* ... and comment out any other lines referencing 127.0.0.1.
* host all all ::1/128 trust
*
* ... and comment out any other lines referencing 127.0.0.1 or ::1.
*
* Also in the file /etc/postgresql/8.3/main/postgresql.conf, uncomment
* the line that starts with listen_addresses and set its value to '*' as
* follows
* listen_address = '*'
*
* For postgresql 8.1, this may be in /var/lib/pgsql/data, instead. You may
* need to restart the postgresql service after modifying this file.
@ -107,7 +113,7 @@ public void setUp() {
connection.setAutoCommit(false);
st = connection.createStatement();
// create the database table and populate it with data.
// create the database table and populate it with data.
try {
// Try to remove the table first. DROP TABLE IF EXISTS didn't

View File

@ -1,66 +0,0 @@
/**
* Licensed to Cloudera, Inc. under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Cloudera, Inc. licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.cloudera.sqoop.util;
import java.net.InetAddress;
import java.net.UnknownHostException;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Test that /etc/hosts is configured sanely.
* If this fails, then the postgresql direct tests will likely fail.
*
* In particular, 'localhost' needs to resolve to 127.0.0.1.
* The /etc/hosts file should contain a line like:
*
* 127.0.0.1 (yourhostnamehere) localhost
*
* e.g.:
* 127.0.0.1 aaron-laptop localhost
* 127.0.1.1 aaron-laptop
* ...
*
* If it doesn't have 'localhost' on that line, it'll fail.
*/
public class TestDirectImportUtils extends TestCase {
public static final Log LOG = LogFactory.getLog(
TestDirectImportUtils.class.getName());
public void testLocalhost() throws UnknownHostException {
InetAddress localHostAddr = InetAddress.getLocalHost();
LOG.info("Advertised localhost address: " + localHostAddr);
InetAddress requestAddr = InetAddress.getByName("localhost");
LOG.info("Requested localhost address: " + requestAddr);
assertTrue("Requested addr does not identify as localhost. "
+ "Check /etc/hosts (see TestDirectImportUtils comments)",
localHostAddr.equals(requestAddr));
assertTrue("Couldn't match 'localhost' to localhost; "
+ "check /etc/hosts (see TestDirectImportUtils comments)",
DirectImportUtils.isLocalhost("localhost"));
}
}