Skip to content

Commit

Permalink
fix #5194: deflaking ScaleIT by ensuring api metadata lookup succeeds
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins authored and manusa committed Jun 15, 2023
1 parent 7c71222 commit 8573932
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions kubernetes-itests/src/test/java/io/fabric8/kubernetes/ScaleIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ class ScaleIT {

@BeforeEach
void setUp() {
client.apiextensions().v1().customResourceDefinitions().withName("crontabs.stable.example.com")
.waitUntilCondition(crd -> crd != null && crd.getStatus() != null && crd.getStatus().getConditions() != null &&
crd.getStatus().getConditions().stream()
.filter(c -> c.getType() != null)
.filter(c -> c.getStatus() != null)
.anyMatch(c -> c.getType().equals("Established") && c.getStatus().equals("True")),
10, TimeUnit.SECONDS);
Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> {
try {
client.genericKubernetesResources("stable.example.com/v1", "CronTab");
return true;
} catch (KubernetesClientException e) {
return false;
}
});
}

@Test
void scale() {
void scaleGeneric() {
GenericKubernetesResource cronTab = Serialization.unmarshal("apiVersion: \"stable.example.com/v1\"\n"
+ "kind: CronTab\n"
+ "metadata:\n"
Expand All @@ -61,8 +62,7 @@ void scale() {
+ " image: my-awesome-cron-image\n"
+ " replicas: 3", GenericKubernetesResource.class);

Resource<GenericKubernetesResource> resource = client.genericKubernetesResources("stable.example.com/v1", "CronTab")
.resource(cronTab);
Resource<GenericKubernetesResource> resource = client.resource(cronTab);

Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> {
try {
Expand Down

0 comments on commit 8573932

Please sign in to comment.