Skip to content

Commit

Permalink
added new limit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrichardsmith committed Sep 6, 2018
1 parent b09b779 commit a27d553
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions limits/config_test.go
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
package limits

import (
"reflect"
"testing"

"k8s.io/apimachinery/pkg/api/resource"
)

func TestName(t *testing.T) {
c := Config{}
if c.Name() != "limits" {
t.Fatal("Failed name test")
}
}

func TestQtyHook(t *testing.T) {
var i int
test := "1G"
vtype := reflect.TypeOf(i)
v, err := QtyHookFunc(vtype, vtype, test)
if err != nil {
t.Fatal(err)
}
if v.(string) != test {
t.Fatal("Expecting skip on not being string")
}
stype := reflect.TypeOf(test)
v, err = QtyHookFunc(stype, vtype, test)
if err != nil {
t.Fatal(err)
}
if v.(string) != test {
t.Fatal("Expecting skip on not being qty")
}
vtype = reflect.TypeOf(resource.Quantity{})
v, err = QtyHookFunc(stype, vtype, test)
if err != nil {
t.Fatal(err)
}
if reflect.TypeOf(resource.Quantity{}) != reflect.TypeOf(v) {
t.Fatal("Expecting return of qty")
}
}

0 comments on commit a27d553

Please sign in to comment.