mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #102338 from mengjiao-liu/update-cronjob-to-batchv1-kubectl
Promote cronjob to batch/v1: kubectl sparse_test file
This commit is contained in:
commit
17f5c8866a
@ -20,7 +20,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/api/batch/v1"
|
"k8s.io/api/batch/v1"
|
||||||
"k8s.io/api/batch/v1beta1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/equality"
|
"k8s.io/apimachinery/pkg/api/equality"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@ -28,9 +27,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCronJob(t *testing.T) {
|
func TestCronJob(t *testing.T) {
|
||||||
src := &v1beta1.CronJob{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
|
src := &v1.CronJob{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
|
||||||
|
|
||||||
encoder := Codecs.LegacyCodec(v1.SchemeGroupVersion, v1beta1.SchemeGroupVersion)
|
encoder := Codecs.LegacyCodec(v1.SchemeGroupVersion)
|
||||||
cronjobBytes, err := runtime.Encode(encoder, src)
|
cronjobBytes, err := runtime.Encode(encoder, src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -46,7 +45,7 @@ func TestCronJob(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clear typemeta
|
// clear typemeta
|
||||||
uncastDst.(*v1beta1.CronJob).TypeMeta = metav1.TypeMeta{}
|
uncastDst.(*v1.CronJob).TypeMeta = metav1.TypeMeta{}
|
||||||
|
|
||||||
if !equality.Semantic.DeepEqual(src, uncastDst) {
|
if !equality.Semantic.DeepEqual(src, uncastDst) {
|
||||||
t.Fatal(diff.ObjectDiff(src, uncastDst))
|
t.Fatal(diff.ObjectDiff(src, uncastDst))
|
||||||
|
Loading…
Reference in New Issue
Block a user