Skip to content

Add functional test #94

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

Merged
merged 1 commit into from
Jan 12, 2017
Merged

Conversation

dims
Copy link
Collaborator

@dims dims commented Jan 11, 2017

Port a bunch of tests from python-k8sclient repository. There is a script that starts a real instance of kubernetes and the tests are executed against it.

Note, if you just have k8s accessible in your localhost:8080, the tests still run. so you don't really need to run "py27-functional" which runs the kube-init.sh

Also, 2 API calls fail currently, i've added a TODO so we can dig into them and fix them

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 11, 2017
@dims
Copy link
Collaborator Author

dims commented Jan 11, 2017

@mbohlool ah looks like the TODO's i have here are stemming from the same bug already reported! #93

@@ -193,7 +193,7 @@ def sanitize_for_serialization(self, obj):
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
for sub_obj in obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

scripts/update-pep8.sh does not update this file. If this is the right style we should have, we need to be able to automate it there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reverted

@@ -0,0 +1,204 @@
# -*- coding: utf-8 -*-
Copy link
Contributor

Choose a reason for hiding this comment

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

the test folder will be removed and re-generated by scripts/update-client.sh. You need to either change the script there to keep this file or move this file to another folder. maybe put it in kubernetes/e2e_test folder or something like that? Also would be nice if we can have an script in scripts/ folder to deploy a minikube and run this against it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved the file to e2e_test

@@ -0,0 +1,112 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

add copyright header here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

echo "K8S_VERSION : ${K8S_VERSION}"

echo "Starting docker service"
sudo systemctl enable docker.service
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supported on osx? if not, we should check at the start of script and fail for osx with a relevant message. it may not be hard to just support osx too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is mainly meant for travis. we can look into supporting other platforms. As mentioned, you really don't need this script, as long as you have localhost:8080 proxied to a working k8s instance for the tests to run.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ignore all osx comments then now that I understand this is meant for travis.


# Run the docker containers for kubernetes
echo "Starting Kubernetes containers"
sudo docker run \
Copy link
Contributor

Choose a reason for hiding this comment

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

most probably sudo is not necessary on osx.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is working on travis. can tweak for OSX later

--allow-privileged=true --v=2


echo "Download Kubernetes CLI"
Copy link
Contributor

Choose a reason for hiding this comment

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

we can first check if kubectl is available. if you want to always download an stable version, would suggest to download it in a temp folder and remove it at the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ack. I can do this in a followup PR as this is mainly for the travis environment right now where we know kubectl is not available

Copy link
Contributor

Choose a reason for hiding this comment

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

this is for travis, no need to do so.

@@ -0,0 +1,112 @@
#!/bin/bash

Copy link
Contributor

Choose a reason for hiding this comment

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

How/where do we use this file? If it is a manual run, it would be nice if we have an example here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's used when you run "tox -e py27-functional" so will run on travis

commands = {toxinidir}/scripts/kube-init.sh nosetests []

[testenv:coverage]
commands = nosetests --with-coverage --cover-package=kubernetes.config,kubernetes.watch --cover-tests
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see code coverage comment from codecov-io. If we do the code coverage right, we should get such a comment. The comment look like this: #89 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ack. i'll check on this

@mbohlool
Copy link
Contributor

@dims I had some comment. Let me know if they make sense. I was looking into have some kind of e2e test from the beginning. This is great. Thanks.

@dims dims force-pushed the add-functional-test branch 6 times, most recently from 2ac21d8 to 9a227d9 Compare January 11, 2017 23:08
@codecov-io
Copy link

codecov-io commented Jan 12, 2017

Current coverage is 94.52% (diff: 100%)

Merging #94 into master will decrease coverage by 0.15%

@@             master        #94   diff @@
==========================================
  Files             9          9          
  Lines           658        658          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits            623        622     -1   
- Misses           35         36     +1   
  Partials          0          0          

Powered by Codecov. Last update ce8e082...010af62

@dims dims force-pushed the add-functional-test branch 5 times, most recently from d3ae269 to 751dc40 Compare January 12, 2017 02:23
Copy link
Contributor

@mbohlool mbohlool left a comment

Choose a reason for hiding this comment

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

One final comment, look good otherwise.

@@ -0,0 +1,204 @@
# -*- coding: utf-8 -*-
Copy link
Contributor

Choose a reason for hiding this comment

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

would you please add copyright header to kubernetes/e2e_test/init.py file too. annoying but I think it is required on all files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done (added header to kubernetes/e2e_test/init.py

@dims dims force-pushed the add-functional-test branch 4 times, most recently from 9a43721 to 00b2544 Compare January 12, 2017 03:03
@dims
Copy link
Collaborator Author

dims commented Jan 12, 2017

ok @mbohlool - this is ready as well

@mbohlool mbohlool self-assigned this Jan 12, 2017
@mbohlool
Copy link
Contributor

@dims LGTM. please fix the conflict. thanks.

@mbohlool mbohlool added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 12, 2017
Port a bunch of tests from python-k8sclient repository. There
is a script that starts a real instance of kubernetes and
the tests are executed against it.

Note, if you just have k8s accessible in your localhost:8080, the
tests still run. so you don't really need to run "py27-functional"
which runs the kube-init.sh

Also, 2 API calls fail currently, i've added a TODO so we can
dig into them and fix them
@dims dims force-pushed the add-functional-test branch from 00b2544 to 010af62 Compare January 12, 2017 11:26
@dims
Copy link
Collaborator Author

dims commented Jan 12, 2017

@mbohlool Done!

@mbohlool mbohlool merged commit c147f66 into kubernetes-client:master Jan 12, 2017
yliaog pushed a commit to yliaog/client-python that referenced this pull request Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants