[ISSUE-88] Add env variable round-trip, profile-aware SSL, and getStack support #132

Merged
hitanshu merged 5 commits from Dave/CFTunnels:ISSUE-88 into test 2026-07-06 18:47:15 +00:00
3 changed files with 9 additions and 8 deletions
Showing only changes of commit da2db99755 - Show all commits

View File

@ -2,6 +2,7 @@ package com.hithomelabs.common.portainer.client;
import com.hithomelabs.common.portainer.client.exception.PortainerAuthenticationException;
import com.hithomelabs.common.portainer.client.exception.PortainerConnectionException;
import com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException;
import com.hithomelabs.common.portainer.client.exception.PortainerResourceNotFoundException;
import com.hithomelabs.common.portainer.model.EnvVariable;
import com.hithomelabs.common.portainer.model.PortainerAuthRequest;
@ -254,7 +255,7 @@ class PortainerApiClientTest {
@Test
void getStack_nullId_throwsException() {
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
assertThrows(PortainerDeploymentException.class,
() -> client.getStack(null));
verifyNoInteractions(restTemplate);
}
@ -417,14 +418,14 @@ class PortainerApiClientTest {
@Test
void redeployGitStack_nullId_throwsException() {
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
assertThrows(PortainerDeploymentException.class,
() -> client.redeployGitStack(null, 2L, true, null));
verifyNoInteractions(restTemplate);
}
@Test
void redeployGitStack_nullEndpointId_throwsException() {
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
assertThrows(PortainerDeploymentException.class,
() -> client.redeployGitStack(1L, null, true, null));
verifyNoInteractions(restTemplate);
}
@ -498,7 +499,7 @@ class PortainerApiClientTest {
anyLong()))
.thenReturn(responseEntity);
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
assertThrows(PortainerDeploymentException.class,
() -> client.redeployGitStack(1L, 2L, true, null));
}
}

View File

@ -29,14 +29,14 @@ class EnvVariableTest {
void nullName() throws JsonProcessingException {
EnvVariable env = new EnvVariable(null, "value");
String json = mapper.writeValueAsString(env);
assertTrue(json.contains("\"value\":\"value\""));
assertEquals("{\"name\":null,\"value\":\"value\"}", json);
}
@Test
void nullValue() throws JsonProcessingException {
EnvVariable env = new EnvVariable("name", null);
String json = mapper.writeValueAsString(env);
assertTrue(json.contains("\"name\":\"name\""));
assertEquals("{\"name\":\"name\",\"value\":null}", json);
}
@Test

View File

@ -61,8 +61,8 @@ class DeployServiceTest {
deployService.redeploy(STACK_ID);
verify(portainerApiClient).getStack(STACK_ID);
// When getEnv() returns null, null is passed to redeployGitStack no NPE
verify(portainerApiClient).redeployGitStack(STACK_ID, ENDPOINT_ID, true, null);
// When getEnv() returns null, an empty list is passed to redeployGitStack
verify(portainerApiClient).redeployGitStack(STACK_ID, ENDPOINT_ID, true, List.of());
}
@Test