Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Openshift unittests #465

Merged
merged 7 commits into from
Dec 22, 2015
Merged

Openshift unittests #465

merged 7 commits into from
Dec 22, 2015

Conversation

rtnpro
Copy link
Contributor

@rtnpro rtnpro commented Dec 17, 2015

Tests and related refactor for openshift provider using Openshift API.

msg = "%s %s" % (status_code, return_data)
logger.error(msg)
raise ProviderFailedException(msg)
return self.oc.process_template(url, template)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is OpenShiftProvider._process_template still needed?
I would probably get rid of if this function (_process_template) now. It doesn't do anything useful, everything important is in OpenshiftClient.process_tempate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah! yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I did not remove _process_template is because of the dependency on get_url. Also, I see no reason to move get_url to OpenshiftClient.

- Move interaction with remote API to fetch resources to different methods, for easy mocking.
…enShiftProvider

to OpenshiftClient.

This will help us to mock out the external world dependencies and
test the core logic in OpenShiftProvider.
to remove external dependencies from core logic. Now, _process_artifacts()
reads artifact files in a loop and calls _process_artifact_data() with
the parsed artifact data to process it.
@dustymabe
Copy link
Contributor

still WIP or done now?

@rtnpro
Copy link
Contributor Author

rtnpro commented Dec 18, 2015

@dustymabe, @kadel

I have covered most of our core logic with the unittests, except for the external dependencies.

Test coverage:

Name                               Stmts   Miss  Cover   Missing
----------------------------------------------------------------
atomicapp/providers.py                 0      0   100%   
atomicapp/providers/openshift.py     193     41    79%   38-39, 46-60, 67-81, 93-96, 99-111, 269, 304, 341-349, 439, 441, 446-450
----------------------------------------------------------------
TOTAL                                193     41    79%   
----------------------------------------------------------------------

@rtnpro rtnpro changed the title [WIP] Openshift unittests Openshift unittests Dec 18, 2015
self.openshift_api = openshift_api
self.kubernetes_api = kubernetes_api

def get_oapi_resources(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could probably make this function generic:

get_api_resources(self, type) where type = 'kubernetes' or 'openshift'

don't have to change it, just sayin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

and refactored _parse_kubeconf() to move out external dependency
(file access) from core logic.
@dustymabe
Copy link
Contributor

LGTM. @kadel can you +1 and we can merge this

@kadel
Copy link
Collaborator

kadel commented Dec 22, 2015

👍 LGTM

dustymabe added a commit that referenced this pull request Dec 22, 2015
@dustymabe dustymabe merged commit 86808c3 into master Dec 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants