skodjob / odh-e2e

Kubernetes native tests for opendatahub operator
Apache License 2.0
2 stars 4 forks source link

Message: parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00"? #160

Closed jiridanek closed 1 week ago

jiridanek commented 1 week ago
2024-10-16T12:37:00 ERROR [TestExceptionCallbackListener:32] Test failed at Test execution : Failure executing: GET at: https://api.crc.testing:6443/api/v1/namespaces/redhat-ods-operator/pods/rhods-operator-76bb96fb9d-qg2cs/log?pretty=false&sinceTime=2024-10-16T14:36:58+02:00. Message: parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00". Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00", metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://api.crc.testing:6443/api/v1/namespaces/redhat-ods-operator/pods/rhods-operator-76bb96fb9d-qg2cs/log?pretty=false&sinceTime=2024-10-16T14:36:58+02:00. Message: parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00". Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00", metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:660)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:640)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.assertResponseCode(OperationSupport.java:589)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleRaw(OperationSupport.java:739)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleRawGet(OperationSupport.java:474)
    at io.fabric8.kubernetes.client.dsl.internal.core.v1.PodOperationsImpl.doGetLog(PodOperationsImpl.java:133)
    at io.fabric8.kubernetes.client.dsl.internal.core.v1.PodOperationsImpl.getLog(PodOperationsImpl.java:141)
    at io.fabric8.kubernetes.client.dsl.internal.core.v1.PodOperationsImpl.getLog(PodOperationsImpl.java:166)
    at io.fabric8.kubernetes.client.utils.internal.PodOperationUtil.getLog(PodOperationUtil.java:109)
    at io.fabric8.kubernetes.client.dsl.internal.apps.v1.ReplicaSetOperationsImpl.getLog(ReplicaSetOperationsImpl.java:86)
    at io.fabric8.kubernetes.client.dsl.internal.apps.v1.DeploymentOperationsImpl.getLog(DeploymentOperationsImpl.java:130)
    at io.fabric8.kubernetes.client.dsl.internal.apps.v1.RollableScalableResourceOperation.getLog(RollableScalableResourceOperation.java:89)
    at io.odh.test.utils.UpgradeUtils.deploymentLogIsErrorEmpty(UpgradeUtils.java:20)
    at io.odh.test.e2e.upgrade.OlmUpgradeST.testUpgradeOlm(OlmUpgradeST.java:142)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:728)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:218)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:214)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:139)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
    at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:63)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
jiridanek commented 1 week ago

From https://pkg.go.dev/time#example-Parse

    // Some valid layouts are invalid time values, due to format specifiers
    // such as _ for space padding and Z for zone information.
    // For example the RFC3339 layout 2006-01-02T15:04:05Z07:00
    // contains both Z and a time zone offset in order to handle both valid options:
    // 2006-01-02T15:04:05Z
    // 2006-01-02T15:04:05+07:00
    t, _ = time.Parse(time.RFC3339, "2006-01-02T15:04:05Z")
    fmt.Println(t)
    t, _ = time.Parse(time.RFC3339, "2006-01-02T15:04:05+07:00")
    fmt.Println(t)
    _, err := time.Parse(time.RFC3339, time.RFC3339)
    fmt.Println("error", err) // Returns an error as the layout is not a valid time value

Looks like the right Java format for this should be

yyyy-MM-dd'T'HH:mm:ssXXX

Which is exactly what we have already. Wat!?!

jiridanek commented 1 week ago
oc get --raw '/api/v1/namespaces/redhat-ods-operator/pods/rhods-operator-76bb96fb9d-qg2cs/log?pretty=false&sinceTime=2024-10-16T14:36:58+02:00'
Error from server (BadRequest): parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00"

easily reproduced

jiridanek commented 1 week ago

That + in the URL needs to be encoded to %2b, for some reason fabric8 does not do that.

Also, we are using new Date() that could be replaced with Instant.now(). Instants don't carry a timezone and are always holding UTC time, which does not have no + in them.

jiridanek commented 1 week ago

I'm blaming fabric8 kubernetes client