def test_replace_all_supported_properties(self):
        conf_dir = environ.get("CONF_DIR")
        environ["HDFS_NAMENODE_ADDRESS"] = "hdfs://namenode.magi.io:9000"
        environ["HDFS_NAMENODE_NAME"] = "hdfs://namenode.magi.io:9000"

        xml = read_xml(conf_dir, self.core_site_file)
        output = process_core_site(xml)

        assert (verify_prop_values(output, "fs.defaultFS",
                                   environ["HDFS_NAMENODE_ADDRESS"]))
        assert (verify_prop_values(output, "fs.default.name",
                                   environ["HDFS_NAMENODE_NAME"]))
Esempio n. 2
0
    def test_overwrite_core_site(self):
        environ["HDFS_NAMENODE_ADDRESS"] = "hdfs://namenode.magi.io:9000"
        environ["HDFS_NAMENODE_NAME"] = "hdfs://namenode.magi.io:9000"
        conf_dir = environ.get("CONF_DIR")
        original = read_xml(conf_dir, self.filename)
        processed = process_core_site(original)
        overwrite_file(conf_dir, self.filename, processed)

        updated = read_xml(conf_dir, self.filename)
        assert (verify_prop_values(updated, "fs.defaultFS",
                                   environ["HDFS_NAMENODE_ADDRESS"]))
        assert (verify_prop_values(updated, "fs.default.name",
                                   environ["HDFS_NAMENODE_NAME"]))
Esempio n. 3
0
    def test_replace_all_supported_properties(self):
        conf_dir = environ.get("CONF_DIR")
        environ["HBASE_ROOT_DIR"] = "hdfs://namenode.magi.io:9000/hbase"
        environ["HBASE_ZOOKEEPER_HOST"] = "zk-test"
        environ["HBASE_ZOOKEEPER_PORT"] = "6308"

        xml = read_xml(conf_dir, self.hbase_site_file)
        output = process(xml)

        assert (verify_prop_values(output, "hbase.rootdir",
                                   environ["HBASE_ROOT_DIR"]))
        assert (verify_prop_values(output, "hbase.zookeeper.quorum",
                                   environ["HBASE_ZOOKEEPER_HOST"]))
        assert (verify_prop_values(output,
                                   "hbase.zookeeper.property.clientPort",
                                   environ["HBASE_ZOOKEEPER_PORT"]))
    def test_overwrite_hbase_site(self):
        conf_dir = environ.get("CONF_DIR")
        environ["HBASE_ROOT_DIR"] = "hdfs://namenode.magi.io:9000/hbase"
        environ["HBASE_ZOOKEEPER_HOST"] = "zk-test"
        environ["HBASE_ZOOKEEPER_PORT"] = "6308"
        original = read_xml(conf_dir, self.filename)
        processed = process(original)
        overwrite_file(conf_dir, self.filename, processed)

        updated = read_xml(conf_dir, self.filename)
        assert (verify_prop_values(updated, "hbase.rootdir",
                                   environ["HBASE_ROOT_DIR"]))
        assert (verify_prop_values(updated, "hbase.zookeeper.quorum",
                                   environ["HBASE_ZOOKEEPER_HOST"]))
        assert (verify_prop_values(updated,
                                   "hbase.zookeeper.property.clientPort",
                                   environ["HBASE_ZOOKEEPER_PORT"]))
Esempio n. 5
0
    def test_replace_zookeeper_host(self):
        conf_dir = environ.get("CONF_DIR")
        environ["HBASE_ZOOKEEPER_HOST"] = "zk-test"

        xml = read_xml(conf_dir, self.hbase_site_file)
        output = process(xml)

        assert (verify_prop_values(output, "hbase.zookeeper.quorum",
                                   environ["HBASE_ZOOKEEPER_HOST"]))
Esempio n. 6
0
    def test_replace_hbase_root_dir(self):
        conf_dir = environ.get("CONF_DIR")
        environ["HBASE_ROOT_DIR"] = "hdfs://namenode.magi.io:9000/hbase"

        xml = read_xml(conf_dir, self.hbase_site_file)
        output = process(xml)

        assert (verify_prop_values(output, "hbase.rootdir",
                                   environ["HBASE_ROOT_DIR"]))
Esempio n. 7
0
    def test_replace_zookeeper_port(self):
        conf_dir = environ.get("CONF_DIR")
        environ["HBASE_ZOOKEEPER_PORT"] = "6308"

        xml = read_xml(conf_dir, self.hbase_site_file)
        output = process(xml)

        assert (verify_prop_values(output,
                                   "hbase.zookeeper.property.clientPort",
                                   environ["HBASE_ZOOKEEPER_PORT"]))
Esempio n. 8
0
    def test_replace_all_supported_properties(self):
        conf_dir = environ.get("CONF_DIR")
        environ["HDFS_NAMENODE_HTTP_PORT"] = "1337"
        environ["HDFS_NAMENODE_HTTPS_PORT"] = "1338"
        environ["HDFS_DATANODE_HTTP_PORT"] = "1339"
        environ["HDFS_DATANODE_HTTPS_PORT"] = "1340"
        environ["HDFS_DATANODE_ADDRESS"] = "1341"
        environ["HDFS_DATANODE_IPC_PORT"] = "1342"

        xml = read_xml(conf_dir, self.hdfs_site_file)
        output = process_hdfs_site(xml)

        assert (verify_prop_values(
            output, "dfs.http.address",
            f"0.0.0.0:{environ[ 'HDFS_NAMENODE_HTTP_PORT' ]}"))
        assert (verify_prop_values(
            output, "dfs.https.address",
            f"0.0.0.0:{environ[ 'HDFS_NAMENODE_HTTPS_PORT' ]}"))
        assert (verify_prop_values(
            output, "dfs.datanode.http.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_HTTP_PORT' ]}"))
        assert (verify_prop_values(
            output, "dfs.datanode.https.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_HTTPS_PORT' ]}"))
        assert (verify_prop_values(
            output, "dfs.datanode.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_ADDRESS' ]}"))
        assert (verify_prop_values(
            output, "dfs.datanode.ipc.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_IPC_PORT' ]}"))
Esempio n. 9
0
    def test_overwrite_core_site(self):
        environ["HDFS_NAMENODE_HTTP_PORT"] = "1337"
        environ["HDFS_NAMENODE_HTTPS_PORT"] = "1338"
        environ["HDFS_DATANODE_HTTP_PORT"] = "1339"
        environ["HDFS_DATANODE_HTTPS_PORT"] = "1340"
        environ["HDFS_DATANODE_ADDRESS"] = "1341"
        environ["HDFS_DATANODE_IPC_PORT"] = "1342"

        conf_dir = environ.get("CONF_DIR")

        original = read_xml(conf_dir, self.filename)
        processed = process_hdfs_site(original)
        overwrite_file(conf_dir, self.filename, processed)

        updated = read_xml(conf_dir, self.filename)

        assert (verify_prop_values(
            updated, "dfs.http.address",
            f"0.0.0.0:{environ[ 'HDFS_NAMENODE_HTTP_PORT' ]}"))
        assert (verify_prop_values(
            updated, "dfs.https.address",
            f"0.0.0.0:{environ[ 'HDFS_NAMENODE_HTTPS_PORT' ]}"))
        assert (verify_prop_values(
            updated, "dfs.datanode.http.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_HTTP_PORT' ]}"))
        assert (verify_prop_values(
            updated, "dfs.datanode.https.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_HTTPS_PORT' ]}"))
        assert (verify_prop_values(
            updated, "dfs.datanode.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_ADDRESS' ]}"))
        assert (verify_prop_values(
            updated, "dfs.datanode.ipc.address",
            f"0.0.0.0:{environ[ 'HDFS_DATANODE_IPC_PORT' ]}"))

        if __name__ == '__main__':
            unittest.main()