@Test public void testSuccessKeystore() throws Exception { ArrayList<TransportEncryptionSpec> transportEncryptionSpecs = new ArrayList<>(); transportEncryptionSpecs.add(DefaultTransportEncryptionSpec.newBuilder() .name("test-tls") .type(TransportEncryptionSpec.Type.KEYSTORE) .build()); Protos.Offer offer = OfferTestUtils.getOffer(ResourceTestUtils.getUnreservedCpus(2.0)); PodInfoBuilder podInfoBuilder = getPodInfoBuilderForTransportEncryption(transportEncryptionSpecs); EvaluationOutcome outcome = tlsEvaluationStage.evaluate( new MesosResourcePool(offer, Optional.of(Constants.ANY_ROLE)), podInfoBuilder); Assert.assertTrue(outcome.isPassing()); // Check that TLS update was invoked verify(mockTLSArtifactsUpdater).update(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.eq("test-tls")); Protos.ContainerInfo executorContainer = podInfoBuilder.getTaskBuilder(TestConstants.TASK_NAME).getExecutor().getContainer(); Assert.assertEquals(0, executorContainer.getVolumesCount()); Protos.ContainerInfo taskContainer = podInfoBuilder.getTaskBuilder(TestConstants.TASK_NAME).getContainer(); assertKeystoreArtifacts(taskContainer, tlsArtifactPaths, "test-tls"); }
@Test public void testArtifactsExist() throws Exception { ArrayList<TransportEncryptionSpec> transportEncryptionSpecs = new ArrayList<>(); transportEncryptionSpecs.add(DefaultTransportEncryptionSpec.newBuilder() .name("test-tls") .type(TransportEncryptionSpec.Type.TLS) .build()); Protos.Offer offer = OfferTestUtils.getOffer(ResourceTestUtils.getUnreservedCpus(2.0)); PodInfoBuilder podInfoBuilder = getPodInfoBuilderForTransportEncryption(transportEncryptionSpecs); EvaluationOutcome outcome = tlsEvaluationStage.evaluate( new MesosResourcePool(offer, Optional.of(Constants.ANY_ROLE)), podInfoBuilder); Assert.assertTrue(outcome.isPassing()); // Check that TLS update was invoked verify(mockTLSArtifactsUpdater).update(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.eq("test-tls")); Protos.ContainerInfo executorContainer = podInfoBuilder.getTaskBuilder(TestConstants.TASK_NAME).getExecutor().getContainer(); Assert.assertEquals(0, executorContainer.getVolumesCount()); Protos.ContainerInfo taskContainer = podInfoBuilder.getTaskBuilder(TestConstants.TASK_NAME).getContainer(); assertTLSArtifacts(taskContainer, tlsArtifactPaths, "test-tls"); }
@Test public void testSuccessTLS() throws Exception { ArrayList<TransportEncryptionSpec> transportEncryptionSpecs = new ArrayList<>(); transportEncryptionSpecs.add(DefaultTransportEncryptionSpec.newBuilder() .name("test-tls") .type(TransportEncryptionSpec.Type.TLS) .build()); Protos.Offer offer = OfferTestUtils.getOffer(ResourceTestUtils.getUnreservedCpus(2.0)); PodInfoBuilder podInfoBuilder = getPodInfoBuilderForTransportEncryption(transportEncryptionSpecs); EvaluationOutcome outcome = tlsEvaluationStage.evaluate( new MesosResourcePool(offer, Optional.of(Constants.ANY_ROLE)), podInfoBuilder); Assert.assertTrue(outcome.isPassing()); // Check that TLS update was invoked verify(mockTLSArtifactsUpdater).update(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.eq("test-tls")); Protos.ContainerInfo executorContainer = podInfoBuilder.getTaskBuilder(TestConstants.TASK_NAME).getExecutor().getContainer(); Assert.assertEquals(0, executorContainer.getVolumesCount()); Protos.ContainerInfo taskContainer = podInfoBuilder.getTaskBuilder(TestConstants.TASK_NAME).getContainer(); assertTLSArtifacts(taskContainer, tlsArtifactPaths, "test-tls"); }