-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for docker migration
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import pytest | ||
|
||
from middlewared.test.integration.assets.docker import docker | ||
from middlewared.test.integration.assets.pool import another_pool | ||
from middlewared.test.integration.utils import call | ||
|
||
|
||
APP_NAME = 'actual-budget' | ||
APP2_NAME = 'syncthing' | ||
BACKUP_NAME = 'test_backup' | ||
ENC_POOL_PASSWORD = 'test1234' | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def docker_pool(): | ||
with another_pool({'name': 'test_docker_migration_pool1'}) as pool: | ||
with docker(pool) as docker_config: | ||
yield docker_config | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def migration_pool(): | ||
with another_pool({'name': 'test_docker_migration_pool2'}) as pool: | ||
yield pool | ||
|
||
|
||
def test_install_docker_apps(docker_pool): | ||
call('app.create', { | ||
'app_name': APP_NAME, | ||
'train': 'community', | ||
'catalog_app': 'actual-budget', | ||
}, job=True) | ||
call('app.create', { | ||
'app_name': APP2_NAME, | ||
'train': 'stable', | ||
'catalog_app': 'syncthing', | ||
}, job=True) | ||
for app_name in (APP2_NAME, APP_NAME): | ||
assert call('app.get_instance', app_name)['name'] == app_name | ||
|
||
|
||
def test_docker_app_migration(docker_pool, migration_pool): | ||
try: | ||
call('docker.update', {'pool': migration_pool['name'], 'migrate_applications': True}, job=True) | ||
assert call('docker.config')['pool'] == migration_pool['name'] | ||
for app_name in (APP2_NAME, APP_NAME): | ||
assert call('app.get_instance', app_name)['name'] == app_name | ||
finally: | ||
call('docker.update', {'pool': None}, job=True) | ||
assert call('docker.config')['pool'] is None |