public void AsOwner_ReturnsValidReference() { var parent = new V1Pod() { ApiVersion = V1Pod.KubeApiVersion, Kind = V1Pod.KubeKind, Metadata = new V1ObjectMeta() { Name = "test", NamespaceProperty = "default", Uid = "my-uid", }, }; var reference = parent.AsOwnerReference(); reference.Validate(); Assert.Equal(V1Pod.KubeApiVersion, reference.ApiVersion); Assert.Null(reference.BlockOwnerDeletion); Assert.Null(reference.Controller); Assert.Equal(V1Pod.KubeKind, reference.Kind); Assert.Equal("test", reference.Name); Assert.Equal("my-uid", reference.Uid); }
public void AsOwner_MatchesOwnedBy() { var parent = new V1Pod() { ApiVersion = V1Pod.KubeApiVersion, Kind = V1Pod.KubeKind, Metadata = new V1ObjectMeta() { Name = "test", NamespaceProperty = "default", Uid = "my-uid", }, }; var child = new V1Pod(); child.AddOwnerReference(parent.AsOwnerReference()); Assert.True(child.IsOwnedBy(parent)); }