diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2023-09-26 10:13:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 10:13:59 +0200 |
commit | d19e05144be5491c90c74049d31c3b3830131501 (patch) | |
tree | 78fe1048d1baf020a802699628e1885f4936eed0 /configserver | |
parent | 76ca6ac06b3bf99a2d6a0d7d0ea14478d271b2d4 (diff) | |
parent | b3eaf33c686d78e66886c27260747d14fd6cf908 (diff) |
Merge pull request #28663 from vespa-engine/jonmv/log-tenant-with-session-not-found
Log tenant name when session not found
Diffstat (limited to 'configserver')
3 files changed, 6 insertions, 6 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java index 9533f04107d..63faf806e9c 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java @@ -1030,21 +1030,21 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye private Session validateThatLocalSessionIsNotActive(Tenant tenant, long sessionId) { Session session = getLocalSession(tenant, sessionId); if (Session.Status.ACTIVATE.equals(session.getStatus())) { - throw new IllegalArgumentException("Session is active: " + sessionId); + throw new IllegalArgumentException("Session " + sessionId + " for '" + tenant.getName() + "' is active"); } return session; } private Session getLocalSession(Tenant tenant, long sessionId) { Session session = tenant.getSessionRepository().getLocalSession(sessionId); - if (session == null) throw new NotFoundException("Session " + sessionId + " was not found"); + if (session == null) throw new NotFoundException("Local session " + sessionId + " for '" + tenant.getName() + "' was not found"); return session; } private RemoteSession getRemoteSession(Tenant tenant, long sessionId) { RemoteSession session = tenant.getSessionRepository().getRemoteSession(sessionId); - if (session == null) throw new NotFoundException("Session " + sessionId + " was not found"); + if (session == null) throw new NotFoundException("Remote session " + sessionId + " for '" + tenant.getName() + "' was not found"); return session; } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java index 104727cb4f3..333dae94769 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java @@ -605,7 +605,7 @@ public class ApplicationRepositoryTest { long sessionId = result.sessionId(); exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("Session is active: 2"); + exceptionRule.expectMessage("Session 2 for 'test1' is active"); applicationRepository.prepare(sessionId, prepareParams()); exceptionRule.expect(IllegalArgumentException.class); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java index 765523177a9..88aed6b058c 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java @@ -92,7 +92,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest { public void require_error_when_session_id_does_not_exist() throws Exception { // No session with this id exists HttpResponse response = request(HttpRequest.Method.PUT, 9999L); - assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "Session 9999 was not found"); + assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "Local session 9999 for 'test' was not found"); } @Test @@ -180,7 +180,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest { HttpResponse getResponse = request(HttpRequest.Method.GET, 9999L); assertHttpStatusCodeErrorCodeAndMessage(getResponse, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, - "Session 9999 was not found"); + "Remote session 9999 for 'test' was not found"); } @Test |