From fd2d1a121b492dd65584e3c647df808a71400669 Mon Sep 17 00:00:00 2001 From: Dustin Jenkins Date: Fri, 8 Nov 2024 18:19:19 +0000 Subject: [PATCH] fix: test fixes --- .../desktop-template/start-software-sh.template | 13 +++++++------ .../org/opencadc/skaha/ExpiryTimeRenewalTest.java | 3 --- .../java/org/opencadc/skaha/SessionUtil.java | 8 ++++---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/deployment/helm/skaha/desktop-template/start-software-sh.template b/deployment/helm/skaha/desktop-template/start-software-sh.template index ff357dea..c8721568 100644 --- a/deployment/helm/skaha/desktop-template/start-software-sh.template +++ b/deployment/helm/skaha/desktop-template/start-software-sh.template @@ -18,10 +18,11 @@ get_resource_options() { else resources=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" https://(HOST)/skaha/(SKAHA_API_VERSION)/context` fi - core_default=`echo $resources | jq .cores.default` - core_options=`echo $resources | jq .cores.options[] | tr '\n' ' '` - ram_default=`echo $resources | jq .memoryGB.default` - ram_options=`echo $resources | jq .memoryGB.options[] | tr '\n' ' '` + + core_default=`echo $resources | jq .cores.default` + core_options=`echo $resources | jq .cores.options[] | tr '\n' ' '` + ram_default=`echo $resources | jq .memoryGB.default` + ram_options=`echo $resources | jq .memoryGB.options[] | tr '\n' ' '` } get_cores() { @@ -89,7 +90,7 @@ prompt_user() { if [ -z "${TOKEN}" ]; then handle_error "[skaha] No credentials to call back to Skaha with." else - app_id=`curl -s -L -k "x-auth-token-skaha: ${TOKEN}" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app` + app_id=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app` fi break elif [[ ${yn} == "y" || ${yn} == "Y" ]]; then @@ -101,7 +102,7 @@ prompt_user() { if [ -z "${TOKEN}" ]; then handle_error "[skaha] No credentials to call back to Skaha with." else - app_id=`curl -s -L -k "x-auth-token-skaha: ${TOKEN}" -d "cores=${cores}" -d "ram=$ram" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app` + app_id=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" -d "cores=${cores}" -d "ram=$ram" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app` fi break else diff --git a/skaha/src/intTest/java/org/opencadc/skaha/ExpiryTimeRenewalTest.java b/skaha/src/intTest/java/org/opencadc/skaha/ExpiryTimeRenewalTest.java index 3b9f883a..e3bf05dd 100644 --- a/skaha/src/intTest/java/org/opencadc/skaha/ExpiryTimeRenewalTest.java +++ b/skaha/src/intTest/java/org/opencadc/skaha/ExpiryTimeRenewalTest.java @@ -68,18 +68,15 @@ package org.opencadc.skaha; import ca.nrc.cadc.auth.AuthMethod; -import ca.nrc.cadc.net.HttpDelete; import ca.nrc.cadc.net.HttpPost; import ca.nrc.cadc.reg.Standards; import ca.nrc.cadc.reg.client.RegistryClient; import ca.nrc.cadc.util.Log4jInit; -import java.net.MalformedURLException; import java.net.URL; import java.security.PrivilegedExceptionAction; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.security.auth.Subject; diff --git a/skaha/src/intTest/java/org/opencadc/skaha/SessionUtil.java b/skaha/src/intTest/java/org/opencadc/skaha/SessionUtil.java index 0a4d8e81..e1b249be 100644 --- a/skaha/src/intTest/java/org/opencadc/skaha/SessionUtil.java +++ b/skaha/src/intTest/java/org/opencadc/skaha/SessionUtil.java @@ -117,8 +117,8 @@ public class SessionUtil { public static final URI SKAHA_SERVICE_ID = URI.create("ivo://cadc.nrc.ca/skaha"); private static final Logger LOGGER = Logger.getLogger(SessionUtil.class); private static final long ONE_SECOND = 1000L; - private static final long TIMEOUT_WAIT_FOR_SESSION_STARTUP_MS = 120L * SessionUtil.ONE_SECOND; - private static final long TIMEOUT_WAIT_FOR_SESSION_TERMINATE_MS = 120L * SessionUtil.ONE_SECOND; + private static final long TIMEOUT_WAIT_FOR_SESSION_STARTUP_MS = 180L * SessionUtil.ONE_SECOND; + private static final long TIMEOUT_WAIT_FOR_SESSION_TERMINATE_MS = 180L * SessionUtil.ONE_SECOND; static URI getSkahaServiceID() { final String configuredServiceID = System.getenv("SKAHA_SERVICE_ID"); @@ -126,7 +126,7 @@ static URI getSkahaServiceID() { } static void initializeCleanup(final URL sessionURL) throws Exception { - for (Session session : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING, Session.STATUS_SUCCEEDED)) { + for (Session session : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING)) { if (session.getType().equals(SessionAction.TYPE_DESKTOP_APP)) { // delete desktop-app String sessionID = session.getId(); @@ -139,7 +139,7 @@ static void initializeCleanup(final URL sessionURL) throws Exception { } int count = 0; - for (Session s : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING, Session.STATUS_SUCCEEDED)) { + for (Session s : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING)) { if (!s.getType().equals(SessionAction.TYPE_DESKTOP_APP)) { count++; }