diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2022-09-14 17:20:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-14 17:20:12 +0200 |
commit | 69ae0112ad9126bc91669074aa39a535b330e053 (patch) | |
tree | cc2eed2e9203bac11275c440f5390e3d24782eca | |
parent | cb4511771916c9c96bd17fba30e46a9f1b0110f7 (diff) | |
parent | 4e44d868ba4eb6acce6d80c822e328225f201490 (diff) |
Merge pull request #24055 from vespa-engine/jonmv/no-maven-no-memory
Jonmv/no maven no memory
6 files changed, 67 insertions, 6 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackage.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackage.java index 0c9ff7863bd..5b20c57fcca 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackage.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackage.java @@ -25,6 +25,8 @@ import com.yahoo.yolean.Exceptions; import javax.security.auth.x500.X500Principal; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; import java.math.BigInteger; import java.security.KeyPair; import java.security.cert.X509Certificate; @@ -81,8 +83,9 @@ public class TestPackage { entries.put("tests/.ignore-" + UUID.randomUUID(), new byte[0]); entries.put(servicesFile, - servicesXml( ! isPublicSystem, + servicesXml(! isPublicSystem, certificateValidFrom != null, + hasLegacyTests(testPackage), testerResourcesFor(id.type().zone(), spec.requireInstance(id.application().instance())), testerApp)); @@ -114,6 +117,12 @@ public class TestPackage { this.applicationPackage = new ApplicationPackage(buffer.toByteArray()); } + static boolean hasLegacyTests(byte[] testPackage) { + return ZipEntries.from(testPackage, __ -> true, 0, false).asList().stream() + .anyMatch(file -> file.name().startsWith("artifacts/") && file.name().endsWith("-tests.jar")); + + } + public ApplicationPackage asApplicationPackage() { return applicationPackage; } @@ -210,9 +219,9 @@ public class TestPackage { } /** Returns the generated services.xml content for the tester application. */ - public static byte[] servicesXml(boolean systemUsesAthenz, boolean useTesterCertificate, + public static byte[] servicesXml(boolean systemUsesAthenz, boolean useTesterCertificate, boolean hasLegacyTests, NodeResources resources, ControllerConfig.Steprunner.Testerapp config) { - int jdiscMemoryGb = 2; // 2Gb memory for tester application (excessive?). + int jdiscMemoryGb = 2; // 2Gb memory for tester application which uses Maven. int jdiscMemoryPct = (int) Math.ceil(100 * jdiscMemoryGb / resources.memoryGb()); // Of the remaining memory, split 50/50 between Surefire running the tests and the rest @@ -260,7 +269,7 @@ public class TestPackage { " </component>\n" + "\n" + " <nodes count=\"1\">\n" + - " <jvm allocated-memory=\"" + jdiscMemoryPct + "%\"/>\n" + + (hasLegacyTests ? " <jvm allocated-memory=\"" + jdiscMemoryPct + "%\"/>\n" : "" ) + " " + resourceString + "\n" + " </nodes>\n" + " </container>\n" + diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ZipEntries.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ZipEntries.java index 8392a77bad5..6bbcd551924 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ZipEntries.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ZipEntries.java @@ -67,6 +67,7 @@ public class ZipEntries { /** Read ZIP entries from inputStream */ public static ZipEntries from(byte[] zip, Predicate<String> entryNameMatcher, int maxEntrySizeInBytes, boolean throwIfEntryExceedsMaxSize) { + Options options = Options.standard() .pathPredicate(entryNameMatcher) .maxSize(2 * (long) Math.pow(1024, 3)) // 2 GB diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java index 3a6a8e67a75..52eeaae1297 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java @@ -542,7 +542,10 @@ public class DeploymentStatus { existingRevision = Optional.of(target.targetRevision()); } List<Job> toRun = new ArrayList<>(); - List<Change> changes = deployingCompatibilityChange ? List.of(change) : changes(job, step, change); + List<Change> changes = deployingCompatibilityChange + || allJobs.get(job).flatMap(status -> status.lastCompleted()).isEmpty() + ? List.of(change) + : changes(job, step, change); for (Change partial : changes) { Job jobToRun = new Job(job.type(), Versions.from(partial, application, existingPlatform, existingRevision, fallbackPlatform(partial, job)), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackageTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackageTest.java index 5bc1c386134..bff0ccc8ae1 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackageTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/pkg/TestPackageTest.java @@ -147,8 +147,17 @@ public class TestPackageTest { @Test void generates_correct_services_xml() throws IOException { assertEquals(Files.readString(Paths.get("src/test/resources/test_runner_services.xml-cd")), + new String(TestPackage.servicesXml(true, + false, + false, + new NodeResources(2, 12, 75, 1, NodeResources.DiskSpeed.fast, NodeResources.StorageType.local), + new ControllerConfig.Steprunner.Testerapp.Builder().build()), + UTF_8)); + + assertEquals(Files.readString(Paths.get("src/test/resources/test_runner_services_with_legacy_tests.xml-cd")), new String(TestPackage.servicesXml(true, false, + true, new NodeResources(2, 12, 75, 1, NodeResources.DiskSpeed.fast, NodeResources.StorageType.local), new ControllerConfig.Steprunner.Testerapp.Builder().build()), UTF_8)); diff --git a/controller-server/src/test/resources/test_runner_services.xml-cd b/controller-server/src/test/resources/test_runner_services.xml-cd index 526fd12965b..4bf3a78801d 100644 --- a/controller-server/src/test/resources/test_runner_services.xml-cd +++ b/controller-server/src/test/resources/test_runner_services.xml-cd @@ -33,7 +33,6 @@ </component> <nodes count="1"> - <jvm allocated-memory="17%"/> <resources vcpu="2.00" memory="12.00Gb" disk="75.00Gb" disk-speed="fast" storage-type="local"/> </nodes> </container> diff --git a/controller-server/src/test/resources/test_runner_services_with_legacy_tests.xml-cd b/controller-server/src/test/resources/test_runner_services_with_legacy_tests.xml-cd new file mode 100644 index 00000000000..526fd12965b --- /dev/null +++ b/controller-server/src/test/resources/test_runner_services_with_legacy_tests.xml-cd @@ -0,0 +1,40 @@ +<?xml version='1.0' encoding='UTF-8'?> +<services xmlns:deploy='vespa' version='1.0'> + <container version='1.0' id='tester'> + + <component id="com.yahoo.vespa.hosted.testrunner.TestRunner" bundle="vespa-testrunner-components"> + <config name="com.yahoo.vespa.hosted.testrunner.test-runner"> + <artifactsPath>artifacts</artifactsPath> + <surefireMemoryMb>5120</surefireMemoryMb> + <useAthenzCredentials>true</useAthenzCredentials> + <useTesterCertificate>false</useTesterCertificate> + </config> + </component> + + <handler id="com.yahoo.vespa.testrunner.TestRunnerHandler" bundle="vespa-osgi-testrunner"> + <binding>http://*/tester/v1/*</binding> + </handler> + + <component id="ai.vespa.hosted.cd.cloud.impl.VespaTestRuntimeProvider" bundle="cloud-tenant-cd" /> + + <component id="com.yahoo.vespa.testrunner.JunitRunner" bundle="vespa-osgi-testrunner"> + <config name="com.yahoo.vespa.testrunner.junit-test-runner"> + <artifactsPath>artifacts</artifactsPath> + <useAthenzCredentials>true</useAthenzCredentials> + </config> + </component> + + <component id="com.yahoo.vespa.testrunner.VespaCliTestRunner" bundle="vespa-osgi-testrunner"> + <config name="com.yahoo.vespa.testrunner.vespa-cli-test-runner"> + <artifactsPath>artifacts</artifactsPath> + <testsPath>tests</testsPath> + <useAthenzCredentials>true</useAthenzCredentials> + </config> + </component> + + <nodes count="1"> + <jvm allocated-memory="17%"/> + <resources vcpu="2.00" memory="12.00Gb" disk="75.00Gb" disk-speed="fast" storage-type="local"/> + </nodes> + </container> +</services> |