Skip to content

Commit

Permalink
Merge pull request #532 from girder/no-unneeded-girder-worker
Browse files Browse the repository at this point in the history
Don't use the girder worker fixture when it isn't needed.
  • Loading branch information
manthey authored Jan 21, 2021
2 parents fee9ed9 + 2774196 commit ca7246e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 47 deletions.
13 changes: 5 additions & 8 deletions girder/test_girder/web_client_specs/imageViewerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ $(function () {
$('.g-large-image-create').click();
});
girderTest.waitForLoad();
// wait for job to complete
waitsFor(function () {
return $('.g-item-image-viewer-select').length !== 0;
}, 15000);
}, 'job to complete', 15000);
girderTest.waitForLoad();
});
});
Expand All @@ -73,7 +72,7 @@ $(function () {
girderTest.waitForLoad();
waitsFor(function () {
return !$('.g-item-image-viewer-select').length;
}, 15000);
}, 'select button to vanish', 15000);
girderTest.waitForLoad();
});
it('remake a large image and then remove the image file', function () {
Expand All @@ -84,10 +83,9 @@ $(function () {
$('.g-large-image-create').click();
});
girderTest.waitForLoad();
// wait for job to complete
waitsFor(function () {
return $('.g-item-image-viewer-select').length !== 0;
}, 15000);
}, 'job to complete', 15000);
girderTest.waitForLoad();
runs(function () {
$('.g-delete-file').click();
Expand All @@ -99,7 +97,7 @@ $(function () {
girderTest.waitForLoad();
waitsFor(function () {
return !$('.g-item-image-viewer-select').length;
}, 15000);
}, 'select button to vanish', 15000);
girderTest.waitForLoad();
});
it('upload test file', function () {
Expand Down Expand Up @@ -128,10 +126,9 @@ $(function () {
$('.g-large-image-create').click();
});
girderTest.waitForLoad();
// wait for job to complete
waitsFor(function () {
return $('.g-item-image-viewer-select').length > 0 && $('.g-large-image-remove').length > 0;
}, 15000);
}, 'job to complete', 15000);
girderTest.waitForLoad();
});
});
Expand Down
25 changes: 0 additions & 25 deletions girder_annotation/test_annotation/girder_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
import os
import pytest
import six
import subprocess

from girder import events
from girder.models.folder import Folder
from girder.models.setting import Setting
from girder.models.upload import Upload

from girder_worker.girder_plugin.constants import PluginSettings as WorkerSettings

from test.utilities import externaldata


Expand Down Expand Up @@ -67,27 +63,6 @@ def getBody(response, text=True):
return data


@pytest.fixture
def girderWorker(db):
"""
Run an instance of Girder worker, connected to rabbitmq. The rabbitmq
service must be running.
"""
broker = 'amqp://[email protected]'
Setting().set(WorkerSettings.BROKER, broker)
Setting().set(WorkerSettings.BACKEND, broker)
env = os.environ.copy()
env['C_FORCE_ROOT'] = 'true'
proc = subprocess.Popen([
'celery', '-A', 'girder_worker.app', 'worker', '--broker', broker, '--concurrency=1'],
close_fds=True, env=env)
yield True
proc.terminate()
proc.wait()
Setting().unset(WorkerSettings.BROKER)
Setting().unset(WorkerSettings.BACKEND)


def unbindGirderEventsByHandlerName(handlerName):
for eventName in events._mapping:
events.unbind(eventName, handlerName)
Expand Down
5 changes: 2 additions & 3 deletions girder_annotation/test_annotation/test_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
from girder.models.folder import Folder
from girder.models.item import Item

from .girder_utilities import girderWorker, unbindLargeImage, unbindAnnotation # noqa
from .girder_utilities import unbindLargeImage, unbindAnnotation # noqa


@pytest.mark.usefixtures('unbindLargeImage', 'unbindAnnotation') # noqa
@pytest.mark.usefixtures('girderWorker') # noqa
@pytest.mark.plugin('large_image_annotation')
@pytest.mark.parametrize('spec', (
'annotationListSpec.js',
'geojsAnnotationSpec.js',
'geojsSpec.js',
))
def testWebClientWithAnnotation(boundServer, fsAssetstore, db, spec, girderWorker): # noqa
def testWebClientWithAnnotation(boundServer, fsAssetstore, db, spec):
spec = os.path.join(os.path.dirname(__file__), 'web_client_specs', spec)
runWebClientTest(boundServer, spec, 15000)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,18 @@ describe('AnnotationListWidget', function () {
});
girderTest.waitForLoad();
runs(function () {
girderTest.binaryUpload('${large_image}/../../test/test_files/yb10kx5k.png');
girderTest.binaryUpload('${large_image}/../../test/test_files/yb10kx5k.zstd.tiff');
});
girderTest.waitForLoad();
});
it('navigate to item and make a large image', function () {
it('navigate to item', function () {
runs(function () {
$('a.g-item-list-link').click();
});
girderTest.waitForLoad();
waitsFor(function () {
return $('.g-large-image-create').length !== 0;
});
runs(function () {
$('.g-large-image-create').click();
});
girderTest.waitForLoad();
// wait for job to complete
waitsFor(function () {
return $('.g-item-image-viewer-select').length !== 0;
}, 15000);
}, 'image to load', 15000);
girderTest.waitForLoad();
runs(function () {
expect($('.g-annotation-list-container .g-annotation-row').length).toBe(0);
Expand Down
Binary file added test/test_files/yb10kx5k.zstd.tiff
Binary file not shown.

0 comments on commit ca7246e

Please sign in to comment.