{"action":"created","issue":{"url":"https://api.github.com/repos/micheloosterhof/cowrie/issues/863","repository_url":"https://api.github.com/repos/micheloosterhof/cowrie","labels_url":"https://api.github.com/repos/micheloosterhof/cowrie/issues/863/labels{/name}","comments_url":"https://api.github.com/repos/micheloosterhof/cowrie/issues/863/comments","events_url":"https://api.github.com/repos/micheloosterhof/cowrie/issues/863/events","html_url":"https://github.com/micheloosterhof/cowrie/pull/863","id":354506513,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExMjUzNjc5","number":863,"title":"Integration tests","user":{"login":"unglaublicherdude","id":13208176,"node_id":"MDQ6VXNlcjEzMjA4MTc2","avatar_url":"https://avatars2.githubusercontent.com/u/13208176?v=4","gravatar_id":"","url":"https://api.github.com/users/unglaublicherdude","html_url":"https://github.com/unglaublicherdude","followers_url":"https://api.github.com/users/unglaublicherdude/followers","following_url":"https://api.github.com/users/unglaublicherdude/following{/other_user}","gists_url":"https://api.github.com/users/unglaublicherdude/gists{/gist_id}","starred_url":"https://api.github.com/users/unglaublicherdude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unglaublicherdude/subscriptions","organizations_url":"https://api.github.com/users/unglaublicherdude/orgs","repos_url":"https://api.github.com/users/unglaublicherdude/repos","events_url":"https://api.github.com/users/unglaublicherdude/events{/privacy}","received_events_url":"https://api.github.com/users/unglaublicherdude/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-27T22:51:11Z","updated_at":"2018-09-07T10:06:50Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/micheloosterhof/cowrie/pulls/863","html_url":"https://github.com/micheloosterhof/cowrie/pull/863","diff_url":"https://github.com/micheloosterhof/cowrie/pull/863.diff","patch_url":"https://github.com/micheloosterhof/cowrie/pull/863.patch"},"body":"Hi,\r\n\r\nI have created a mechanic to run integration/smoke tests against cowrie. \r\n\r\n**The Idea**: Thanks to docker you can easily start a container with the fully functional cowrie services within and run tests of any kind against the running container and with a running cowrie service. So just write unit-tests that do ssh into the service and run commands against it.\r\n\r\nWith this pull-request I simply submit a way to build the cowrie docker container (placed in the root directory of the repository), start the container and run tests against the container.\r\n\r\n**The implemented tests do test**:\r\n\r\nImplicit\r\n- Does the docker container build?\r\n\r\nExplicit\r\n- Does the port open?\r\n- Does ssh work?\r\n- Do the commands work?`\r\n\r\n**Important**: All the tests are not an assertion of an output when a specific input is given because that would be unit tests. These tests do simply test if something breaks when running commands against cowrie.\r\n\r\nYou can run the tests in a virtualenv directly on your machine and with debugging in pycharm, but when not debugging I would really recommend you to run the tests in a docker-container.\r\n\r\nJust build it\r\n```\r\ndocker build -t cowrie/test -f IntegrationTests.Dockerfile .\r\n```\r\n\r\nAnd run it\r\n```\r\ndocker run \\\r\n    -v $(pwd):/app \\\r\n    -v /var/run/docker.sock:/var/run/docker.sock \\\r\n    cowrie/test \\\r\n        pytest -v IntegrationTests\r\n```\r\n\r\n**Important:**\r\nThere are actually 4 tests that are \"broken\". Theses tests are broken, because the cowrie service does actually break with an exception, when running base64 or date without any parameter.\r\n\r\n**Future Idea**: When this pull-request will be accepted I plan to build more kind of tests\r\n\r\n- Smoke Tests with tty logs - I plan to create a tests, that can replay tty-logs against the docker container. My thought here was, that if you get an error-report where you can reproduce the error with a specific sequence of command, you can just put it into this tests and solve the problem. The test will get  green and future tests will always check that the problem does not occur again. \r\n- Output tests - for testing the different cowrie outputs\r\n- Tests for web downloads - do the downloaded urls actually land in the configured directory?\r\n\r\nI did not integrate it into the travis-ci because I think you should first try the tests out. Also @craneworks offered me to do the travis-struff, when the pull request gets merged.\r\n\r\nCheers,\r\nMatthias\r\n"},"comment":{"url":"https://api.github.com/repos/micheloosterhof/cowrie/issues/comments/419391149","html_url":"https://github.com/micheloosterhof/cowrie/pull/863#issuecomment-419391149","issue_url":"https://api.github.com/repos/micheloosterhof/cowrie/issues/863","id":419391149,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTM5MTE0OQ==","user":{"login":"micheloosterhof","id":1063043,"node_id":"MDQ6VXNlcjEwNjMwNDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1063043?v=4","gravatar_id":"","url":"https://api.github.com/users/micheloosterhof","html_url":"https://github.com/micheloosterhof","followers_url":"https://api.github.com/users/micheloosterhof/followers","following_url":"https://api.github.com/users/micheloosterhof/following{/other_user}","gists_url":"https://api.github.com/users/micheloosterhof/gists{/gist_id}","starred_url":"https://api.github.com/users/micheloosterhof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micheloosterhof/subscriptions","organizations_url":"https://api.github.com/users/micheloosterhof/orgs","repos_url":"https://api.github.com/users/micheloosterhof/repos","events_url":"https://api.github.com/users/micheloosterhof/events{/privacy}","received_events_url":"https://api.github.com/users/micheloosterhof/received_events","type":"User","site_admin":false},"created_at":"2018-09-07T10:06:50Z","updated_at":"2018-09-07T10:06:50Z","author_association":"OWNER","body":"hi! thanks for submitting the pull request! \r\n\r\nit doesn't build for me because the requirements file referenced in Dockerfile is not there.\r\n\r\nCould you rename 'IntegrationTests' to just 'test', please? Readme.md to README.md. \r\n\r\nYour file naming standard uses Camelcase for files, that's not what I use in the rest of Cowrie (it's all lowercase). \r\n\r\nYou're using the `pytest` testing framework. For the other tests we are using `unittest` from Twisted (Python). Have you looked at the other test framework to sync these and not have multiple testing frameworks?\r\n\r\nHave you considered not accessing docker.sock straight from the container, but using docker-compose to have a client and a server and test that way? \r\n"}}
{"actor":{"display_login":"micheloosterhof"}}