Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Commit

Permalink
Removed using "/" for kubernetes log service
Browse files Browse the repository at this point in the history
For now "/" was used in the self link of the log document. The whole
container self link was used to generate the self link of the log. This
will not work with the latest xenon. Changed it for the current version
in order to avoid upgrade problems when using the latest xenon.
- Changed the generation of the id to be with only the id if the
container not the self link.
- Updated the tests

Change-Id: I2106ca10d084589bdb742f35576328179ee3dbf4
Reviewed-on: https://bellevue-ci.eng.vmware.com:8080/37392
Closures-Verified: jenkins <[email protected]>
Upgrade-Verified: jenkins <[email protected]>
Bellevue-Verified: jenkins <[email protected]>
CS-Verified: jenkins <[email protected]>
Reviewed-by: Antonio Filipov <[email protected]>
  • Loading branch information
gmuleshkov committed Jul 2, 2018
1 parent 423a0a2 commit 6f2a128
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ public static <T extends BaseKubernetesState> Class<T> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6f2a128

Please sign in to comment.