.setCommand(Lists.newArrayList("server", "foo-service.yaml")) .setEnv(env) .setPorts(ports) .setRegistration(registration) .setVolumes(volumes)
ports.putAll(builder.getPorts()); ports.putAll(explicitPorts); builder.setPorts(ports);
.setCommand(Lists.newArrayList("server", "foo-service.yaml")) .setEnv(env) .setPorts(ports) .setRegistration(registration) .setRegistrationDomain(registrationDomain)
ports.putAll(builder.getPorts()); ports.putAll(explicitPorts); builder.setPorts(ports);
.setCommand(IDLE_COMMAND) .setEnv(env) .setPorts(ports) .setRegistration(registration) .setCreatingUser(TEST_USER)
.setImage(BUSYBOX) .setCommand(IDLE_COMMAND) .setPorts(ports) .setCreatingUser(TEST_USER) .build();
.setImage(BUSYBOX) .setCommand(IDLE_COMMAND) .setPorts(ImmutableMap.of("foo", PortMapping.of(4711), "bar", PortMapping.of(4712, ports.localPort("bar")))) .build();
.setVersion("v2") .setImage(MEMCACHED) .setPorts(ImmutableMap.of("tcp", PortMapping.of(11211, externalPort))) .build(); final JobId jobId2 = job2.getId();
.setImage(BUSYBOX) .setCommand(IDLE_COMMAND) .setPorts(ImmutableMap.of("foo", PortMapping.of(4711), "bar", PortMapping.of(4712, ports.localPort("bar")))) .build();
.setEnv(env) .setResources(resources) .setPorts(ports) .setRegistration(registration) .setGracePeriod(gracePeriod)
protected JobId createJob(final String name, final String version, final String image, final String hostname, final List<String> command, final Map<String, String> env, final Map<String, PortMapping> ports, final Map<ServiceEndpoint, ServicePorts> registration, final Integer gracePeriod, final Map<String, String> volumes, final Date expires) throws Exception { return createJob(Job.newBuilder() .setName(name) .setVersion(version) .setImage(image) .setHostname(hostname) .setCommand(command) .setEnv(env) .setPorts(ports) .setRegistration(registration) .setGracePeriod(gracePeriod) .setVolumes(volumes) .setExpires(expires) .build()); }
@Test public void testPortMappingWithBadIp() throws Exception { startDefaultMaster(); startDefaultAgent(testHost()); awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("foobar is not a valid IP address."); // Create job with a portmapping that has a bad IP. Check it throws. createJobRawOutput(Job.newBuilder() .setName(testJobName) .setVersion(testJobVersion) .setImage(BUSYBOX) .setPorts(Collections.singletonMap("foo", PortMapping.builder() .ip("foobar") .internalPort(80) .externalPort(80) .build() )).build()); } }
@Test public void testJobStatusHostFilter() throws Exception { startDefaultMaster(); final HeliosClient client = defaultClient(); startDefaultAgent(testHost()); // Create a job final Job job = Job.newBuilder() .setName(testJobName) .setVersion(testJobVersion) .setImage(BUSYBOX) .setCommand(IDLE_COMMAND) .setPorts(EMPTY_PORTS) .build(); final CreateJobResponse created = client.createJob(job).get(); assertEquals(CreateJobResponse.Status.OK, created.getStatus()); final String result = cli("status", "--host", "framazama"); assertThat(result, containsString("There are no jobs deployed to hosts with the host pattern")); } }
@Test public void testPortMappingWithIp() throws Exception { startDefaultMaster(); startDefaultAgent(testHost()); awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS); // Create job with a portmapping that has an IP. Check it doesn't throw. createJobRawOutput(Job.newBuilder() .setName(testJobName) .setVersion(testJobVersion) .setImage(BUSYBOX) .setPorts(Collections.singletonMap("foo", PortMapping.builder() .ip("127.0.0.1") .internalPort(80) .externalPort(80) .build() )).build()); }