Ejemplo n.º 1
0
func setupHdfs(t *testing.T) *backend.HdfsBackend {
	nn := os.Getenv("HADOOP_NAMENODE")
	if nn == "" {
		t.Skip("Skipping hdfs tests because HADOOP_NAMENODE isn't set")
	}

	client, err := hdfs.New(nn)
	if err != nil {
		t.Fatal(err)
	}

	if _, err = client.Stat("/_test_sequins"); os.IsNotExist(err) {
		t.Skip("Skipping hdfs tests because there's no test data in /_test_sequins")
	}

	return backend.NewHdfsBackend(client, nn, "/_test_sequins")
}
Ejemplo n.º 2
0
func hdfsSetup(namenode string, path string, opts sequinsOptions) *sequins {
	client, err := hdfs.New(namenode)
	if err != nil {
		log.Fatal(fmt.Errorf("Error connecting to HDFS: %s", err))
	}

	backend := backend.NewHdfsBackend(client, namenode, path)
	if opts.LocalPath == "" {
		tmpDir, err := ioutil.TempDir("", "sequins-")
		if err != nil {
			log.Fatal(err)
		}

		opts.LocalPath = tmpDir
	}

	return newSequins(backend, opts)
}