Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many small issues #1342

Merged
merged 6 commits into from
Dec 13, 2024

fix #1334 fail send when len_written == 0

3a355e6
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

Many small issues #1342

fix #1334 fail send when len_written == 0
3a355e6
Select commit
Loading
Failed to load commit list.
GitHub Actions / Test Results failed Dec 13, 2024 in 0s

3 fail, 3 skipped, 232 pass in 1m 35s

238 tests   232 ✅  1m 35s ⏱️
  1 suites    3 💤
  1 files      3 ❌

Results for commit 3a355e6.

Annotations

Check warning on line 0 in sarracenia.__init___test.Test_Message

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_fromFileInfo (sarracenia.__init___test.Test_Message) failed

tests/junit/test-results.xml [took 0s]
Raw output
Failed: DID NOT RAISE <class 'KeyError'>
self = <__init___test.Test_Message object at 0x7fd9e4580040>
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_fromFileInfo0')

    def test_fromFileInfo(self, tmp_path):
        # Set 1
        path = str(tmp_path) + os.sep + "file1.txt"
        open(path, 'a').close()
        options = sarracenia.config.default_config()
    
        msg = sarracenia.Message.fromFileInfo(path, options, None)
        assert msg['_format'] == 'v03'
        assert len(msg['_deleteOnPost']) == 10
        assert msg['local_offset'] == 0
    
        # Set 2
        path = str(tmp_path) + os.sep + "file2.txt"
        open(path, 'a').close()
        options = sarracenia.config.default_config()
        options.permCopy = True
        options.timeCopy = False
        options.to_clusters = "to_clusters"
        options.cluster = "from_cluster"
        options.source = "source"
        options.identity_method = ''
        delattr(options, 'post_format')
        msg = sarracenia.Message.fromFileInfo(path, options, os.lstat(path))
        assert msg['to_clusters'] == 'to_clusters'
        assert msg['from_cluster'] == 'from_cluster'
        assert msg['source'] == 'source'
        assert msg['_format'] == 'v03'
    
        # Set 3
        options = sarracenia.config.default_config()
        options.strip = 1
        options.identity_method = 'random'
        options.post_format = 'post_format'
        options.exchange = ''
        options.post_exchange = 'post_exchange'
        msg = sarracenia.Message.fromFileInfo(str(tmp_path), options, os.lstat(tmp_path))
        assert msg['rename'] == os.sep + os.path.relpath(tmp_path, '/tmp')
        assert msg['_format'] == 'post_format'
        assert msg['exchange'] == 'post_exchange'
        assert msg['identity']['method'] == 'random'
    
        # Set 4
        path = str(tmp_path) + os.sep + "file4.txt"
        open(path, 'a').close()
        options = sarracenia.config.default_config()
        options.strip = 20
        options.identity_method = 'cod,identityValue'
        delattr(options, 'post_format')
        options.post_topicPrefix = ['v02']
        msg = sarracenia.Message.fromFileInfo(path, options, os.lstat(path))
        assert msg['rename'] == "/"
        assert msg['_format'] == "v02"
        assert msg['identity'] == {'method': 'cod', 'value': 'identityValue' }
    
        #Set 5
        path = str(tmp_path) + os.sep + "file5.txt"
        open(path, 'a').close()
        options = sarracenia.config.default_config()
        options.rename = str(tmp_path) + os.sep + "file4a.txt"
>       with pytest.raises(KeyError):
E       Failed: DID NOT RAISE <class 'KeyError'>

tests/sarracenia/__init___test.py:325: Failed

Check warning on line 0 in sarracenia.config_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_subscription (sarracenia.config_test) failed

tests/junit/test-results.xml [took 0s]
Raw output
AssertionError: assert 2 == 1
 +  where 2 = len([{'broker': <sarracenia.config.credentials.Credential object at 0x7fd9c4be1270>, 'bindings': [{'exchange': 'hoho1', 'p...ernal.cloudapp.net_66242792', 'cleanup_needed': None, 'durable': True, 'prefetch': 25, 'bind': True, 'declare': True}}])
 +    where [{'broker': <sarracenia.config.credentials.Credential object at 0x7fd9c4be1270>, 'bindings': [{'exchange': 'hoho1', 'p...ernal.cloudapp.net_66242792', 'cleanup_needed': None, 'durable': True, 'prefetch': 25, 'bind': True, 'declare': True}}] = <sarracenia.config.Config object at 0x7fd9c4be1150>.subscriptions
def test_subscription():
    
         o = copy.deepcopy(sarracenia.config.default_config())
    
         o.component = 'subscribe'
         o.config = 'ex1'
         o.action = 'start'
         o.no = 1
         before_add=len(o.credentials.credentials)
         o.credentials.add( 'amqp://lapinferoce:etpoilu@localhost' )
         o.credentials.add( 'amqp://capelli:tropcuit@localhost' )
         o.parse_line( o.component, o.config, "subscribe/ex1", 1, "broker amqp://lapinferoce@localhost" )
         o.parse_line( o.component, o.config, "subscribe/ex1", 2, "exchange hoho1" )
    
         assert( o.exchange == "hoho1" )
    
         o.parse_line( o.component, o.config, "subscribe/ex1", 3, "subtopic hoho.#" )
         o.parse_line( o.component, o.config, "subscribe/ex1", 3, "subtopic lala.hoho.#" )
    
         assert( hasattr(o,'subscriptions')  )
>        assert( len(o.subscriptions)==1 )
E        AssertionError: assert 2 == 1
E         +  where 2 = len([{'broker': <sarracenia.config.credentials.Credential object at 0x7fd9c4be1270>, 'bindings': [{'exchange': 'hoho1', 'p...ernal.cloudapp.net_66242792', 'cleanup_needed': None, 'durable': True, 'prefetch': 25, 'bind': True, 'declare': True}}])
E         +    where [{'broker': <sarracenia.config.credentials.Credential object at 0x7fd9c4be1270>, 'bindings': [{'exchange': 'hoho1', 'p...ernal.cloudapp.net_66242792', 'cleanup_needed': None, 'durable': True, 'prefetch': 25, 'bind': True, 'declare': True}}] = <sarracenia.config.Config object at 0x7fd9c4be1150>.subscriptions

tests/sarracenia/config_test.py:336: AssertionError

Check warning on line 0 in sarracenia.flowcb.filter.geometry_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_after_accept (sarracenia.flowcb.filter.geometry_test) failed

tests/junit/test-results.xml [took 0s]
Raw output
assert 1 == 2
 +  where 1 = len([{'_format': 'v03', '_deleteOnPost': {'_format'}, 'new_file': '/foo/bar/NewFile.txt', 'new_dir': '/foo/bar', 'geometry': '{"type": "Point", "coordinates": [-76, 39.284]}'}])
 +    where [{'_format': 'v03', '_deleteOnPost': {'_format'}, 'new_file': '/foo/bar/NewFile.txt', 'new_dir': '/foo/bar', 'geometry': '{"type": "Point", "coordinates": [-76, 39.284]}'}] = namespace(ok=[], incoming=[{'_format': 'v03', '_deleteOnPost': {'_format'}, 'new_file': '/foo/bar/NewFile.txt', 'new_d...wFile.txt', 'new_dir': '/foo/bar', 'geometry': '{"type": "LineString", "coordinates": [93, 100]}'}], directories_ok=[]).rejected
def test_after_accept():
        options = sarracenia.config.default_config()
        options.logLevel = 'DEBUG'
    
        # Testing when the config is a polygon
        options.geometry = [features['poly1']]
        geojson = sarracenia.flowcb.filter.geometry.Geometry(options)
    
        worklist = make_worklist()
        #accepted
        worklist.incoming.append(make_message("poly2"))
        worklist.incoming.append(make_message("pointA"))
        #rejected
        worklist.incoming.append(make_message("poly3"))
        worklist.incoming.append(make_message("pointB"))
        #failed
        worklist.incoming.append(make_message("line1"))
    
        geojson.after_accept(worklist)
>       assert len(worklist.rejected) == 2
E       assert 1 == 2
E        +  where 1 = len([{'_format': 'v03', '_deleteOnPost': {'_format'}, 'new_file': '/foo/bar/NewFile.txt', 'new_dir': '/foo/bar', 'geometry': '{"type": "Point", "coordinates": [-76, 39.284]}'}])
E        +    where [{'_format': 'v03', '_deleteOnPost': {'_format'}, 'new_file': '/foo/bar/NewFile.txt', 'new_dir': '/foo/bar', 'geometry': '{"type": "Point", "coordinates": [-76, 39.284]}'}] = namespace(ok=[], incoming=[{'_format': 'v03', '_deleteOnPost': {'_format'}, 'new_file': '/foo/bar/NewFile.txt', 'new_d...wFile.txt', 'new_dir': '/foo/bar', 'geometry': '{"type": "LineString", "coordinates": [93, 100]}'}], directories_ok=[]).rejected

tests/sarracenia/flowcb/filter/geometry_test.py:100: AssertionError