diff --git a/adapter/kubernetes/src/test/java/com/vmware/admiral/adapter/kubernetes/service/KubernetesAdapterServiceTest.java b/adapter/kubernetes/src/test/java/com/vmware/admiral/adapter/kubernetes/service/KubernetesAdapterServiceTest.java index c0c8af86c..29456fdb1 100644 --- a/adapter/kubernetes/src/test/java/com/vmware/admiral/adapter/kubernetes/service/KubernetesAdapterServiceTest.java +++ b/adapter/kubernetes/src/test/java/com/vmware/admiral/adapter/kubernetes/service/KubernetesAdapterServiceTest.java @@ -132,7 +132,9 @@ public void testFetchLogs() throws Throwable { for (Container container : podState.pod.spec.containers) { LogServiceState logState = getDocument(LogServiceState.class, LogService - .FACTORY_LINK + podState.documentSelfLink + "-" + container.name); + .FACTORY_LINK + "/" + UriUtils.getLastPathSegment(podState.documentSelfLink) + + "-" + + container.name); assertEquals(service.containerNamesToLogs.get(container.name), new String(logState .logs, "UTF-8")); } diff --git a/compute/src/main/java/com/vmware/admiral/compute/content/kubernetes/KubernetesUtil.java b/compute/src/main/java/com/vmware/admiral/compute/content/kubernetes/KubernetesUtil.java index e6c4425e4..aca63f41f 100644 --- a/compute/src/main/java/com/vmware/admiral/compute/content/kubernetes/KubernetesUtil.java +++ b/compute/src/main/java/com/vmware/admiral/compute/content/kubernetes/KubernetesUtil.java @@ -382,7 +382,8 @@ public static Class getStateTypeFromSelfLink( } public static String buildLogUriPath(BaseKubernetesState state, String containerName) { - return UriUtils.buildUriPath(LogService.FACTORY_LINK, state.documentSelfLink + "-" + + return UriUtils.buildUriPath(LogService.FACTORY_LINK, + UriUtils.getLastPathSegment(state.documentSelfLink) + "-" + containerName); } diff --git a/compute/src/test/java/com/vmware/admiral/compute/kubernetes/PodLogServiceTest.java b/compute/src/test/java/com/vmware/admiral/compute/kubernetes/PodLogServiceTest.java index 89260e7c3..0fa6f2e6e 100644 --- a/compute/src/test/java/com/vmware/admiral/compute/kubernetes/PodLogServiceTest.java +++ b/compute/src/test/java/com/vmware/admiral/compute/kubernetes/PodLogServiceTest.java @@ -145,7 +145,8 @@ private void createLogStates(PodState podState) throws Throwable { for (int i = 0; i < podState.pod.spec.containers.size(); i++) { LogServiceState logState = new LogServiceState(); logState.logs = ("test-log-" + i).getBytes(); - logState.documentSelfLink = podState.documentSelfLink + "-" + podState.pod.spec + logState.documentSelfLink = UriUtils.getLastPathSegment(podState.documentSelfLink) + "-" + + podState.pod.spec .containers.get(i).name; logState = doPost(logState, LogService.FACTORY_LINK); assertNotNull(logState);