mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
feat: update conversion helpers
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
This commit is contained in:
parent
82c6296a95
commit
7660ce9a7e
@ -554,3 +554,13 @@ func Convert_core_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *core.Persi
|
||||
func Convert_v1_PersistentVolumeSpec_To_core_PersistentVolumeSpec(in *v1.PersistentVolumeSpec, out *core.PersistentVolumeSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1_PersistentVolumeSpec_To_core_PersistentVolumeSpec(in, out, s)
|
||||
}
|
||||
|
||||
// Convert_Slice_string_To_Pointer_v1_LogStreamType is needed because decoding URL parameters requires manual assistance.
|
||||
func Convert_Slice_string_To_Pointer_v1_LogStreamType(in *[]string, out **v1.LogStreamType, s conversion.Scope) error {
|
||||
if len(*in) == 0 {
|
||||
return nil
|
||||
}
|
||||
temp := v1.LogStreamType((*in)[0])
|
||||
*out = &temp
|
||||
return nil
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ func TestPodLogOptions(t *testing.T) {
|
||||
sinceTime := metav1.NewTime(time.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC).Local())
|
||||
tailLines := int64(2)
|
||||
limitBytes := int64(3)
|
||||
v1StreamStderr := v1.LogStreamTypeStderr
|
||||
coreStreamStderr := core.LogStreamTypeStderr
|
||||
|
||||
versionedLogOptions := &v1.PodLogOptions{
|
||||
Container: "mycontainer",
|
||||
@ -62,6 +64,7 @@ func TestPodLogOptions(t *testing.T) {
|
||||
Timestamps: true,
|
||||
TailLines: &tailLines,
|
||||
LimitBytes: &limitBytes,
|
||||
Stream: &v1StreamStderr,
|
||||
}
|
||||
unversionedLogOptions := &core.PodLogOptions{
|
||||
Container: "mycontainer",
|
||||
@ -72,6 +75,7 @@ func TestPodLogOptions(t *testing.T) {
|
||||
Timestamps: true,
|
||||
TailLines: &tailLines,
|
||||
LimitBytes: &limitBytes,
|
||||
Stream: &coreStreamStderr,
|
||||
}
|
||||
expectedParameters := url.Values{
|
||||
"container": {"mycontainer"},
|
||||
@ -82,6 +86,7 @@ func TestPodLogOptions(t *testing.T) {
|
||||
"timestamps": {"true"},
|
||||
"tailLines": {"2"},
|
||||
"limitBytes": {"3"},
|
||||
"stream": {"Stderr"},
|
||||
}
|
||||
|
||||
codec := runtime.NewParameterCodec(legacyscheme.Scheme)
|
||||
|
Loading…
Reference in New Issue
Block a user