Fixed and added tests

This commit is contained in:
Piotr Szczesniak
2016-02-08 15:03:59 +01:00
parent d2f11521cb
commit d9705940d6
13 changed files with 297 additions and 84 deletions

View File

@@ -100,9 +100,8 @@ func TestV1EncodeDecodeStatus(t *testing.T) {
}
}
func TestExperimentalEncodeDecodeStatus(t *testing.T) {
extensionCodec := Extensions.Codec()
encoded, err := runtime.Encode(extensionCodec, status)
func testEncodeDecodeStatus(t *testing.T, codec runtime.Codec) {
encoded, err := runtime.Encode(codec, status)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@@ -116,7 +115,7 @@ func TestExperimentalEncodeDecodeStatus(t *testing.T) {
if typeMeta.APIVersion != "v1" {
t.Errorf("APIVersion is not set to \"\". Got %s", encoded)
}
decoded, err := runtime.Decode(extensionCodec, encoded)
decoded, err := runtime.Decode(codec, encoded)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@@ -124,3 +123,11 @@ func TestExperimentalEncodeDecodeStatus(t *testing.T) {
t.Errorf("expected: %v, got: %v", status, decoded)
}
}
func TestAutoscalingEncodeDecodeStatus(t *testing.T) {
testEncodeDecodeStatus(t, Autoscaling.Codec())
}
func TestExperimentalEncodeDecodeStatus(t *testing.T) {
testEncodeDecodeStatus(t, Extensions.Codec())
}