Java Code Examples for org.apache.flink.core.testutils.CommonTestUtils#setEnv()

The following examples show how to use org.apache.flink.core.testutils.CommonTestUtils#setEnv() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlinkDistributionOverlayTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testBuilderFromEnvironment() throws Exception {
	Configuration conf = new Configuration();

	File binFolder = tempFolder.newFolder("bin");
	File libFolder = tempFolder.newFolder("lib");
	File confFolder = tempFolder.newFolder("conf");

	// adjust the test environment for the purposes of this test
	Map<String, String> map = new HashMap<String, String>(System.getenv());
	map.put(ENV_FLINK_BIN_DIR, binFolder.getAbsolutePath());
	map.put(ENV_FLINK_LIB_DIR, libFolder.getAbsolutePath());
	map.put(ENV_FLINK_CONF_DIR, confFolder.getAbsolutePath());
		CommonTestUtils.setEnv(map);

	FlinkDistributionOverlay.Builder builder = FlinkDistributionOverlay.newBuilder().fromEnvironment(conf);

	assertEquals(binFolder.getAbsolutePath(), builder.flinkBinPath.getAbsolutePath());
	assertEquals(libFolder.getAbsolutePath(), builder.flinkLibPath.getAbsolutePath());
	assertEquals(confFolder.getAbsolutePath(), builder.flinkConfPath.getAbsolutePath());
}
 
Example 2
Source File: PythonEnvUtilsTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testSetPythonExecutable() throws IOException {
	Configuration config = new Configuration();

	PythonEnvUtils.PythonEnvironment env = preparePythonEnvironment(config, null, tmpDirPath);
	if (OperatingSystem.isWindows()) {
		Assert.assertEquals("python.exe", env.pythonExec);
	} else {
		Assert.assertEquals("python", env.pythonExec);
	}

	Map<String, String> systemEnv = new HashMap<>(System.getenv());
	systemEnv.put(PYFLINK_CLIENT_EXECUTABLE, "python3");
	CommonTestUtils.setEnv(systemEnv);
	try {
		env = preparePythonEnvironment(config, null, tmpDirPath);
		Assert.assertEquals("python3", env.pythonExec);
	} finally {
		systemEnv.remove(PYFLINK_CLIENT_EXECUTABLE);
		CommonTestUtils.setEnv(systemEnv);
	}

	config.set(PYTHON_CLIENT_EXECUTABLE, "/usr/bin/python");
	env = preparePythonEnvironment(config, null, tmpDirPath);
	Assert.assertEquals("/usr/bin/python", env.pythonExec);
}
 
Example 3
Source File: YarnClusterDescriptorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testEnvironmentEmptyPluginsShipping() throws Exception {
	try (YarnClusterDescriptor descriptor = createYarnClusterDescriptor()) {
		File pluginsFolder = Paths.get(temporaryFolder.getRoot().getAbsolutePath(), "s0m3_p4th_th4t_sh0uld_n0t_3x1sts").toFile();
		Set<File> effectiveShipFiles = new HashSet<>();

		final Map<String, String> oldEnv = System.getenv();
		try {
			Map<String, String> env = new HashMap<>(1);
			env.put(ConfigConstants.ENV_FLINK_PLUGINS_DIR, pluginsFolder.getAbsolutePath());
			CommonTestUtils.setEnv(env);
			// only execute part of the deployment to test for shipped files
			descriptor.addEnvironmentFoldersToShipFiles(effectiveShipFiles);
		} finally {
			CommonTestUtils.setEnv(oldEnv);
		}

		assertTrue(effectiveShipFiles.isEmpty());
	}
}
 
Example 4
Source File: YarnClusterDescriptorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
public void testEnvironmentDirectoryShipping(String environmentVariable) throws Exception {
	try (YarnClusterDescriptor descriptor = createYarnClusterDescriptor()) {
		File libFolder = temporaryFolder.newFolder().getAbsoluteFile();
		File libFile = new File(libFolder, "libFile.jar");
		libFile.createNewFile();

		Set<File> effectiveShipFiles = new HashSet<>();

		final Map<String, String> oldEnv = System.getenv();
		try {
			Map<String, String> env = new HashMap<>(1);
			env.put(environmentVariable, libFolder.getAbsolutePath());
			CommonTestUtils.setEnv(env);
			// only execute part of the deployment to test for shipped files
			descriptor.addEnvironmentFoldersToShipFiles(effectiveShipFiles);
		} finally {
			CommonTestUtils.setEnv(oldEnv);
		}

		// only add the ship the folder, not the contents
		Assert.assertFalse(effectiveShipFiles.contains(libFile));
		Assert.assertTrue(effectiveShipFiles.contains(libFolder));
		Assert.assertFalse(descriptor.shipFiles.contains(libFile));
		Assert.assertFalse(descriptor.shipFiles.contains(libFolder));
	}
}
 
Example 5
Source File: FlinkDistributionOverlayTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testBuilderFromEnvironment() throws Exception {
	Configuration conf = new Configuration();

	File binFolder = tempFolder.newFolder("bin");
	File libFolder = tempFolder.newFolder("lib");
	File pluginsFolder = tempFolder.newFolder("plugins");
	File confFolder = tempFolder.newFolder("conf");

	// adjust the test environment for the purposes of this test
	Map<String, String> map = new HashMap<String, String>(System.getenv());
	map.put(ENV_FLINK_BIN_DIR, binFolder.getAbsolutePath());
	map.put(ENV_FLINK_LIB_DIR, libFolder.getAbsolutePath());
	map.put(ENV_FLINK_PLUGINS_DIR, pluginsFolder.getAbsolutePath());
	map.put(ENV_FLINK_CONF_DIR, confFolder.getAbsolutePath());
	CommonTestUtils.setEnv(map);

	FlinkDistributionOverlay.Builder builder = FlinkDistributionOverlay.newBuilder().fromEnvironment(conf);

	assertEquals(binFolder.getAbsolutePath(), builder.flinkBinPath.getAbsolutePath());
	assertEquals(libFolder.getAbsolutePath(), builder.flinkLibPath.getAbsolutePath());
	final File flinkPluginsPath = builder.flinkPluginsPath;
	assertNotNull(flinkPluginsPath);
	assertEquals(pluginsFolder.getAbsolutePath(), flinkPluginsPath.getAbsolutePath());
	assertEquals(confFolder.getAbsolutePath(), builder.flinkConfPath.getAbsolutePath());
}
 
Example 6
Source File: YarnClusterDescriptorTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Tests to ship a lib folder through the {@code ConfigConstants.ENV_FLINK_LIB_DIR}.
 */
@Test
public void testEnvironmentLibShipping() throws Exception {
	try (YarnClusterDescriptor descriptor = new YarnClusterDescriptor(
		new Configuration(),
		yarnConfiguration,
		temporaryFolder.getRoot().getAbsolutePath(),
		yarnClient,
		true)) {
		File libFolder = temporaryFolder.newFolder().getAbsoluteFile();
		File libFile = new File(libFolder, "libFile.jar");
		libFile.createNewFile();

		Set<File> effectiveShipFiles = new HashSet<>();

		final Map<String, String> oldEnv = System.getenv();
		try {
			Map<String, String> env = new HashMap<>(1);
			env.put(ConfigConstants.ENV_FLINK_LIB_DIR, libFolder.getAbsolutePath());
			CommonTestUtils.setEnv(env);
			// only execute part of the deployment to test for shipped files
			descriptor.addLibFolderToShipFiles(effectiveShipFiles);
		} finally {
			CommonTestUtils.setEnv(oldEnv);
		}

		// only add the ship the folder, not the contents
		Assert.assertFalse(effectiveShipFiles.contains(libFile));
		Assert.assertTrue(effectiveShipFiles.contains(libFolder));
		Assert.assertFalse(descriptor.shipFiles.contains(libFile));
		Assert.assertFalse(descriptor.shipFiles.contains(libFolder));
	}
}
 
Example 7
Source File: PluginConfigTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void getPluginsDir_existingDirectory_returnsDirectoryFile() throws IOException {
	final File pluginsDirectory = temporaryFolder.newFolder();
	final Map<String, String> envVariables = ImmutableMap.of(ConfigConstants.ENV_FLINK_PLUGINS_DIR, pluginsDirectory.getAbsolutePath());
	CommonTestUtils.setEnv(envVariables);

	assertThat(PluginConfig.getPluginsDir().get(), is(pluginsDirectory));
}
 
Example 8
Source File: FlinkDistributionOverlayTest.java    From flink with Apache License 2.0 5 votes vote down vote up
public void testBuilderFromEnvironmentBad(String obligatoryEnvironmentVariable) throws Exception {
	Configuration conf = new Configuration();

	// adjust the test environment for the purposes of this test
	Map<String, String> map = new HashMap<>(System.getenv());
	map.remove(obligatoryEnvironmentVariable);
	CommonTestUtils.setEnv(map);

	try {
		FlinkDistributionOverlay.Builder builder = FlinkDistributionOverlay.newBuilder().fromEnvironment(conf);
		fail();
	} catch (IllegalStateException e) {
		// expected
	}
}
 
Example 9
Source File: PluginConfigTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void getPluginsDir_nonExistingDirectory_returnsEmpty() {
	final Map<String, String> envVariables = ImmutableMap.of(ConfigConstants.ENV_FLINK_PLUGINS_DIR, new File(temporaryFolder.getRoot().getAbsoluteFile(), "should_not_exist").getAbsolutePath());
	CommonTestUtils.setEnv(envVariables);

	assertFalse(PluginConfig.getPluginsDir().isPresent());
}
 
Example 10
Source File: HiveCatalogFactoryTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testLoadHDFSConfigFromEnv() throws IOException {
	final String k1 = "what is connector?";
	final String v1 = "Hive";
	final String catalogName = "HiveCatalog";

	// set HADOOP_CONF_DIR env
	final File hadoopConfDir = tempFolder.newFolder();
	final File hdfsSiteFile = new File(hadoopConfDir, "hdfs-site.xml");
	writeProperty(hdfsSiteFile, k1, v1);
	final Map<String, String> originalEnv = System.getenv();
	final Map<String, String> newEnv = new HashMap<>(originalEnv);
	newEnv.put("HADOOP_CONF_DIR", hadoopConfDir.getAbsolutePath());
	CommonTestUtils.setEnv(newEnv);

	// create HiveCatalog use the Hadoop Configuration
	final CatalogDescriptor catalogDescriptor = new HiveCatalogDescriptor();
	final Map<String, String> properties = catalogDescriptor.toProperties();
	final HiveConf hiveConf;
	try {
		final HiveCatalog hiveCatalog = (HiveCatalog) TableFactoryService.find(CatalogFactory.class, properties)
			.createCatalog(catalogName, properties);
		hiveConf = hiveCatalog.getHiveConf();
	} finally {
		// set the Env back
		CommonTestUtils.setEnv(originalEnv);
	}
	//validate the result
	assertEquals(v1, hiveConf.get(k1, null));
}
 
Example 11
Source File: UtilsTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testCreateTaskExecutorCredentials() throws Exception {
	File root = temporaryFolder.getRoot();
	File home = new File(root, "home");
	boolean created = home.mkdir();
	assertTrue(created);

	Configuration flinkConf = new Configuration();
	YarnConfiguration yarnConf = new YarnConfiguration();

	Map<String, String> env = new HashMap<>();
	env.put(YarnConfigKeys.ENV_APP_ID, "foo");
	env.put(YarnConfigKeys.ENV_CLIENT_HOME_DIR, home.getAbsolutePath());
	env.put(YarnConfigKeys.ENV_CLIENT_SHIP_FILES, "");
	env.put(YarnConfigKeys.ENV_FLINK_CLASSPATH, "");
	env.put(YarnConfigKeys.ENV_HADOOP_USER_NAME, "foo");
	env.put(YarnConfigKeys.FLINK_JAR_PATH, root.toURI().toString());
	env = Collections.unmodifiableMap(env);

	File credentialFile = temporaryFolder.newFile("container_tokens");
	final Text amRmTokenKind = AMRMTokenIdentifier.KIND_NAME;
	final Text hdfsDelegationTokenKind = new Text("HDFS_DELEGATION_TOKEN");
	final Text service = new Text("test-service");
	Credentials amCredentials = new Credentials();
	amCredentials.addToken(amRmTokenKind, new Token<>(new byte[4], new byte[4], amRmTokenKind, service));
	amCredentials.addToken(hdfsDelegationTokenKind, new Token<>(new byte[4], new byte[4],
		hdfsDelegationTokenKind, service));
	amCredentials.writeTokenStorageFile(new org.apache.hadoop.fs.Path(credentialFile.getAbsolutePath()), yarnConf);

	ContaineredTaskManagerParameters tmParams = new ContaineredTaskManagerParameters(64,
		64, 16, 1, new HashMap<>(1));
	Configuration taskManagerConf = new Configuration();

	String workingDirectory = root.getAbsolutePath();
	Class<?> taskManagerMainClass = YarnTaskExecutorRunner.class;
	ContainerLaunchContext ctx;

	final Map<String, String> originalEnv = System.getenv();
	try {
		Map<String, String> systemEnv = new HashMap<>(originalEnv);
		systemEnv.put("HADOOP_TOKEN_FILE_LOCATION", credentialFile.getAbsolutePath());
		CommonTestUtils.setEnv(systemEnv);
		ctx = Utils.createTaskExecutorContext(flinkConf, yarnConf, env, tmParams,
			taskManagerConf, workingDirectory, taskManagerMainClass, LOG);
	} finally {
		CommonTestUtils.setEnv(originalEnv);
	}

	Credentials credentials = new Credentials();
	try (DataInputStream dis = new DataInputStream(new ByteArrayInputStream(ctx.getTokens().array()))) {
		credentials.readTokenStorageStream(dis);
	}
	Collection<Token<? extends TokenIdentifier>> tokens = credentials.getAllTokens();
	boolean hasHdfsDelegationToken = false;
	boolean hasAmRmToken = false;
	for (Token<? extends TokenIdentifier> token : tokens) {
		if (token.getKind().equals(amRmTokenKind)) {
			hasAmRmToken = true;
		} else if (token.getKind().equals(hdfsDelegationTokenKind)) {
			hasHdfsDelegationToken = true;
		}
	}
	assertTrue(hasHdfsDelegationToken);
	assertFalse(hasAmRmToken);
}
 
Example 12
Source File: PluginConfigTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@After
public void teardown() {
	if (oldEnvVariables != null) {
		CommonTestUtils.setEnv(oldEnvVariables, true);
	}
}
 
Example 13
Source File: ContainerOverlayTestBase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@After
public void after() {
	CommonTestUtils.setEnv(originalEnvironment, true);
}
 
Example 14
Source File: ContainerOverlayTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@After
public void after() {
	CommonTestUtils.setEnv(originalEnvironment, true);
}
 
Example 15
Source File: HadoopConfigLoadingTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void loadFromEnvVariables() throws Exception {
	final String k1 = "where?";
	final String v1 = "I'm on a boat";
	final String k2 = "when?";
	final String v2 = "midnight";
	final String k3 = "why?";
	final String v3 = "what do you think?";
	final String k4 = "which way?";
	final String v4 = "south, always south...";
	final String k5 = "how long?";
	final String v5 = "an eternity";
	final String k6 = "for real?";
	final String v6 = "quite so...";

	final File hadoopConfDir = tempFolder.newFolder();

	final File hadoopHome = tempFolder.newFolder();

	final File hadoopHomeConf = new File(hadoopHome, "conf");
	final File hadoopHomeEtc = new File(hadoopHome, "etc/hadoop");

	assertTrue(hadoopHomeConf.mkdirs());
	assertTrue(hadoopHomeEtc.mkdirs());

	final File file1 = new File(hadoopConfDir, "core-site.xml");
	final File file2 = new File(hadoopConfDir, "hdfs-site.xml");
	final File file3 = new File(hadoopHomeConf, "core-site.xml");
	final File file4 = new File(hadoopHomeConf, "hdfs-site.xml");
	final File file5 = new File(hadoopHomeEtc, "core-site.xml");
	final File file6 = new File(hadoopHomeEtc, "hdfs-site.xml");

	printConfig(file1, k1, v1);
	printConfig(file2, k2, v2);
	printConfig(file3, k3, v3);
	printConfig(file4, k4, v4);
	printConfig(file5, k5, v5);
	printConfig(file6, k6, v6);

	final org.apache.hadoop.conf.Configuration hadoopConf;

	final Map<String, String> originalEnv = System.getenv();
	final Map<String, String> newEnv = new HashMap<>(originalEnv);
	newEnv.put("HADOOP_CONF_DIR", hadoopConfDir.getAbsolutePath());
	newEnv.put("HADOOP_HOME", hadoopHome.getAbsolutePath());
	try {
		CommonTestUtils.setEnv(newEnv);
		hadoopConf = HadoopUtils.getHadoopConfiguration(new Configuration());
	}
	finally {
		CommonTestUtils.setEnv(originalEnv);
	}

	// contains extra entries
	assertEquals(v1, hadoopConf.get(k1, null));
	assertEquals(v2, hadoopConf.get(k2, null));
	assertEquals(v3, hadoopConf.get(k3, null));
	assertEquals(v4, hadoopConf.get(k4, null));
	assertEquals(v5, hadoopConf.get(k5, null));
	assertEquals(v6, hadoopConf.get(k6, null));

	// also contains classpath defaults
	assertEquals(IN_CP_CONFIG_VALUE, hadoopConf.get(IN_CP_CONFIG_KEY, null));
}
 
Example 16
Source File: TestBaseUtils.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public static void setEnv(Map<String, String> newenv) {
	CommonTestUtils.setEnv(newenv);
}
 
Example 17
Source File: HadoopConfOverlayTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testBuilderFromEnvironment() throws Exception {

	// verify that the builder picks up various environment locations
	HadoopConfOverlay.Builder builder;
	Map<String, String> env;

	// fs.hdfs.hadoopconf
	File confDir = tempFolder.newFolder();
	initConfDir(confDir);
	Configuration conf = new Configuration();
	conf.setString(ConfigConstants.PATH_HADOOP_CONFIG, confDir.getAbsolutePath());
	builder = HadoopConfOverlay.newBuilder().fromEnvironment(conf);
	assertEquals(confDir, builder.hadoopConfDir);

	// HADOOP_CONF_DIR
	env = new HashMap<String, String>(System.getenv());
	env.remove("HADOOP_HOME");
	env.put("HADOOP_CONF_DIR", confDir.getAbsolutePath());
	CommonTestUtils.setEnv(env);
	builder = HadoopConfOverlay.newBuilder().fromEnvironment(new Configuration());
	assertEquals(confDir, builder.hadoopConfDir);

	// HADOOP_HOME/conf
	File homeDir = tempFolder.newFolder();
	confDir = initConfDir(new File(homeDir, "conf"));
	env = new HashMap<String, String>(System.getenv());
	env.remove("HADOOP_CONF_DIR");
	env.put("HADOOP_HOME", homeDir.getAbsolutePath());
	CommonTestUtils.setEnv(env);
	builder = HadoopConfOverlay.newBuilder().fromEnvironment(new Configuration());
	assertEquals(confDir, builder.hadoopConfDir);

	// HADOOP_HOME/etc/hadoop
	homeDir = tempFolder.newFolder();
	confDir = initConfDir(new File(homeDir, "etc/hadoop"));
	env = new HashMap<String, String>(System.getenv());
	env.remove("HADOOP_CONF_DIR");
	env.put("HADOOP_HOME", homeDir.getAbsolutePath());
	CommonTestUtils.setEnv(env);
	builder = HadoopConfOverlay.newBuilder().fromEnvironment(new Configuration());
	assertEquals(confDir, builder.hadoopConfDir);
}
 
Example 18
Source File: TestBaseUtils.java    From flink with Apache License 2.0 4 votes vote down vote up
public static void setEnv(Map<String, String> newenv) {
	CommonTestUtils.setEnv(newenv);
}
 
Example 19
Source File: HadoopConfigLoadingTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void loadFromEnvVariables() throws Exception {
	final String k1 = "where?";
	final String v1 = "I'm on a boat";
	final String k2 = "when?";
	final String v2 = "midnight";
	final String k3 = "why?";
	final String v3 = "what do you think?";
	final String k4 = "which way?";
	final String v4 = "south, always south...";
	final String k5 = "how long?";
	final String v5 = "an eternity";
	final String k6 = "for real?";
	final String v6 = "quite so...";

	final File hadoopConfDir = tempFolder.newFolder();

	final File hadoopHome = tempFolder.newFolder();

	final File hadoopHomeConf = new File(hadoopHome, "conf");
	final File hadoopHomeEtc = new File(hadoopHome, "etc/hadoop");

	assertTrue(hadoopHomeConf.mkdirs());
	assertTrue(hadoopHomeEtc.mkdirs());

	final File file1 = new File(hadoopConfDir, "core-site.xml");
	final File file2 = new File(hadoopConfDir, "hdfs-site.xml");
	final File file3 = new File(hadoopHomeConf, "core-site.xml");
	final File file4 = new File(hadoopHomeConf, "hdfs-site.xml");
	final File file5 = new File(hadoopHomeEtc, "core-site.xml");
	final File file6 = new File(hadoopHomeEtc, "hdfs-site.xml");

	printConfig(file1, k1, v1);
	printConfig(file2, k2, v2);
	printConfig(file3, k3, v3);
	printConfig(file4, k4, v4);
	printConfig(file5, k5, v5);
	printConfig(file6, k6, v6);

	final org.apache.hadoop.conf.Configuration hadoopConf;

	final Map<String, String> originalEnv = System.getenv();
	final Map<String, String> newEnv = new HashMap<>(originalEnv);
	newEnv.put("HADOOP_CONF_DIR", hadoopConfDir.getAbsolutePath());
	newEnv.put("HADOOP_HOME", hadoopHome.getAbsolutePath());
	try {
		CommonTestUtils.setEnv(newEnv);
		hadoopConf = HadoopUtils.getHadoopConfiguration(new Configuration());
	}
	finally {
		CommonTestUtils.setEnv(originalEnv);
	}

	// contains extra entries
	assertEquals(v1, hadoopConf.get(k1, null));
	assertEquals(v2, hadoopConf.get(k2, null));
	assertEquals(v3, hadoopConf.get(k3, null));
	assertEquals(v4, hadoopConf.get(k4, null));
	assertEquals(v5, hadoopConf.get(k5, null));
	assertEquals(v6, hadoopConf.get(k6, null));

	// also contains classpath defaults
	assertEquals(IN_CP_CONFIG_VALUE, hadoopConf.get(IN_CP_CONFIG_KEY, null));
}
 
Example 20
Source File: HBaseConfigLoadingTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void loadOverlappingConfig() throws Exception {
	final String k1 = "key1";

	final String v1 = "from HBASE_HOME/conf";
	final String v2 = "from HBASE_CONF_DIR";

	final File hbaseHome = tempFolder.newFolder("hbaseHome");
	final File hbaseHomeConf = new File(hbaseHome, "conf");

	final File hbaseConfDir = tempFolder.newFolder("hbaseConfDir");

	assertTrue(hbaseHomeConf.mkdirs());
	final File file1 = new File(hbaseHomeConf, "hbase-site.xml");

	Map<String, String> properties1 = new HashMap<>();
	properties1.put(k1, v1);
	printConfigs(file1, properties1);

	// HBASE_CONF_DIR conf will override k1 with v2
	final File file2 = new File(hbaseConfDir, "hbase-site.xml");
	Map<String, String> properties2 = new HashMap<>();
	properties2.put(k1, v2);
	printConfigs(file2, properties2);

	final org.apache.hadoop.conf.Configuration hbaseConf;

	final Map<String, String> originalEnv = System.getenv();
	final Map<String, String> newEnv = new HashMap<>(originalEnv);
	newEnv.put("HBASE_CONF_DIR", hbaseConfDir.getAbsolutePath());
	newEnv.put("HBASE_HOME", hbaseHome.getAbsolutePath());
	try {
		CommonTestUtils.setEnv(newEnv);
		hbaseConf = HBaseConfigurationUtil.getHBaseConfiguration();
	}
	finally {
		CommonTestUtils.setEnv(originalEnv);
	}

	// contains extra entries
	assertEquals(v2, hbaseConf.get(k1, null));

	// also contains classpath defaults
	assertEquals(IN_HBASE_CONFIG_VALUE, hbaseConf.get(IN_HBASE_CONFIG_KEY, null));
}