From 476b75735e18e407b074bb645d384dccea2ac1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emirhan=20Durmu=C5=9F?= Date: Wed, 5 Nov 2025 00:44:46 +0300 Subject: [PATCH] roothostaccess to hostnetworkmode and isprivileged, registry updated, service.internal host updated, process manager containersMonitor thread notified when loading microservices --- build.gradle | 2 +- .../eclipse/iofog/field_agent/FieldAgent.java | 11 ++- .../iofog/microservice/Microservice.java | 19 +++- .../eclipse/iofog/microservice/Registry.java | 41 +------- .../iofog/process_manager/DockerUtil.java | 95 ++++++++++++++++--- .../iofog/process_manager/ProcessManager.java | 32 +++++-- .../utils/configuration/Configuration.java | 29 ++++-- .../command_line/CommandLineActionTest.java | 4 +- .../iofog/field_agent/FieldAgentTest.java | 3 +- .../iofog/process_manager/DockerUtilTest.java | 14 +-- .../iofog/utils/CmdPropertiesTest.java | 2 +- 11 files changed, 164 insertions(+), 88 deletions(-) diff --git a/build.gradle b/build.gradle index e6b7a7b..85eaf62 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { allprojects { group = 'org.eclipse' - version = '3.5.2' + version = '3.5.3' } subprojects { diff --git a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/field_agent/FieldAgent.java b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/field_agent/FieldAgent.java index c71a83b..65358d2 100644 --- a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/field_agent/FieldAgent.java +++ b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/field_agent/FieldAgent.java @@ -437,6 +437,10 @@ private final Future processChanges(JsonObject changes) { resetChanges = false; } } + + // Notify ProcessManager to immediately restart monitoring thread + // This ensures containers are processed without waiting for the next scheduled interval + ProcessManager.getInstance().update(); if (execSessions) { logDebug("Processing exec sessions changes"); @@ -1019,7 +1023,8 @@ private Function containerJsonObjectToMicroserviceFunc microservice.setRuntime(jsonObj.getString("runtime")); } microservice.setRebuild(jsonObj.getBoolean("rebuild")); - microservice.setRootHostAccess(jsonObj.getBoolean("rootHostAccess")); + microservice.setHostNetworkMode(jsonObj.getBoolean("hostNetworkMode")); + microservice.setIsPrivileged(jsonObj.getBoolean("isPrivileged")); microservice.setRegistryId(jsonObj.getInt("registryId")); microservice.setSchedule(jsonObj.getInt("schedule")); microservice.setLogSize(jsonObj.getJsonNumber("logSize").longValue()); @@ -1033,6 +1038,7 @@ private Function containerJsonObjectToMicroserviceFunc microservice.setRouter(jsonObj.getBoolean("isRouter")); if (jsonObj.getBoolean("isRouter")) { Configuration.setRouterUuid(jsonObj.getString("uuid")); + Configuration.setRouterInterior(jsonObj.getBoolean("hostNetworkMode")); } microservice.setExecEnabled(jsonObj.getBoolean("execEnabled")); @@ -1914,6 +1920,9 @@ public void start() { List microservices = loadMicroservices(!isConnected); processMicroserviceConfig(microservices); processRoutes(microservices); + // Notify ProcessManager to immediately restart monitoring thread + // This ensures containers are processed during initialization without waiting + ProcessManager.getInstance().update(); loadEdgeResources(!isConnected); } diff --git a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Microservice.java b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Microservice.java index 6d14cb0..8b91869 100644 --- a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Microservice.java +++ b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Microservice.java @@ -34,7 +34,8 @@ public class Microservice { private int registryId; private String containerIpAddress; private boolean rebuild; - private boolean rootHostAccess; + private boolean hostNetworkMode; + private boolean isPrivileged; private long logSize; private List volumeMappings; private boolean isUpdating; @@ -153,12 +154,20 @@ public String getImageName() { return imageName; } - public boolean isRootHostAccess() { - return rootHostAccess; + public boolean isPrivileged() { + return isPrivileged; } - public void setRootHostAccess(boolean rootHostAccess) { - this.rootHostAccess = rootHostAccess; + public boolean isHostNetworkMode() { + return hostNetworkMode; + } + + public void setHostNetworkMode(boolean hostNetworkMode) { + this.hostNetworkMode = hostNetworkMode; + } + + public void setIsPrivileged(boolean isPrivileged) { + this.isPrivileged = isPrivileged; } public boolean isExecEnabled() { diff --git a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Registry.java b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Registry.java index ec17cf6..c74f922 100644 --- a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Registry.java +++ b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/microservice/Registry.java @@ -24,21 +24,14 @@ public class Registry { private final int id; private final String url; private final boolean isPublic; - private final boolean secure; - private final String certificate; - private final boolean requiresCertificate; private final String userName; private final String password; private final String userEmail; - private Registry(final int id, final String url, final boolean isPublic, final boolean secure, final String certificate, final boolean requiresCertificate, - final String userName, final String password, final String userEmail) { + private Registry(final int id, final String url, final boolean isPublic, final String userName, final String password, final String userEmail) { this.id = id; this.url = url; this.isPublic = isPublic; - this.secure = secure; - this.certificate = certificate; - this.requiresCertificate = requiresCertificate; this.userName = userName; this.password = password; this.userEmail = userEmail; @@ -56,18 +49,6 @@ public boolean getIsPublic() { return isPublic; } - public boolean isSecure() { - return secure; - } - - public String getCertificate() { - return certificate; - } - - public boolean isRequiresCertificate() { - return requiresCertificate; - } - public String getUserName() { return userName; } @@ -100,9 +81,6 @@ public static class RegistryBuilder { private int id; private String url; private boolean isPublic; - private boolean secure; - private String certificate; - private boolean requiresCertificate; private String userName; private String password; private String userEmail; @@ -122,21 +100,6 @@ public RegistryBuilder setIsPublic(boolean isPublic) { return this; } - public RegistryBuilder setSecure(boolean secure) { - this.secure = secure; - return this; - } - - public RegistryBuilder setCertificate(String certificate) { - this.certificate = certificate; - return this; - } - - public RegistryBuilder setRequiresCertificate(boolean requiresCertificate) { - this.requiresCertificate = requiresCertificate; - return this; - } - public RegistryBuilder setUserName(String userName) { this.userName = userName; return this; @@ -153,7 +116,7 @@ public RegistryBuilder setUserEmail(String userEmail) { } public Registry build() { - return new Registry(id, url, isPublic, secure, certificate, requiresCertificate, userName, password, userEmail); + return new Registry(id, url, isPublic, userName, password, userEmail); } } } diff --git a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/DockerUtil.java b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/DockerUtil.java index 9108f33..7982ee1 100755 --- a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/DockerUtil.java +++ b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/DockerUtil.java @@ -521,7 +521,7 @@ public long getContainerStartedAt(String id) { public boolean areMicroserviceAndContainerEqual(String containerId, Microservice microservice) { LoggingService.logDebug(MODULE_NAME ,"Are Microservice And Container Equal microservice : " + microservice.getImageName() + "container id : " + containerId); InspectContainerResponse inspectInfo = dockerClient.inspectContainerCmd(containerId).exec(); - return isPortMappingEqual(inspectInfo, microservice) && isNetworkModeEqual(inspectInfo, microservice); + return isPortMappingEqual(inspectInfo, microservice) && isNetworkModeEqual(inspectInfo, microservice) && isEnvVarsEqual(inspectInfo, microservice); } /** @@ -534,10 +534,10 @@ public boolean areMicroserviceAndContainerEqual(String containerId, Microservice */ private boolean isNetworkModeEqual(InspectContainerResponse inspectInfo, Microservice microservice) { LoggingService.logDebug(MODULE_NAME ,"is NetworkMode Equal for microservice : " + microservice.getImageName()); - boolean isRootHostAccess = microservice.isRootHostAccess(); + boolean isHostNetworkMode = microservice.isHostNetworkMode(); HostConfig hostConfig = inspectInfo.getHostConfig(); - return (isRootHostAccess && "host".equals(hostConfig.getNetworkMode())) - || !isRootHostAccess && (hostConfig != null && hostConfig.getExtraHosts() != null && hostConfig.getExtraHosts().length > 0); + return (isHostNetworkMode && "host".equals(hostConfig.getNetworkMode())) + || !isHostNetworkMode && (hostConfig != null && hostConfig.getExtraHosts() != null && hostConfig.getExtraHosts().length > 0); } /** @@ -560,6 +560,58 @@ private boolean isPortMappingEqual(InspectContainerResponse inspectInfo, Microse return areEqual; } + /** + * compares if microservice environment variables are equal to container environment variables + * + * @param inspectInfo result of docker inspect command + * @param microservice microservice + * @return boolean + */ + private boolean isEnvVarsEqual(InspectContainerResponse inspectInfo, Microservice microservice) { + LoggingService.logDebug(MODULE_NAME, "is EnvVars Equal for microservice : " + microservice.getImageName()); + + // Get microservice environment variables + List microserviceEnvVars = microservice.getEnvVars(); + if (microserviceEnvVars == null || microserviceEnvVars.isEmpty()) { + microserviceEnvVars = new ArrayList<>(); + } + + // Get container environment variables from inspect info + String[] containerEnvArray = inspectInfo.getConfig().getEnv(); + Map containerEnvVars = new HashMap<>(); + if (containerEnvArray != null) { + for (String envVar : containerEnvArray) { + if (envVar != null && envVar.contains("=")) { + String[] parts = envVar.split("=", 2); + if (parts.length == 2) { + containerEnvVars.put(parts[0], parts[1]); + } + } + } + } + + // Check if all microservice env vars exist in container with same values + for (EnvVar microserviceEnvVar : microserviceEnvVars) { + String key = microserviceEnvVar.getKey(); + String expectedValue = microserviceEnvVar.getValue(); + + if (!containerEnvVars.containsKey(key)) { + LoggingService.logDebug(MODULE_NAME, "Env var key not found in container: " + key); + return false; + } + + String actualValue = containerEnvVars.get(key); + if (!expectedValue.equals(actualValue)) { + LoggingService.logDebug(MODULE_NAME, "Env var value mismatch for key " + key + + ". Expected: " + expectedValue + ", Actual: " + actualValue); + return false; + } + } + + LoggingService.logDebug(MODULE_NAME, "Env vars are equal for microservice " + microservice.getImageName()); + return true; + } + private List getMicroservicePorts(Microservice microservice) { LoggingService.logDebug(MODULE_NAME ,"get list of Microservice Ports for microservice : " + microservice.getImageName()); return microservice.getPortMappings() != null ? microservice.getPortMappings() : new ArrayList<>(); @@ -763,12 +815,19 @@ public String createContainer(Microservice microservice, String host) throws Not } // Add service.local host for non-router microservices - if (!microservice.isRootHostAccess() && !microservice.isRouter()) { - String routerIP = getRouterMicroserviceIP(); - if (routerIP != null) { + if (!microservice.isHostNetworkMode() && !microservice.isRouter()) { + if (!Configuration.isRouterInterior()) { + String routerIP = getRouterMicroserviceIP(); + if (routerIP != null) { + String[] newHosts = new String[hosts.length + 1]; + System.arraycopy(hosts, 0, newHosts, 0, hosts.length); + newHosts[hosts.length] = "service.local:" + routerIP; + hosts = newHosts; + } + } else { String[] newHosts = new String[hosts.length + 1]; System.arraycopy(hosts, 0, newHosts, 0, hosts.length); - newHosts[hosts.length] = "service.local:" + routerIP; + newHosts[hosts.length] = "service.local:" + host; hosts = newHosts; } } @@ -853,23 +912,29 @@ public String createContainer(Microservice microservice, String host) throws Not } if (SystemUtils.IS_OS_WINDOWS) { - if(microservice.isRootHostAccess()){ - hostConfig.withNetworkMode("host").withExtraHosts(hosts).withPrivileged(true); + if(microservice.isHostNetworkMode()){ + hostConfig.withNetworkMode("host").withExtraHosts(hosts); } else if(hosts[hosts.length - 1] != null) { - hostConfig.withNetworkMode("pot").withExtraHosts(hosts).withPrivileged(false); + hostConfig.withNetworkMode("pot").withExtraHosts(hosts); } } else if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC) { - if(microservice.isRootHostAccess()){ - hostConfig.withNetworkMode("host").withPrivileged(true); + if(microservice.isHostNetworkMode()){ + hostConfig.withNetworkMode("host"); } else if(hosts[hosts.length - 1] != null) { - hostConfig.withNetworkMode("pot").withExtraHosts(hosts).withPrivileged(false); + hostConfig.withNetworkMode("pot").withExtraHosts(hosts); } } + if (microservice.isPrivileged()) { + hostConfig.withPrivileged(true); + } else { + hostConfig.withPrivileged(false); + } + if (microservice.getRuntime() != null && !microservice.getRuntime().isEmpty()) { hostConfig.withRuntime(microservice.getRuntime()); } - + // TODO: Test cdi devices if this one is not working, either add capabilities "gpu" or add controller microservice cdi definition capabilities if (microservice.getCdiDevs() != null && !microservice.getCdiDevs().isEmpty()) { List deviceIds = microservice.getCdiDevs(); DeviceRequest deviceRequest = new DeviceRequest() diff --git a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/ProcessManager.java b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/ProcessManager.java index 3f0a51e..878e78a 100644 --- a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/ProcessManager.java +++ b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/process_manager/ProcessManager.java @@ -52,6 +52,7 @@ public class ProcessManager implements IOFogModule { private DockerUtil docker; private ContainerManager containerManager; private static ProcessManager instance; + private final Object monitorLock = new Object(); private ProcessManager() { } @@ -91,6 +92,18 @@ private void updateRegistriesStatus() { */ public void update() { updateRegistriesStatus(); + // Notify the monitor thread to restart immediately instead of waiting + notifyMonitorThread(); + } + + /** + * Notifies the containers monitor thread to wake up immediately + * and process microservice changes without waiting for the next scheduled interval + */ + private void notifyMonitorThread() { + synchronized (monitorLock) { + monitorLock.notifyAll(); + } } /** @@ -98,19 +111,26 @@ public void update() { * removes {@link Container} if does not exists in list of {@link Microservice} * restarts {@link Container} if it has been stopped * updates {@link Container} if restarting failed! + * + * Uses wait/notify pattern to allow immediate restart when microservices change, + * instead of waiting for the full sleep interval. */ private final Runnable containersMonitor = () -> { while (true) { - try { - Thread.sleep(Configuration.getMonitorContainersStatusFreqSeconds() * 1000); - } catch (InterruptedException e) { - logError("Error while sleeping thread", - new AgentSystemException(e.getMessage(), e)); + synchronized (monitorLock) { + try { + // Wait for the configured interval, but can be woken up early by notifyMonitorThread() + monitorLock.wait(Configuration.getMonitorContainersStatusFreqSeconds() * 1000); + } catch (InterruptedException e) { + logError("Error while waiting for monitor interval", + new AgentSystemException(e.getMessage(), e)); + // Restore interrupted status + Thread.currentThread().interrupt(); + } } logDebug("Start Monitoring containers"); try { - handleLatestMicroservices(); deleteRemainingMicroservices(); updateRunningMicroservicesCount(); diff --git a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/utils/configuration/Configuration.java b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/utils/configuration/Configuration.java index 7717bdd..1a45469 100644 --- a/iofog-agent-daemon/src/main/java/org/eclipse/iofog/utils/configuration/Configuration.java +++ b/iofog-agent-daemon/src/main/java/org/eclipse/iofog/utils/configuration/Configuration.java @@ -137,6 +137,7 @@ public final class Configuration { private static String tlsCert; private static String tlsKey; private static String routerUuid; + private static boolean isRouterInterior; private static boolean devMode; public static boolean isDevMode() { @@ -159,6 +160,14 @@ public static String getRouterHost() { return routerHost; } + public static boolean isRouterInterior() { + return isRouterInterior; + } + + public static void setRouterInterior(boolean isRouterInterior) { + Configuration.isRouterInterior = isRouterInterior; + } + public static void setRouterHost(String routerHost) { Configuration.routerHost = routerHost; } @@ -175,25 +184,25 @@ private static void updateAutomaticConfigParams() { LoggingService.logInfo(MODULE_NAME, "Start update Automatic ConfigParams "); switch (fogType) { case ARM: - statusReportFreqSeconds = 5; - pingControllerFreqSeconds = 60; + statusReportFreqSeconds = 5; // + pingControllerFreqSeconds = 30; speedCalculationFreqMinutes = 1; - monitorContainersStatusFreqSeconds = 10; - monitorRegistriesStatusFreqSeconds = 60; + monitorContainersStatusFreqSeconds = 5; + monitorRegistriesStatusFreqSeconds = 60; // getUsageDataFreqSeconds = 5; dockerApiVersion = "1.45"; - setSystemTimeFreqSeconds = 60; + setSystemTimeFreqSeconds = 5; monitorSshTunnelStatusFreqSeconds = 30; break; case INTEL_AMD: - statusReportFreqSeconds = 5; - pingControllerFreqSeconds = 60; + statusReportFreqSeconds = 5; // + pingControllerFreqSeconds = 30; speedCalculationFreqMinutes = 1; - monitorContainersStatusFreqSeconds = 10; - monitorRegistriesStatusFreqSeconds = 60; + monitorContainersStatusFreqSeconds = 5; + monitorRegistriesStatusFreqSeconds = 60; // getUsageDataFreqSeconds = 5; dockerApiVersion = "1.45"; - setSystemTimeFreqSeconds = 60; + setSystemTimeFreqSeconds = 5; monitorSshTunnelStatusFreqSeconds = 30; break; } diff --git a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/command_line/CommandLineActionTest.java b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/command_line/CommandLineActionTest.java index bccc9b0..6db4346 100644 --- a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/command_line/CommandLineActionTest.java +++ b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/command_line/CommandLineActionTest.java @@ -93,7 +93,7 @@ public void setup() { .thenReturn(new HashMap<>()) .thenThrow(new Exception("item not found or defined more than once")); - Mockito.when(CmdProperties.getVersion()).thenReturn("3.5.2"); + Mockito.when(CmdProperties.getVersion()).thenReturn("3.5.3"); Mockito.when(CmdProperties.getVersionMessage()).thenReturn(version); Mockito.when(CmdProperties.getDeprovisionMessage()).thenReturn("Deprovisioning from controller ... %s"); Mockito.when(CmdProperties.getProvisionMessage()).thenReturn("Provisioning with key \"%s\" ... Result: %s"); @@ -364,7 +364,7 @@ private static boolean isEqual(List list1, List list2) { "0.00 MB\\nSystem Available Memory : " + "0.00 MB\\nSystem Total CPU : 0.00 %"; - private String version = "ioFog Agent 3.5.2 \n" + + private String version = "ioFog Agent 3.5.3 \n" + "Copyright (c) 2023 Datasance Teknoloji A.S. \n" + "Eclipse ioFog is provided under the Eclipse Public License 2.0 (EPL-2.0) \n" + "https://www.eclipse.org/legal/epl-v20.html"; diff --git a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/field_agent/FieldAgentTest.java b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/field_agent/FieldAgentTest.java index 30c4a2e..018bd54 100644 --- a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/field_agent/FieldAgentTest.java +++ b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/field_agent/FieldAgentTest.java @@ -565,7 +565,8 @@ public void testProvisionWhenControllerStatusIsProvisionedAndOrchestratorReturns .add("config", "config") .add("rebuild", false) .add("delete", false) - .add("rootHostAccess", false) + .add("hostNetworkMode", false) + .add("isPrivileged", false) .add("platform", "platform") .add("runtime", "runtime") .add("runAsUser", "runAsUser") diff --git a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/process_manager/DockerUtilTest.java b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/process_manager/DockerUtilTest.java index 2d8a34b..e3c10f5 100644 --- a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/process_manager/DockerUtilTest.java +++ b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/process_manager/DockerUtilTest.java @@ -771,7 +771,7 @@ public void testAreMicroserviceAndContainerEqualWhenContainerAndMicorserivceAreE Mockito.when(inspectContainerResponse.getHostConfig()).thenReturn(hostConfig); Mockito.when(hostConfig.getExtraHosts()).thenReturn(extraHost); Mockito.when(hostConfig.getNetworkMode()).thenReturn("host"); - Mockito.when(microservice.isRootHostAccess()).thenReturn(true); + Mockito.when(microservice.isHostNetworkMode()).thenReturn(true); assertTrue(dockerUtil.areMicroserviceAndContainerEqual(containerID, microservice)); } catch (Exception e) { fail("This should not happen"); @@ -1015,7 +1015,7 @@ public void testCreateContainerWhenPortMappingsArePresent() { * Test createContainer * When microservice.getPortMappings are present * microservice.getVolumeMappings are present - * microservice.isRootHostAccess false + * microservice.isHostNetworkMode false */ @Test public void testCreateContainerWhenPortMappingsAndBindVolumeMappingsArePresent() { @@ -1024,7 +1024,7 @@ public void testCreateContainerWhenPortMappingsAndBindVolumeMappingsArePresent() Mockito.when(microservice.getImageName()).thenReturn("microserviceName"); Mockito.when(microservice.getMicroserviceUuid()).thenReturn("uuid"); assertEquals(containerID, dockerUtil.createContainer(microservice, "host")); - Mockito.verify(microservice).isRootHostAccess(); + Mockito.verify(microservice).isHostNetworkMode(); Mockito.verify(createContainerCmd).withHostConfig(any(HostConfig.class)); Mockito.verify(createContainerCmd).withLabels(any()); Mockito.verify(createContainerCmd, Mockito.never()).withCmd(any(List.class)); @@ -1034,14 +1034,14 @@ public void testCreateContainerWhenPortMappingsAndBindVolumeMappingsArePresent() * Test createContainer * When microservice.getPortMappings are present * microservice.getVolumeMappings are present - * microservice.isRootHostAccess true + * microservice.isHostNetworkMode true */ @Test public void testCreateContainerWhenPortMappingsAndBindVolumeMappingsArePresentWithRootAccess() { List args = new ArrayList<>(); args.add("args"); Mockito.when(microservice.getPortMappings()).thenReturn(portMappingList); - Mockito.when(microservice.isRootHostAccess()).thenReturn(true); + Mockito.when(microservice.isHostNetworkMode()).thenReturn(true); Mockito.when(microservice.getArgs()).thenReturn(args); Mockito.when(microservice.getVolumeMappings()).thenReturn(volumeMappingList); Mockito.when(microservice.getImageName()).thenReturn("microserviceName"); @@ -1063,7 +1063,7 @@ public void testCreateContainerWhenExtraHostsIsPresent() { List extraHosts = new ArrayList<>(); String host = "extra-host:1.2.3.4"; extraHosts.add(host); - Mockito.when(microservice.isRootHostAccess()).thenReturn(false); + Mockito.when(microservice.isHostNetworkMode()).thenReturn(false); Mockito.when(microservice.getExtraHosts()).thenReturn(extraHosts); Mockito.when(microservice.getImageName()).thenReturn("microserviceName"); Mockito.when(microservice.getMicroserviceUuid()).thenReturn("uuid"); @@ -1078,7 +1078,7 @@ public void testCreateContainerWhenExtraHostsIsPresent() { * Test createContainer * When microservice.getPortMappings are present * microservice.getVolumeMappings are present - * microservice.isRootHostAccess true + * microservice.isHostNetworkMode true * throws NotFoundException */ @Test diff --git a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/utils/CmdPropertiesTest.java b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/utils/CmdPropertiesTest.java index 7d0ce5e..fdd7986 100644 --- a/iofog-agent-daemon/src/test/java/org/eclipse/iofog/utils/CmdPropertiesTest.java +++ b/iofog-agent-daemon/src/test/java/org/eclipse/iofog/utils/CmdPropertiesTest.java @@ -46,7 +46,7 @@ public void tearDown() throws Exception { //@Test //public void getVersionMessage() { - // assertEquals("ioFog Agent 3.5.2 \nCopyright (c) 2023 Datasance Teknoloji A.S. \nEclipse ioFog is provided under the Eclipse Public License 2.0 (EPL-2.0) \nhttps://www.eclipse.org/legal/epl-v20.html", + // assertEquals("ioFog Agent 3.5.3 \nCopyright (c) 2023 Datasance Teknoloji A.S. \nEclipse ioFog is provided under the Eclipse Public License 2.0 (EPL-2.0) \nhttps://www.eclipse.org/legal/epl-v20.html", // CmdProperties.getVersionMessage()); //}