github.com/jlmeeker/kismatic@v1.10.1-0.20180612190640-57f9005a1f1a/pkg/data/gluster_test.go (about) 1 package data 2 3 import "testing" 4 5 var tests = []string{ 6 `<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 7 <cliOutput> 8 <opRet>0</opRet> 9 <opErrno>0</opErrno> 10 <opErrstr/> 11 <volQuota> 12 <limit> 13 <path>/</path> 14 <hard_limit>1073741824</hard_limit> 15 <soft_limit_percent>80%</soft_limit_percent> 16 <soft_limit_value>858993459</soft_limit_value> 17 <used_space>0</used_space> 18 <avail_space>1073741824</avail_space> 19 <sl_exceeded>No</sl_exceeded> 20 <hl_exceeded>No</hl_exceeded> 21 </limit> 22 </volQuota> 23 </cliOutput>`, 24 `<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 25 <cliOutput> 26 <opRet>-1</opRet> 27 <opErrno>30800</opErrno> 28 <opErrstr>Volume storage01 does not exist</opErrstr> 29 <cliOp>volQuota</cliOp> 30 </cliOutput>`, 31 } 32 33 func TestUnmarshalVolumeQuota(t *testing.T) { 34 for _, test := range tests { 35 quota, err := UnmarshalVolumeQuota(test) 36 if err != nil { 37 t.Fatalf("unexpected error: %v", err) 38 } 39 if quota == nil { 40 t.Fatal("did not expect for quota to be nil") 41 } 42 } 43 }