mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 16:06:51 +00:00
Remove ExpStorageVersion and Add StorageVersions to APIServer struct
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package app
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
@@ -61,3 +62,39 @@ func TestLongRunningRequestRegexp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateStorageVersionMap(t *testing.T) {
|
||||
testCases := []struct {
|
||||
legacyVersion string
|
||||
storageVersions string
|
||||
expectedMap map[string]string
|
||||
}{
|
||||
{
|
||||
legacyVersion: "v1",
|
||||
storageVersions: "v1,experimental/v1alpha1",
|
||||
expectedMap: map[string]string{
|
||||
"": "v1",
|
||||
"experimental": "experimental/v1alpha1",
|
||||
},
|
||||
},
|
||||
{
|
||||
legacyVersion: "",
|
||||
storageVersions: "experimental/v1alpha1,v1",
|
||||
expectedMap: map[string]string{
|
||||
"": "v1",
|
||||
"experimental": "experimental/v1alpha1",
|
||||
},
|
||||
},
|
||||
{
|
||||
legacyVersion: "",
|
||||
storageVersions: "",
|
||||
expectedMap: map[string]string{},
|
||||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
output := generateStorageVersionMap(test.legacyVersion, test.storageVersions)
|
||||
if !reflect.DeepEqual(test.expectedMap, output) {
|
||||
t.Errorf("unexpected error. expect: %v, got: %v", test.expectedMap, output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user