mirror of https://github.com/k3s-io/k3s
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
846 B
44 lines
846 B
3 years ago
|
package util
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestAddFeatureGate(t *testing.T) {
|
||
|
type args struct {
|
||
|
currentArg string
|
||
|
featureGate string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want string
|
||
|
}{
|
||
|
{
|
||
|
name: "Feature gate added to empty arg",
|
||
|
args: args{
|
||
|
currentArg: "",
|
||
|
featureGate: "SupportPodPidsLimit=false",
|
||
|
},
|
||
|
want: "SupportPodPidsLimit=false",
|
||
|
},
|
||
|
{
|
||
|
name: "Feature gate added to existing arg",
|
||
|
args: args{
|
||
|
currentArg: "SupportPodPidsLimit=false",
|
||
|
featureGate: "DevicePlugins=false",
|
||
|
},
|
||
|
want: "SupportPodPidsLimit=false,DevicePlugins=false",
|
||
|
},
|
||
|
}
|
||
|
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
got := AddFeatureGate(tt.args.currentArg, tt.args.featureGate)
|
||
|
if got != tt.want {
|
||
|
t.Errorf("error, should be " + tt.want + ", but got " + got)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|