Search in sources :

Example 6 with ResourceRefinementCapabilityContext

use of com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext in project dcos-commons by mesosphere.

the class ResourceBuilderTest method testFromExistingScalarResource.

@Test
public void testFromExistingScalarResource() {
    testFromExistingScalarResource(Optional.empty());
    testFromExistingScalarResource(Optional.of("baz"));
    ResourceRefinementCapabilityContext context = new ResourceRefinementCapabilityContext(Capabilities.getInstance());
    try {
        testFromExistingScalarResource(Optional.empty());
        testFromExistingScalarResource(Optional.of("baz"));
    } finally {
        context.reset();
    }
}
Also used : ResourceRefinementCapabilityContext(com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext) Test(org.junit.Test)

Example 7 with ResourceRefinementCapabilityContext

use of com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext in project dcos-commons by mesosphere.

the class ResourceBuilderTest method testExistingFromResourceSpec.

@Test
public void testExistingFromResourceSpec() {
    testExistingFromResourceSpec(Optional.empty());
    testExistingFromResourceSpec(Optional.of("bar"));
    ResourceRefinementCapabilityContext context = new ResourceRefinementCapabilityContext(Capabilities.getInstance());
    try {
        testExistingFromResourceSpec(Optional.empty());
        testExistingFromResourceSpec(Optional.of("bar"));
    } finally {
        context.reset();
    }
}
Also used : ResourceRefinementCapabilityContext(com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext) Test(org.junit.Test)

Example 8 with ResourceRefinementCapabilityContext

use of com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext in project dcos-commons by mesosphere.

the class ResourceBuilderTest method testNewFromResourceSpec.

/*
        name: "cpus"
        type: SCALAR
        scalar {
          value: 1.0
        }
        role: "*"
        reservations {
          principal: "test-principal"
          labels {
            labels {
              key: "resource_id"
              value: "e9edd178-f7dd-4472-b58b-3a3ff7ed51ac"
            }
          }
          role: "test-role"
        }
    */
@Test
public void testNewFromResourceSpec() {
    testNewFromResourceSpec(Optional.empty());
    testNewFromResourceSpec(Optional.of("/path/to/namespace"));
    ResourceRefinementCapabilityContext context = new ResourceRefinementCapabilityContext(Capabilities.getInstance());
    try {
        testNewFromResourceSpec(Optional.empty());
        testNewFromResourceSpec(Optional.of("/path/to/namespace"));
    } finally {
        context.reset();
    }
}
Also used : ResourceRefinementCapabilityContext(com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext) Test(org.junit.Test)

Example 9 with ResourceRefinementCapabilityContext

use of com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext in project dcos-commons by mesosphere.

the class DefaultCapabilitiesTestSuite method beforeAllSuites.

@BeforeClass
public static final void beforeAllSuites() throws Exception {
    Capabilities capabilities = mock(Capabilities.class);
    when(capabilities.supportsGpuResource()).thenReturn(true);
    when(capabilities.supportsCNINetworking()).thenReturn(true);
    when(capabilities.supportsNamedVips()).thenReturn(true);
    when(capabilities.supportsRLimits()).thenReturn(true);
    when(capabilities.supportsPreReservedResources()).thenReturn(true);
    when(capabilities.supportsFileBasedSecrets()).thenReturn(true);
    when(capabilities.supportsEnvBasedSecretsProtobuf()).thenReturn(true);
    when(capabilities.supportsEnvBasedSecretsDirectiveLabel()).thenReturn(true);
    context = new ResourceRefinementCapabilityContext(capabilities);
}
Also used : Capabilities(com.mesosphere.sdk.dcos.Capabilities) ResourceRefinementCapabilityContext(com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext) BeforeClass(org.junit.BeforeClass)

Example 10 with ResourceRefinementCapabilityContext

use of com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext in project dcos-commons by mesosphere.

the class ResourceBuilderTest method testExistingFromRootVolumeSpec.

@Test
public void testExistingFromRootVolumeSpec() {
    testExistingFromRootVolumeSpec(Optional.empty());
    testExistingFromRootVolumeSpec(Optional.of("/path/to/namespace"));
    ResourceRefinementCapabilityContext context = new ResourceRefinementCapabilityContext(Capabilities.getInstance());
    try {
        testExistingFromRootVolumeSpec(Optional.empty());
        testExistingFromRootVolumeSpec(Optional.of("/path/to/namespace"));
    } finally {
        context.reset();
    }
}
Also used : ResourceRefinementCapabilityContext(com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext) Test(org.junit.Test)

Aggregations

ResourceRefinementCapabilityContext (com.mesosphere.sdk.dcos.ResourceRefinementCapabilityContext)14 Test (org.junit.Test)12 Capabilities (com.mesosphere.sdk.dcos.Capabilities)1 DefaultResourceSpec (com.mesosphere.sdk.specification.DefaultResourceSpec)1 ResourceSpec (com.mesosphere.sdk.specification.ResourceSpec)1 Protos (org.apache.mesos.Protos)1 Operation (org.apache.mesos.Protos.Offer.Operation)1 BeforeClass (org.junit.BeforeClass)1