fix dateformat rejected (#611)

* fix dateformat rejected

* fix format

* fix format
This commit is contained in:
Boshi Lian
2021-04-28 16:42:49 -07:00
committed by GitHub
parent 9e4ea2743e
commit 9bea20bd4f
2 changed files with 30 additions and 0 deletions

View File

@@ -130,6 +130,7 @@ namespace k8s
partial void CustomInitialize()
{
DeserializationSettings.Converters.Add(new V1Status.V1StatusObjectViewConverter());
SerializationSettings.DateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.ffffffK";
}
/// <summary>A <see cref="DelegatingHandler"/> that simply forwards a request with no further processing.</summary>

View File

@@ -326,6 +326,35 @@ namespace k8s.E2E
}
}
[MinikubeFact]
public async Task DatetimeFieldTest()
{
var kubernetes = CreateClient();
await kubernetes.CreateNamespacedEventAsync(
new Corev1Event(
new V1ObjectReference(
"v1alpha1",
kind: "Test",
name: "test",
namespaceProperty: "default",
resourceVersion: "1",
uid: "1"),
new V1ObjectMeta()
{
GenerateName = "started-",
},
action: "STARTED",
type: "Normal",
reason: "STARTED",
message: "Started",
eventTime: DateTime.Now,
firstTimestamp: DateTime.Now,
lastTimestamp: DateTime.Now,
reportingComponent: "37",
reportingInstance: "38"), "default").ConfigureAwait(false);
}
private static IKubernetes CreateClient()
{
return new Kubernetes(KubernetesClientConfiguration.BuildDefaultConfig());