-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #2672: WaitUntilReady for Service resource throws IllegalArgument…
…Exception Refactor Readiness.isReady to log a warning for Non Readiness Applicable resources instead of throwing IllegalArgumentException. For Readiness check, these kind of resources will only be checked with Objects.nonNull since they become ready as soon as they get created
- Loading branch information
1 parent
22412af
commit 3a5d76f
Showing
8 changed files
with
178 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.../src/test/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadinessTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.fabric8.openshift.client.internal.readiness; | ||
|
||
import io.fabric8.openshift.api.model.DeploymentConfig; | ||
import io.fabric8.openshift.api.model.DeploymentConfigBuilder; | ||
import io.fabric8.openshift.api.model.ImageStreamBuilder; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class OpenShiftReadinessTest { | ||
@Test | ||
void testOpenShiftReadinessWithDeploymentConfig() { | ||
DeploymentConfig dc = new DeploymentConfigBuilder() | ||
.withNewSpec().withReplicas(2).endSpec() | ||
.withNewStatus().withAvailableReplicas(2).withReplicas(2).endStatus() | ||
.build(); | ||
|
||
assertTrue(OpenShiftReadiness.isReady(dc)); | ||
} | ||
|
||
@Test | ||
void testOpenShiftReadinessWithNonReadinessApplicableResource() { | ||
assertTrue(OpenShiftReadiness.isReady(new ImageStreamBuilder().withNewMetadata().withName("is1").endMetadata().build())); | ||
} | ||
|
||
@Test | ||
void testOpenShiftReadinessWithNullResource() { | ||
assertFalse(OpenShiftReadiness.isReady(null)); | ||
} | ||
} |