summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2020-02-03 17:44:14 +0100
committerValerij Fredriksen <valerijf@verizonmedia.com>2020-02-03 17:44:14 +0100
commitc80937058b7fb2b04e370480dba9c759a16b76ad (patch)
tree57517287e706b3fe9b0bd277260f03786393b849
parentf3689e3c0254681002106800519b9e0b71cfabd5 (diff)
Fix time remaining calculation
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java2
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java3
2 files changed, 2 insertions, 3 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
index 6e382794828..488e97eec22 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
@@ -471,7 +471,7 @@ public class NodeAgentImpl implements NodeAgent {
if (firstSuccessfulHealthCheckInstant.isEmpty())
firstSuccessfulHealthCheckInstant = Optional.of(clock.instant());
- Duration timeLeft = Duration.between(firstSuccessfulHealthCheckInstant.get(), clock.instant());
+ Duration timeLeft = Duration.between(clock.instant(), firstSuccessfulHealthCheckInstant.get().plus(warmUpDuration));
if (!container.get().resources.equalsCpu(getContainerResources(context)))
throw new ConvergenceException("Refusing to resume until warm up period ends (" +
(timeLeft.isNegative() ? " next tick" : "in " + timeLeft) + ")");
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java
index 2f24a68c079..f65ad379a63 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java
@@ -32,7 +32,6 @@ import java.time.Instant;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -680,7 +679,7 @@ public class NodeAgentImplTest {
nodeAgent.doConverge(context);
fail("Expected to fail due to warm up period not yet done");
} catch (ConvergenceException e) {
- assertTrue(e.getMessage().startsWith("Refusing to resume until warm up period ends"));
+ assertEquals("Refusing to resume until warm up period ends (in PT30S)", e.getMessage());
}
inOrder.verify(orchestrator, never()).resume(any());
inOrder.verify(orchestrator, never()).suspend(any());