New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenShiftAssistant : add a scale method with applicationName #1052

dcdh opened this Issue May 13, 2018 · 3 comments


None yet
2 participants

dcdh commented May 13, 2018

In my test I need to scale down (0) some pods (like postgresql or other) to test the behavior of my application when infrastructure is in failure.

Currently, the scale method use the applicationName used to deploy an application in the OpenShiftAssistant.

So I have tried to inject multiple OpenShiftAssistant in my test (using @ArquillianResource) and deploy for each OpenShiftAssistant the application and next call on the desired one the scale method. However it doesn't worked because the same object is injected. So the applicationName used by the scale method refer to the last application launched.

A workaround is to define this method in test:

public void scale(final int replicas, final String applicationName) {
		final OpenShiftClient client = openShiftAssistant.getClient();
		final String namespace = client.getNamespace();

		// ideally, we'd look at deployment config's status.availableReplicas field,
		// but that's only available since OpenShift 3.5
		await().atMost(5, TimeUnit.MINUTES)
			.until(() -> {
				final List<Pod> pods = client
						.withLabel("deploymentconfig", applicationName)
				try {
					return pods.size() == replicas &&
				} catch (final IllegalStateException e) {
					// the 'Ready' condition can be missing sometimes, in which case Readiness.isPodReady throws an exception
					// here, we'll swallow that exception in hope that the 'Ready' condition will appear later
					return false;

So I guess, the better way would be to add in OpenShiftAssistant and KubernetesAssistant this kind of method:

public void scale(final int replicas, final String applicationName) {



This comment has been minimized.


dipak-pawar commented May 14, 2018

@dcdh Thank you for reporting this. Would you like to contribute for this?


This comment has been minimized.


dcdh commented May 14, 2018

yes why not :)


This comment has been minimized.


dcdh commented May 18, 2018

I have created a pull request #1054

dipak-pawar added a commit that referenced this issue Jun 8, 2018

@dipak-pawar dipak-pawar added this to the 1.16.0 milestone Jun 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment