{"action":"created","comment":{"url":"https://api.github.com/repos/mendersoftware/integration/pulls/comments/328985313","pull_request_review_id":294207333,"id":328985313,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyODk4NTMxMw==","diff_hunk":"@@ -0,0 +1,240 @@\n+#!/usr/bin/python\n+# Copyright 2019 Northern.tech AS\n+#\n+#    Licensed under the Apache License, Version 2.0 (the \"License\");\n+#    you may not use this file except in compliance with the License.\n+#    You may obtain a copy of the License at\n+#\n+#        https://www.apache.org/licenses/LICENSE-2.0\n+#\n+#    Unless required by applicable law or agreed to in writing, software\n+#    distributed under the License is distributed on an \"AS IS\" BASIS,\n+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+#    See the License for the specific language governing permissions and\n+#    limitations under the License.\n+import pytest\n+import logging\n+import subprocess\n+import requests\n+import time\n+import json\n+\n+from ..conftest import docker_compose_instance\n+\n+from ..common_docker import *\n+from .conductor import Conductor\n+\n+from testutils.common import create_user, make_accepted_device, Device, User, Tenant\n+from testutils.api.client import ApiClient\n+from testutils.infra.cli import CliTenantadm\n+import testutils.api.deviceauth as deviceauth_v1\n+import testutils.api.deviceauth_v2 as deviceauth_v2\n+import testutils.api.deployments as deployments\n+import testutils.api.useradm as useradm\n+\n+@pytest.fixture(scope=\"class\")\n+def initial_os_setup():\n+    \"\"\" Start the minimum OS setup, create some uses and devices. \n+        Return {\"os_devs\": [...], \"os_users\": [...]}\n+    \"\"\"\n+\n+    stop_docker_compose()\n+\n+    docker_compose_cmd(\"-f \" + COMPOSE_FILES_PATH + \"/docker-compose.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.testing.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.storage.minio.yml up -d\",\n+                       use_common_files=False)\n+    ensure_conductor_ready(60, 'provision_device')\n+\n+    init_data = initialize_os_setup()\n+\n+    return init_data\n+\n+@pytest.fixture(scope=\"class\")\n+def initial_enterprise_setup(initial_os_setup):\n+    \"\"\"\n+        Start ENT for the first time (no tenant yet).\n+    \"\"\"\n+    stop_docker_compose_exclude(['mender-mongo'])\n+\n+    docker_compose_cmd(\"-f \" + COMPOSE_FILES_PATH + \"/docker-compose.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.enterprise.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.testing.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.storage.minio.yml up -d\",\n+                       use_common_files=False)\n+\n+    return initial_os_setup\n+\n+@pytest.fixture(scope=\"class\")\n+def migrated_enterprise_setup(initial_enterprise_setup):\n+    \"\"\"\n+        Create an org (tenant + user), restart with default tenant token.\n+        The ENT setup is ready for tests.\n+        Return {\"os_devs\": [...], \"os_users\": [...], \"tenant\": <Tenant>}\n+    \"\"\"\n+    ent_data = migrate_ent_setup()\n+\n+    # preserve the user/tenant created before restart\n+    stop_docker_compose_exclude(['mender-mongo'])\n+\n+    docker_compose_cmd(\"-f \" + COMPOSE_FILES_PATH + \"/docker-compose.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.enterprise.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.testing.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.testing.enterprise.yml \\\n+                        -f \" + COMPOSE_FILES_PATH + \"/docker-compose.storage.minio.yml up -d --no-recreate\",","path":"tests/tests/test_os_ent_migration.py","position":84,"original_position":84,"commit_id":"bf0a3c8ece1b8c3fe33c3a930998a670722ea8b0","original_commit_id":"cb6736a1bf3a0a8cfddbdbcd683bf0db41acd3f5","user":{"login":"kacf","id":4037094,"node_id":"MDQ6VXNlcjQwMzcwOTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/4037094?v=4","gravatar_id":"","url":"https://api.github.com/users/kacf","html_url":"https://github.com/kacf","followers_url":"https://api.github.com/users/kacf/followers","following_url":"https://api.github.com/users/kacf/following{/other_user}","gists_url":"https://api.github.com/users/kacf/gists{/gist_id}","starred_url":"https://api.github.com/users/kacf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacf/subscriptions","organizations_url":"https://api.github.com/users/kacf/orgs","repos_url":"https://api.github.com/users/kacf/repos","events_url":"https://api.github.com/users/kacf/events{/privacy}","received_events_url":"https://api.github.com/users/kacf/received_events","type":"User","site_admin":false},"body":"Ok, thanks for confirming.","created_at":"2019-09-27T09:20:58Z","updated_at":"2019-09-27T09:20:58Z","html_url":"https://github.com/mendersoftware/integration/pull/698#discussion_r328985313","pull_request_url":"https://api.github.com/repos/mendersoftware/integration/pulls/698","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mendersoftware/integration/pulls/comments/328985313"},"html":{"href":"https://github.com/mendersoftware/integration/pull/698#discussion_r328985313"},"pull_request":{"href":"https://api.github.com/repos/mendersoftware/integration/pulls/698"}},"in_reply_to_id":328945180},"pull_request":{"url":"https://api.github.com/repos/mendersoftware/integration/pulls/698","id":321589314,"node_id":"MDExOlB1bGxSZXF1ZXN0MzIxNTg5MzE0","html_url":"https://github.com/mendersoftware/integration/pull/698","diff_url":"https://github.com/mendersoftware/integration/pull/698.diff","patch_url":"https://github.com/mendersoftware/integration/pull/698.patch","issue_url":"https://api.github.com/repos/mendersoftware/integration/issues/698","number":698,"state":"open","locked":false,"title":"tests for OS->ENT migration","user":{"login":"mchalski","id":18258178,"node_id":"MDQ6VXNlcjE4MjU4MTc4","avatar_url":"https://avatars0.githubusercontent.com/u/18258178?v=4","gravatar_id":"","url":"https://api.github.com/users/mchalski","html_url":"https://github.com/mchalski","followers_url":"https://api.github.com/users/mchalski/followers","following_url":"https://api.github.com/users/mchalski/following{/other_user}","gists_url":"https://api.github.com/users/mchalski/gists{/gist_id}","starred_url":"https://api.github.com/users/mchalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchalski/subscriptions","organizations_url":"https://api.github.com/users/mchalski/orgs","repos_url":"https://api.github.com/users/mchalski/repos","events_url":"https://api.github.com/users/mchalski/events{/privacy}","received_events_url":"https://api.github.com/users/mchalski/received_events","type":"User","site_admin":false},"body":"https://tracker.mender.io/browse/MEN-2743\r\n\r\nthe core of the test is in the last few commits - https://github.com/mendersoftware/integration/commit/cd6617d60ca7f1f5b6c71c1a986801f834764524 and up. it's the simplest 'no migration' scenario:\r\n- have some functioning os setup\r\n- restart as enterprise\r\n- create organization, check old users/devices won't get in\r\n- restart yet again with the default tenant token\r\n- see that the new org/user are functioning, and old devices do appear in deviceauth for acceptance\r\n\r\na lot of the work went into factoring out some helpers form backend-tests, as `integration` is extremely frustrating to navigate. it already paid off, but will pay off more the more we expand this test (or introduce migration tests finally).","created_at":"2019-09-26T08:03:05Z","updated_at":"2019-09-27T09:20:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf24d6baa7c4f9f6c7bbb383061278b51cfb8a44","assignee":null,"assignees":[],"requested_reviewers":[{"login":"kjaskiewiczz","id":9249567,"node_id":"MDQ6VXNlcjkyNDk1Njc=","avatar_url":"https://avatars2.githubusercontent.com/u/9249567?v=4","gravatar_id":"","url":"https://api.github.com/users/kjaskiewiczz","html_url":"https://github.com/kjaskiewiczz","followers_url":"https://api.github.com/users/kjaskiewiczz/followers","following_url":"https://api.github.com/users/kjaskiewiczz/following{/other_user}","gists_url":"https://api.github.com/users/kjaskiewiczz/gists{/gist_id}","starred_url":"https://api.github.com/users/kjaskiewiczz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjaskiewiczz/subscriptions","organizations_url":"https://api.github.com/users/kjaskiewiczz/orgs","repos_url":"https://api.github.com/users/kjaskiewiczz/repos","events_url":"https://api.github.com/users/kjaskiewiczz/events{/privacy}","received_events_url":"https://api.github.com/users/kjaskiewiczz/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mendersoftware/integration/pulls/698/commits","review_comments_url":"https://api.github.com/repos/mendersoftware/integration/pulls/698/comments","review_comment_url":"https://api.github.com/repos/mendersoftware/integration/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mendersoftware/integration/issues/698/comments","statuses_url":"https://api.github.com/repos/mendersoftware/integration/statuses/bf0a3c8ece1b8c3fe33c3a930998a670722ea8b0","head":{"label":"mchalski:os-ent-migration","ref":"os-ent-migration","sha":"bf0a3c8ece1b8c3fe33c3a930998a670722ea8b0","user":{"login":"mchalski","id":18258178,"node_id":"MDQ6VXNlcjE4MjU4MTc4","avatar_url":"https://avatars0.githubusercontent.com/u/18258178?v=4","gravatar_id":"","url":"https://api.github.com/users/mchalski","html_url":"https://github.com/mchalski","followers_url":"https://api.github.com/users/mchalski/followers","following_url":"https://api.github.com/users/mchalski/following{/other_user}","gists_url":"https://api.github.com/users/mchalski/gists{/gist_id}","starred_url":"https://api.github.com/users/mchalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchalski/subscriptions","organizations_url":"https://api.github.com/users/mchalski/orgs","repos_url":"https://api.github.com/users/mchalski/repos","events_url":"https://api.github.com/users/mchalski/events{/privacy}","received_events_url":"https://api.github.com/users/mchalski/received_events","type":"User","site_admin":false},"repo":{"id":73178986,"node_id":"MDEwOlJlcG9zaXRvcnk3MzE3ODk4Ng==","name":"integration","full_name":"mchalski/integration","private":false,"owner":{"login":"mchalski","id":18258178,"node_id":"MDQ6VXNlcjE4MjU4MTc4","avatar_url":"https://avatars0.githubusercontent.com/u/18258178?v=4","gravatar_id":"","url":"https://api.github.com/users/mchalski","html_url":"https://github.com/mchalski","followers_url":"https://api.github.com/users/mchalski/followers","following_url":"https://api.github.com/users/mchalski/following{/other_user}","gists_url":"https://api.github.com/users/mchalski/gists{/gist_id}","starred_url":"https://api.github.com/users/mchalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchalski/subscriptions","organizations_url":"https://api.github.com/users/mchalski/orgs","repos_url":"https://api.github.com/users/mchalski/repos","events_url":"https://api.github.com/users/mchalski/events{/privacy}","received_events_url":"https://api.github.com/users/mchalski/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mchalski/integration","description":"Mender backend services integration.","fork":true,"url":"https://api.github.com/repos/mchalski/integration","forks_url":"https://api.github.com/repos/mchalski/integration/forks","keys_url":"https://api.github.com/repos/mchalski/integration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mchalski/integration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mchalski/integration/teams","hooks_url":"https://api.github.com/repos/mchalski/integration/hooks","issue_events_url":"https://api.github.com/repos/mchalski/integration/issues/events{/number}","events_url":"https://api.github.com/repos/mchalski/integration/events","assignees_url":"https://api.github.com/repos/mchalski/integration/assignees{/user}","branches_url":"https://api.github.com/repos/mchalski/integration/branches{/branch}","tags_url":"https://api.github.com/repos/mchalski/integration/tags","blobs_url":"https://api.github.com/repos/mchalski/integration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mchalski/integration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mchalski/integration/git/refs{/sha}","trees_url":"https://api.github.com/repos/mchalski/integration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mchalski/integration/statuses/{sha}","languages_url":"https://api.github.com/repos/mchalski/integration/languages","stargazers_url":"https://api.github.com/repos/mchalski/integration/stargazers","contributors_url":"https://api.github.com/repos/mchalski/integration/contributors","subscribers_url":"https://api.github.com/repos/mchalski/integration/subscribers","subscription_url":"https://api.github.com/repos/mchalski/integration/subscription","commits_url":"https://api.github.com/repos/mchalski/integration/commits{/sha}","git_commits_url":"https://api.github.com/repos/mchalski/integration/git/commits{/sha}","comments_url":"https://api.github.com/repos/mchalski/integration/comments{/number}","issue_comment_url":"https://api.github.com/repos/mchalski/integration/issues/comments{/number}","contents_url":"https://api.github.com/repos/mchalski/integration/contents/{+path}","compare_url":"https://api.github.com/repos/mchalski/integration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mchalski/integration/merges","archive_url":"https://api.github.com/repos/mchalski/integration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mchalski/integration/downloads","issues_url":"https://api.github.com/repos/mchalski/integration/issues{/number}","pulls_url":"https://api.github.com/repos/mchalski/integration/pulls{/number}","milestones_url":"https://api.github.com/repos/mchalski/integration/milestones{/number}","notifications_url":"https://api.github.com/repos/mchalski/integration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mchalski/integration/labels{/name}","releases_url":"https://api.github.com/repos/mchalski/integration/releases{/id}","deployments_url":"https://api.github.com/repos/mchalski/integration/deployments","created_at":"2016-11-08T11:20:32Z","updated_at":"2019-09-17T12:16:50Z","pushed_at":"2019-09-27T09:09:16Z","git_url":"git://github.com/mchalski/integration.git","ssh_url":"git@github.com:mchalski/integration.git","clone_url":"https://github.com/mchalski/integration.git","svn_url":"https://github.com/mchalski/integration","homepage":"https://mender.io","size":1665,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mendersoftware:MEN-2648","ref":"MEN-2648","sha":"8a38eb605f278d7743af033857637eb28356ef69","user":{"login":"mendersoftware","id":15040539,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDQwNTM5","avatar_url":"https://avatars1.githubusercontent.com/u/15040539?v=4","gravatar_id":"","url":"https://api.github.com/users/mendersoftware","html_url":"https://github.com/mendersoftware","followers_url":"https://api.github.com/users/mendersoftware/followers","following_url":"https://api.github.com/users/mendersoftware/following{/other_user}","gists_url":"https://api.github.com/users/mendersoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/mendersoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mendersoftware/subscriptions","organizations_url":"https://api.github.com/users/mendersoftware/orgs","repos_url":"https://api.github.com/users/mendersoftware/repos","events_url":"https://api.github.com/users/mendersoftware/events{/privacy}","received_events_url":"https://api.github.com/users/mendersoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":56060145,"node_id":"MDEwOlJlcG9zaXRvcnk1NjA2MDE0NQ==","name":"integration","full_name":"mendersoftware/integration","private":false,"owner":{"login":"mendersoftware","id":15040539,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDQwNTM5","avatar_url":"https://avatars1.githubusercontent.com/u/15040539?v=4","gravatar_id":"","url":"https://api.github.com/users/mendersoftware","html_url":"https://github.com/mendersoftware","followers_url":"https://api.github.com/users/mendersoftware/followers","following_url":"https://api.github.com/users/mendersoftware/following{/other_user}","gists_url":"https://api.github.com/users/mendersoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/mendersoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mendersoftware/subscriptions","organizations_url":"https://api.github.com/users/mendersoftware/orgs","repos_url":"https://api.github.com/users/mendersoftware/repos","events_url":"https://api.github.com/users/mendersoftware/events{/privacy}","received_events_url":"https://api.github.com/users/mendersoftware/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mendersoftware/integration","description":"Mender backend services integration.","fork":false,"url":"https://api.github.com/repos/mendersoftware/integration","forks_url":"https://api.github.com/repos/mendersoftware/integration/forks","keys_url":"https://api.github.com/repos/mendersoftware/integration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mendersoftware/integration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mendersoftware/integration/teams","hooks_url":"https://api.github.com/repos/mendersoftware/integration/hooks","issue_events_url":"https://api.github.com/repos/mendersoftware/integration/issues/events{/number}","events_url":"https://api.github.com/repos/mendersoftware/integration/events","assignees_url":"https://api.github.com/repos/mendersoftware/integration/assignees{/user}","branches_url":"https://api.github.com/repos/mendersoftware/integration/branches{/branch}","tags_url":"https://api.github.com/repos/mendersoftware/integration/tags","blobs_url":"https://api.github.com/repos/mendersoftware/integration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mendersoftware/integration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mendersoftware/integration/git/refs{/sha}","trees_url":"https://api.github.com/repos/mendersoftware/integration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mendersoftware/integration/statuses/{sha}","languages_url":"https://api.github.com/repos/mendersoftware/integration/languages","stargazers_url":"https://api.github.com/repos/mendersoftware/integration/stargazers","contributors_url":"https://api.github.com/repos/mendersoftware/integration/contributors","subscribers_url":"https://api.github.com/repos/mendersoftware/integration/subscribers","subscription_url":"https://api.github.com/repos/mendersoftware/integration/subscription","commits_url":"https://api.github.com/repos/mendersoftware/integration/commits{/sha}","git_commits_url":"https://api.github.com/repos/mendersoftware/integration/git/commits{/sha}","comments_url":"https://api.github.com/repos/mendersoftware/integration/comments{/number}","issue_comment_url":"https://api.github.com/repos/mendersoftware/integration/issues/comments{/number}","contents_url":"https://api.github.com/repos/mendersoftware/integration/contents/{+path}","compare_url":"https://api.github.com/repos/mendersoftware/integration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mendersoftware/integration/merges","archive_url":"https://api.github.com/repos/mendersoftware/integration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mendersoftware/integration/downloads","issues_url":"https://api.github.com/repos/mendersoftware/integration/issues{/number}","pulls_url":"https://api.github.com/repos/mendersoftware/integration/pulls{/number}","milestones_url":"https://api.github.com/repos/mendersoftware/integration/milestones{/number}","notifications_url":"https://api.github.com/repos/mendersoftware/integration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mendersoftware/integration/labels{/name}","releases_url":"https://api.github.com/repos/mendersoftware/integration/releases{/id}","deployments_url":"https://api.github.com/repos/mendersoftware/integration/deployments","created_at":"2016-04-12T12:14:32Z","updated_at":"2019-09-23T08:29:55Z","pushed_at":"2019-09-27T09:09:18Z","git_url":"git://github.com/mendersoftware/integration.git","ssh_url":"git@github.com:mendersoftware/integration.git","clone_url":"https://github.com/mendersoftware/integration.git","svn_url":"https://github.com/mendersoftware/integration","homepage":"https://mender.io","size":1925,"stargazers_count":36,"watchers_count":36,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":45,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":45,"open_issues":4,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mendersoftware/integration/pulls/698"},"html":{"href":"https://github.com/mendersoftware/integration/pull/698"},"issue":{"href":"https://api.github.com/repos/mendersoftware/integration/issues/698"},"comments":{"href":"https://api.github.com/repos/mendersoftware/integration/issues/698/comments"},"review_comments":{"href":"https://api.github.com/repos/mendersoftware/integration/pulls/698/comments"},"review_comment":{"href":"https://api.github.com/repos/mendersoftware/integration/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mendersoftware/integration/pulls/698/commits"},"statuses":{"href":"https://api.github.com/repos/mendersoftware/integration/statuses/bf0a3c8ece1b8c3fe33c3a930998a670722ea8b0"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"kacf"}}