Hithomelabs/CFTunnels#88: address PR review - fix test expectations, import, and assertions
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m52s
sample gradle build and test / tag (push) Successful in 6s
sample gradle build and test / build_tag_push (push) Successful in 2m19s
Daily cloudflare API integration test / cloudflare-api-test (push) Successful in 1m54s
Promote image with tag test to prod / tag (push) Successful in 10s
Promote image with tag test to prod / build_tag_push (push) Successful in 19s
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m52s
sample gradle build and test / tag (push) Successful in 6s
sample gradle build and test / build_tag_push (push) Successful in 2m19s
Daily cloudflare API integration test / cloudflare-api-test (push) Successful in 1m54s
Promote image with tag test to prod / tag (push) Successful in 10s
Promote image with tag test to prod / build_tag_push (push) Successful in 19s
This commit is contained in:
parent
07b70e633d
commit
da2db99755
@ -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.PortainerAuthenticationException;
|
||||||
import com.hithomelabs.common.portainer.client.exception.PortainerConnectionException;
|
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.client.exception.PortainerResourceNotFoundException;
|
||||||
import com.hithomelabs.common.portainer.model.EnvVariable;
|
import com.hithomelabs.common.portainer.model.EnvVariable;
|
||||||
import com.hithomelabs.common.portainer.model.PortainerAuthRequest;
|
import com.hithomelabs.common.portainer.model.PortainerAuthRequest;
|
||||||
@ -254,7 +255,7 @@ class PortainerApiClientTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getStack_nullId_throwsException() {
|
void getStack_nullId_throwsException() {
|
||||||
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
|
assertThrows(PortainerDeploymentException.class,
|
||||||
() -> client.getStack(null));
|
() -> client.getStack(null));
|
||||||
verifyNoInteractions(restTemplate);
|
verifyNoInteractions(restTemplate);
|
||||||
}
|
}
|
||||||
@ -417,14 +418,14 @@ class PortainerApiClientTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void redeployGitStack_nullId_throwsException() {
|
void redeployGitStack_nullId_throwsException() {
|
||||||
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
|
assertThrows(PortainerDeploymentException.class,
|
||||||
() -> client.redeployGitStack(null, 2L, true, null));
|
() -> client.redeployGitStack(null, 2L, true, null));
|
||||||
verifyNoInteractions(restTemplate);
|
verifyNoInteractions(restTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void redeployGitStack_nullEndpointId_throwsException() {
|
void redeployGitStack_nullEndpointId_throwsException() {
|
||||||
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
|
assertThrows(PortainerDeploymentException.class,
|
||||||
() -> client.redeployGitStack(1L, null, true, null));
|
() -> client.redeployGitStack(1L, null, true, null));
|
||||||
verifyNoInteractions(restTemplate);
|
verifyNoInteractions(restTemplate);
|
||||||
}
|
}
|
||||||
@ -498,7 +499,7 @@ class PortainerApiClientTest {
|
|||||||
anyLong()))
|
anyLong()))
|
||||||
.thenReturn(responseEntity);
|
.thenReturn(responseEntity);
|
||||||
|
|
||||||
assertThrows(com.hithomelabs.common.portainer.client.exception.PortainerDeploymentException.class,
|
assertThrows(PortainerDeploymentException.class,
|
||||||
() -> client.redeployGitStack(1L, 2L, true, null));
|
() -> client.redeployGitStack(1L, 2L, true, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,14 +29,14 @@ class EnvVariableTest {
|
|||||||
void nullName() throws JsonProcessingException {
|
void nullName() throws JsonProcessingException {
|
||||||
EnvVariable env = new EnvVariable(null, "value");
|
EnvVariable env = new EnvVariable(null, "value");
|
||||||
String json = mapper.writeValueAsString(env);
|
String json = mapper.writeValueAsString(env);
|
||||||
assertTrue(json.contains("\"value\":\"value\""));
|
assertEquals("{\"name\":null,\"value\":\"value\"}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void nullValue() throws JsonProcessingException {
|
void nullValue() throws JsonProcessingException {
|
||||||
EnvVariable env = new EnvVariable("name", null);
|
EnvVariable env = new EnvVariable("name", null);
|
||||||
String json = mapper.writeValueAsString(env);
|
String json = mapper.writeValueAsString(env);
|
||||||
assertTrue(json.contains("\"name\":\"name\""));
|
assertEquals("{\"name\":\"name\",\"value\":null}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -61,8 +61,8 @@ class DeployServiceTest {
|
|||||||
deployService.redeploy(STACK_ID);
|
deployService.redeploy(STACK_ID);
|
||||||
|
|
||||||
verify(portainerApiClient).getStack(STACK_ID);
|
verify(portainerApiClient).getStack(STACK_ID);
|
||||||
// When getEnv() returns null, null is passed to redeployGitStack — no NPE
|
// When getEnv() returns null, an empty list is passed to redeployGitStack
|
||||||
verify(portainerApiClient).redeployGitStack(STACK_ID, ENDPOINT_ID, true, null);
|
verify(portainerApiClient).redeployGitStack(STACK_ID, ENDPOINT_ID, true, List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user