-
Notifications
You must be signed in to change notification settings - Fork 4
/
hdfs_test.go
40 lines (35 loc) · 983 Bytes
/
hdfs_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package Figo
import (
"github.com/quexer/utee"
"log"
"testing"
)
func TestHDFSWriteFile(t *testing.T) {
defer Catch()
hdfsClient := NewHDFSClient("172.17.0.3:9000", "root")
fullPath := "/figo/github/bigFile.txt"
f, e := FileOpen("/home/figo/nohup.out")
utee.Chk(e)
err := hdfsClient.WriteFile(fullPath, f)
utee.Chk(err)
}
func TestHDFSWrite(t *testing.T) {
hdfsClient := NewHDFSClient("192.168.108.131:9000", "root")
fullPath := "/figo/github/foo.txt"
hdfsClient.Write(fullPath, []byte("Here We Go,Frightting To Eat"))
v, e := hdfsClient.Read(fullPath)
utee.Chk(e)
log.Println("@value I Read is :", string(v))
}
func TestHDFSCreateFile(t *testing.T) {
hdfsClient := NewHDFSClient("", "")
fullPath := "/test/test/push.txt"
err := hdfsClient.CreateFile(fullPath)
utee.Chk(err)
}
func TestHDFSAppend(t *testing.T) {
hdfsClient := NewHDFSClient("", "")
fullPath := "/test7.txt"
err := hdfsClient.AppendFile(fullPath, []byte("append file\n"))
utee.Chk(err)
}