mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Add test to ensure backward compatability for timestamps
Change-Id: I63650c77e3d0ece06eb29efa5b8898b77db677fb
This commit is contained in:
		@@ -244,6 +244,29 @@ func TestEncodePtr(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestDecodeTimeStampWithoutQuotes(t *testing.T) {
 | 
			
		||||
	testYAML := []byte(`
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: Pod
 | 
			
		||||
metadata:
 | 
			
		||||
  creationTimestamp: 2018-08-30T14:10:58Z
 | 
			
		||||
  name: test
 | 
			
		||||
spec:
 | 
			
		||||
  containers: null
 | 
			
		||||
status: {}`)
 | 
			
		||||
	if obj, err := runtime.Decode(testapi.Default.Codec(), testYAML); err != nil {
 | 
			
		||||
		t.Fatalf("unable to decode yaml: %v", err)
 | 
			
		||||
	} else {
 | 
			
		||||
		if obj2, ok := obj.(*api.Pod); !ok {
 | 
			
		||||
			t.Fatalf("Got wrong type")
 | 
			
		||||
		} else {
 | 
			
		||||
			if obj2.ObjectMeta.CreationTimestamp.UnixNano() != parseTimeOrDie("2018-08-30T14:10:58Z").UnixNano() {
 | 
			
		||||
				t.Fatalf("Time stamps do not match")
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TestBadJSONRejection establishes that a JSON object without a kind or with
 | 
			
		||||
// an unknown kind will not be decoded without error.
 | 
			
		||||
func TestBadJSONRejection(t *testing.T) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user