Search in sources :

Example 1 with StackGresClusterFixture

use of io.stackgres.operator.fixture.StackGresClusterFixture in project stackgres by ongres.

the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsSize.

@Test
void shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsSize() {
    NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidRequirement().build();
    StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
    io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
    assertEquals(2, k8sPodNodeAffinity.getRequiredDuringSchedulingIgnoredDuringExecution().getNodeSelectorTerms().size());
}
Also used : NodeAffinityFixture(io.stackgres.operator.fixture.NodeAffinityFixture) NodeAffinity(io.stackgres.common.crd.NodeAffinity) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) StackGresClusterFixture(io.stackgres.operator.fixture.StackGresClusterFixture) Test(org.junit.jupiter.api.Test)

Example 2 with StackGresClusterFixture

use of io.stackgres.operator.fixture.StackGresClusterFixture in project stackgres by ongres.

the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsKey.

@Test
void shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsKey() {
    NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidPreferredScheduling().build();
    StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
    io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
    k8sPodNodeAffinity.getPreferredDuringSchedulingIgnoredDuringExecution().forEach(preference -> {
        preference.getPreference().getMatchExpressions().forEach(math -> {
            assertEquals(PREFERRED_TOPOLOGY_KEY, math.getKey());
        });
    });
}
Also used : NodeAffinityFixture(io.stackgres.operator.fixture.NodeAffinityFixture) NodeAffinity(io.stackgres.common.crd.NodeAffinity) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) StackGresClusterFixture(io.stackgres.operator.fixture.StackGresClusterFixture) Test(org.junit.jupiter.api.Test)

Example 3 with StackGresClusterFixture

use of io.stackgres.operator.fixture.StackGresClusterFixture in project stackgres by ongres.

the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsKey.

@Test
void shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsKey() {
    NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidRequirement().build();
    StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
    io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
    k8sPodNodeAffinity.getRequiredDuringSchedulingIgnoredDuringExecution().getNodeSelectorTerms().forEach(term -> {
        term.getMatchExpressions().forEach(math -> {
            assertEquals(REQUIRED_TOPOLY_KEY, math.getKey());
        });
    });
}
Also used : NodeAffinityFixture(io.stackgres.operator.fixture.NodeAffinityFixture) NodeAffinity(io.stackgres.common.crd.NodeAffinity) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) StackGresClusterFixture(io.stackgres.operator.fixture.StackGresClusterFixture) Test(org.junit.jupiter.api.Test)

Example 4 with StackGresClusterFixture

use of io.stackgres.operator.fixture.StackGresClusterFixture in project stackgres by ongres.

the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsSize.

@Test
void shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsSize() {
    NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidPreferredScheduling().build();
    StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
    io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
    assertEquals(nodeAffinity.getPreferredDuringSchedulingIgnoredDuringExecution().size(), k8sPodNodeAffinity.getPreferredDuringSchedulingIgnoredDuringExecution().size());
}
Also used : NodeAffinityFixture(io.stackgres.operator.fixture.NodeAffinityFixture) NodeAffinity(io.stackgres.common.crd.NodeAffinity) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) StackGresClusterFixture(io.stackgres.operator.fixture.StackGresClusterFixture) Test(org.junit.jupiter.api.Test)

Aggregations

NodeAffinity (io.stackgres.common.crd.NodeAffinity)4 StackGresCluster (io.stackgres.common.crd.sgcluster.StackGresCluster)4 NodeAffinityFixture (io.stackgres.operator.fixture.NodeAffinityFixture)4 StackGresClusterFixture (io.stackgres.operator.fixture.StackGresClusterFixture)4 Test (org.junit.jupiter.api.Test)4