Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Implement e2e tests #50

Closed
wants to merge 22 commits into from
Closed

Implement e2e tests #50

wants to merge 22 commits into from

Conversation

hacker-h
Copy link
Contributor

@hacker-h hacker-h commented Aug 22, 2019

Implements the framework for e2e tests with the first two e2e tests from the e2e-manifests.
Blockers:
Replace kubectl delete -f with python code:
kubernetes-client/python#940

Remove forked code and contribute changes upstream:
kubernetes-client/python#941

@hacker-h hacker-h changed the title Implement e2e tests WIP: Implement e2e tests Aug 22, 2019
@hacker-h hacker-h marked this pull request as ready for review August 22, 2019 10:56
@johscheuer
Copy link
Contributor

The PR already has a merge conflict, please rebase it

@@ -0,0 +1,197 @@
import concurrent.futures
Copy link
Contributor

Choose a reason for hiding this comment

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

This lookslike a forked version of https://github.com/kubernetes-client/python/blob/master/kubernetes/utils/create_from_yaml.py I would like to prevent using an internal fork this will only result in pain. Please use the create_from_yaml function and add an extra method that wait until thee deployments are ready. You can also try to provide an upstream patch (e.g. create an issue and ask if this feature is wanted).

# Clean up
res = subprocess.run(["illuminatio", "clean"], capture_output=True)
# delete test resources
res = subprocess.run(["kubectl", "delete", "-f", resource_manifest],
Copy link
Contributor

Choose a reason for hiding this comment

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

You can leave this command if you just add the according labels to the manifests (then illuminatio clean will remove them for you)

@pytest.mark.e2e
def test_deny_all_traffic_to_an_application():
resource_manifest = "e2e-manifests/01-deny-all-traffic-to-an-application.yml"
results_yaml_file = "result.yml"
Copy link
Contributor

Choose a reason for hiding this comment

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

Store a file to disk only to reread it seems to me not the best (and performant) idea.

yaml_document = yaml.safe_load_all(f)
for results_dict in yaml_document:
validate_illuminatio_was_successful(results_dict)
expected_dict = {'cases': {'default:app=bookstore': {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this outside of the python code e.g. in a results.yaml that would make the code more readable.

@johscheuer
Copy link
Contributor

Like already mentioned here: #34 (review) I would prefer multiple smaller PR's instead of one huge PR

@johscheuer
Copy link
Contributor

You have seen the deprecation warning :

tests/test_e2e.py::test_deny_all_traffic_to_an_application
  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/yaml/constructor.py:126: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    if not isinstance(key, collections.Hashable):

@johscheuer
Copy link
Contributor

And could you take a look at this warning:

/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/_pytest/mark/structures.py:324
  /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/_pytest/mark/structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.e2e - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
    PytestUnknownMarkWarning,

Thanks (or at least create an issue for it).

@hacker-h hacker-h changed the title WIP: Implement e2e tests Implement e2e tests Aug 26, 2019
@hacker-h hacker-h changed the title Implement e2e tests WIP: Implement e2e tests Aug 26, 2019
@johscheuer
Copy link
Contributor

Are you still working on this ?

@hacker-h hacker-h changed the title WIP: Implement e2e tests Implement e2e tests Sep 6, 2019
@hacker-h
Copy link
Contributor Author

hacker-h commented Sep 6, 2019

No, feel free to takeover if you like to

@maxbischoff maxbischoff self-assigned this Sep 21, 2019
@maxbischoff
Copy link
Member

Closing this in favor of #82 and upcoming PR(s)

@johscheuer johscheuer deleted the implement-e2e-tests branch October 4, 2019 21:25
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.

3 participants