mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
44 lines
846 B
Go
44 lines
846 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|