func TestHdfsClientWrite(t *testing.T) {
	client := setupHdfsTest(t)
	writeCloser, err := client.OpenWriteCloser("/tmp/testing")
	if err != nil {
		t.Fatalf("OpenWriteCloser failed: %v", err)
	}
	data := []byte("some data")
	_, err = writeCloser.Write(data)
	if err != nil {
		t.Fatalf("Write failed: %v", err)
	}
	writeCloser.Close()
	readCloser, err := client.OpenReadCloser("/tmp/testing")
	if err != nil {
		t.Fatalf("OpenReadCloser failed: %v", err)
	}
	b, err := ioutil.ReadAll(readCloser)
	if err != nil {
		t.Fatalf("Read failed: %v", err)
	}
	readCloser.Close()

	if bytes.Compare(b, data) != 0 {
		t.Fatalf("Read result isn't correct. Get = %s, Want = %s", string(b), string(data))
	}

	c := client.(*HdfsClient).client
	c.Remove("/tmp/testing")
}
// I was making two assumptions through all test cases:
// 1. "/tmp" dir exists.
// 2. I don't care about test failure. Though under failures you might need
//    to clean up files or dirs manually.
I was making two assumptions through all test cases:
1. "/tmp" dir exists.
2. I don't care about test failure. Though under failures you might need
to clean up files or dirs manually.
// I was making two assumptions through all test cases : // 1 . " / tmp " dir exists . // 2 . I don ' t care about test failure . Though under failures you might need // to clean up files or dirs manually .
func TestHdfsClientWrite(t *testing.T) {
	client := setupHdfsTest(t)
	writeCloser, err := client.OpenWriteCloser("/tmp/testing")
	if err != nil {
		t.Fatalf("OpenWriteCloser failed: %v", err)
	}
	data := []byte("some data")
	_, err = writeCloser.Write(data)
	if err != nil {
		t.Fatalf("Write failed: %v", err)
	}
	writeCloser.Close()
	readCloser, err := client.OpenReadCloser("/tmp/testing")
	if err != nil {
		t.Fatalf("OpenReadCloser failed: %v", err)
	}
	b, err := ioutil.ReadAll(readCloser)
	if err != nil {
		t.Fatalf("Read failed: %v", err)
	}
	readCloser.Close()
	if bytes.Compare(b, data) != 0 {
		t.Fatalf("Read result isn't correct. Get = %s, Want = %s", string(b), string(data))
	}
	c := client.(*HdfsClient).client
	c.Remove("/tmp/testing")
}
func TestHdfsClientWrite ( t * testing . T ) { client := setupHdfsTest ( t ) writeCloser , err := client . OpenWriteCloser ( " " ) if err != nil { t . Fatalf ( " " , err ) } data := [ ] byte ( " " ) _ , err = writeCloser . Write ( data ) if err != nil { t . Fatalf ( " " , err ) } writeCloser . Close ( ) readCloser , err := client . OpenReadCloser ( " " ) if err != nil { t . Fatalf ( " " , err ) } b , err := ioutil . ReadAll ( readCloser ) if err != nil { t . Fatalf ( " " , err ) } readCloser . Close ( ) if bytes . Compare ( b , data ) != 0 { t . Fatalf ( " " , string ( b ) , string ( data ) ) } c := client . ( * HdfsClient ) . client c . Remove ( " " ) }
I was making two assumptions through all test cases:
1.
I was making two assumptions through all test cases : 1 .