massive changes
This commit is contained in:
@@ -167,8 +167,8 @@ func TestEncode_Ptr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
obj := runtime.Object(pod)
|
||||
data, err := latest.Codec.Encode(obj)
|
||||
obj2, err2 := latest.Codec.Decode(data)
|
||||
data, err := latest.GroupOrDie("").Codec.Encode(obj)
|
||||
obj2, err2 := latest.GroupOrDie("").Codec.Decode(data)
|
||||
if err != nil || err2 != nil {
|
||||
t.Fatalf("Failure: '%v' '%v'", err, err2)
|
||||
}
|
||||
@@ -182,11 +182,11 @@ func TestEncode_Ptr(t *testing.T) {
|
||||
|
||||
func TestBadJSONRejection(t *testing.T) {
|
||||
badJSONMissingKind := []byte(`{ }`)
|
||||
if _, err := latest.Codec.Decode(badJSONMissingKind); err == nil {
|
||||
if _, err := latest.GroupOrDie("").Codec.Decode(badJSONMissingKind); err == nil {
|
||||
t.Errorf("Did not reject despite lack of kind field: %s", badJSONMissingKind)
|
||||
}
|
||||
badJSONUnknownType := []byte(`{"kind": "bar"}`)
|
||||
if _, err1 := latest.Codec.Decode(badJSONUnknownType); err1 == nil {
|
||||
if _, err1 := latest.GroupOrDie("").Codec.Decode(badJSONUnknownType); err1 == nil {
|
||||
t.Errorf("Did not reject despite use of unknown type: %s", badJSONUnknownType)
|
||||
}
|
||||
/*badJSONKindMismatch := []byte(`{"kind": "Pod"}`)
|
||||
@@ -202,7 +202,7 @@ func BenchmarkEncode(b *testing.B) {
|
||||
apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed))
|
||||
apiObjectFuzzer.Fuzz(&pod)
|
||||
for i := 0; i < b.N; i++ {
|
||||
latest.Codec.Encode(&pod)
|
||||
latest.GroupOrDie("").Codec.Encode(&pod)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,9 +220,9 @@ func BenchmarkDecode(b *testing.B) {
|
||||
pod := api.Pod{}
|
||||
apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed))
|
||||
apiObjectFuzzer.Fuzz(&pod)
|
||||
data, _ := latest.Codec.Encode(&pod)
|
||||
data, _ := latest.GroupOrDie("").Codec.Encode(&pod)
|
||||
for i := 0; i < b.N; i++ {
|
||||
latest.Codec.Decode(data)
|
||||
latest.GroupOrDie("").Codec.Decode(data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,10 +230,10 @@ func BenchmarkDecodeInto(b *testing.B) {
|
||||
pod := api.Pod{}
|
||||
apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed))
|
||||
apiObjectFuzzer.Fuzz(&pod)
|
||||
data, _ := latest.Codec.Encode(&pod)
|
||||
data, _ := latest.GroupOrDie("").Codec.Encode(&pod)
|
||||
for i := 0; i < b.N; i++ {
|
||||
obj := api.Pod{}
|
||||
latest.Codec.DecodeInto(data, &obj)
|
||||
latest.GroupOrDie("").Codec.DecodeInto(data, &obj)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ func BenchmarkDecodeJSON(b *testing.B) {
|
||||
pod := api.Pod{}
|
||||
apiObjectFuzzer := apitesting.FuzzerFor(nil, "", rand.NewSource(benchmarkSeed))
|
||||
apiObjectFuzzer.Fuzz(&pod)
|
||||
data, _ := latest.Codec.Encode(&pod)
|
||||
data, _ := latest.GroupOrDie("").Codec.Encode(&pod)
|
||||
for i := 0; i < b.N; i++ {
|
||||
obj := api.Pod{}
|
||||
json.Unmarshal(data, &obj)
|
||||
|
Reference in New Issue
Block a user