Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions apis/opts/config/ulimit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,57 @@ func TestUlimitType(t *testing.T) {
}
}

func TestUlimitString(t *testing.T) {
type args struct {
values map[string]*units.Ulimit
}
tests := []struct {
name string
args args
want string
}{
{
"get string of Ulimit with valid element",
args{
values: map[string]*units.Ulimit{
"a": {
Name: "core",
Hard: 5,
Soft: 3,
},
},
},
"[core=3:5]",
},
{
"get string of Runtime with nil",
args{
values: map[string]*units.Ulimit{},
},
"[]",
},
{
"get string of Runtime with empty Ulimit",
args{
values: map[string]*units.Ulimit{
"a": {},
},
},
"[=0:0]",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ul := &Ulimit{
values: tt.args.values,
}
if got := ul.String(); got != tt.want {
t.Errorf("Ulimit.String() = %v, want %v", got, tt.want)
}
})
}
}

func TestUlimitValue(t *testing.T) {
assert := assert.New(t)
type args struct {
Expand Down