InternalStepRunner implements StepRunner { static NodeResources testerResourcesFor(ZoneId zone, DeploymentInstanceSpec spec) { return spec.steps().stream() .filter(step -> step.concerns(zone.environment())) .findFirst() .flatMap(step -> step.zones().get(0).testerFlavor()) .map(NodeResources::fromLegacyName) .orElse(zone.region().value().contains("aws-") ? DEFAULT_TESTER_RESOURCES_AWS : DEFAULT_TESTER_RESOURCES); } InternalStepRunner(Controller controller); @Override Optional<RunStatus> run(LockedStep step, RunId id);  }
@Test public void generates_correct_tester_flavor() { DeploymentSpec spec = DeploymentSpec.fromXml("<deployment version='1.0' athenz-domain='domain' athenz-service='service'>\n" + " <instance id='first'>\n" + " <test tester-flavor=\"d-6-16-100\" />\n" + " <prod>\n" + " <region active=\"true\">us-west-1</region>\n" + " <test>us-west-1</test>\n" + " </prod>\n" + " </instance>\n" + " <instance id='second'>\n" + " <test />\n" + " <staging />\n" + " <prod tester-flavor=\"d-6-16-100\">\n" + " <parallel>\n" + " <region active=\"true\">us-east-3</region>\n" + " <region active=\"true\">us-central-1</region>\n" + " </parallel>\n" + " <region active=\"true\">us-west-1</region>\n" + " <test>us-west-1</test>\n" + " </prod>\n" + " </instance>\n" + "</deployment>\n"); NodeResources firstResources = InternalStepRunner.testerResourcesFor(ZoneId.from("prod", "us-west-1"), spec.requireInstance("first")); assertEquals(InternalStepRunner.DEFAULT_TESTER_RESOURCES, firstResources); NodeResources secondResources = InternalStepRunner.testerResourcesFor(ZoneId.from("prod", "us-west-1"), spec.requireInstance("second")); assertEquals(6, secondResources.vcpu(), 1e-9); assertEquals(16, secondResources.memoryGb(), 1e-9); assertEquals(100, secondResources.diskGb(), 1e-9); }