Updated quota test,match kernel fields terminology
This commit is contained in:
parent
877d8d5d6b
commit
8297c4730e
|
@ -24,15 +24,15 @@ import (
|
|||
|
||||
// Quota defines a threshold against a number of bytes.
|
||||
type Quota struct {
|
||||
Bytes uint64
|
||||
Used uint64
|
||||
Over bool
|
||||
Bytes uint64
|
||||
Consumed uint64
|
||||
Over bool
|
||||
}
|
||||
|
||||
func (q *Quota) marshal() ([]byte, error) {
|
||||
attrs := []netlink.Attribute{
|
||||
{Type: unix.NFTA_QUOTA_BYTES, Data: binaryutil.BigEndian.PutUint64(q.Bytes)},
|
||||
{Type: unix.NFTA_QUOTA_CONSUMED, Data: binaryutil.BigEndian.PutUint64(q.Used)},
|
||||
{Type: unix.NFTA_QUOTA_CONSUMED, Data: binaryutil.BigEndian.PutUint64(q.Consumed)},
|
||||
}
|
||||
|
||||
flags := uint32(0)
|
||||
|
@ -67,7 +67,7 @@ func (q *Quota) unmarshal(data []byte) error {
|
|||
case unix.NFTA_QUOTA_BYTES:
|
||||
q.Bytes = ad.Uint64()
|
||||
case unix.NFTA_QUOTA_CONSUMED:
|
||||
q.Used = ad.Uint64()
|
||||
q.Consumed = ad.Uint64()
|
||||
case unix.NFTA_QUOTA_FLAGS:
|
||||
q.Over = (ad.Uint32() & unix.NFT_QUOTA_F_INV) == 1
|
||||
}
|
||||
|
|
|
@ -4827,9 +4827,9 @@ func TestQuota(t *testing.T) {
|
|||
Exprs: []expr.Any{
|
||||
// [ quota bytes 6 consumed 0 flags 1 ]
|
||||
&expr.Quota{
|
||||
Bytes: uint64(6),
|
||||
Used: uint64(0),
|
||||
Over: true,
|
||||
Bytes: 6,
|
||||
Consumed: 0,
|
||||
Over: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue