Skip to content

v30.0.0

v30.0.0 #204

GitHub Actions / Test Results failed May 20, 2025 in 0s

7 fail, 179 pass in 7s

186 tests  ±0   179 ✅ +1   7s ⏱️ -6s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     7 ❌  - 1 

Results for commit ef40ea6. ± Comparison against earlier commit 16f7056.

Annotations

Check warning on line 0 in tests.unit.factories.test_agent_factory.TestSolanaAgentFactory

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_create_from_config_with_zep_and_mongo (tests.unit.factories.test_agent_factory.TestSolanaAgentFactory) failed

junit/test-results-3.13.xml [took 0s]
Raw output
AssertionError: expected call not found.
Expected: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>, zep_api_key='test-zep-key')
  Actual: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>)

pytest introspection follows:

Kwargs:
assert {'mongo_adapt...85523022176'>} == {'mongo_adapt...test-zep-key'}
  
  Omitting 1 identical items, use -vv to show
  Right contains 1 more item:
  {'zep_api_key': 'test-zep-key'}
  
  Full diff:
    {
        'mongo_adapter': <MagicMock name='MongoDBAdapter()' id='140285523022176'>,
  -     'zep_api_key': 'test-zep-key',
    }
self = <MagicMock name='MemoryRepository' id='140285523018144'>, args = ()
kwargs = {'mongo_adapter': <MagicMock name='MongoDBAdapter()' id='140285523022176'>, 'zep_api_key': 'test-zep-key'}
expected = call(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>, zep_api_key='test-zep-key')
actual = call(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>)
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f96c4c58680>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>, zep_api_key='test-zep-key')
E             Actual: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>)

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:979: AssertionError

During handling of the above exception, another exception occurred:

self = <MagicMock name='MemoryRepository' id='140285523018144'>, args = ()
kwargs = {'mongo_adapter': <MagicMock name='MongoDBAdapter()' id='140285523022176'>, 'zep_api_key': 'test-zep-key'}

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
            raise AssertionError(msg)
>       return self.assert_called_with(*args, **kwargs)
E       AssertionError: expected call not found.
E       Expected: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>, zep_api_key='test-zep-key')
E         Actual: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>)
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'mongo_adapt...85523022176'>} == {'mongo_adapt...test-zep-key'}
E         
E         Omitting 1 identical items, use -vv to show
E         Right contains 1 more item:
E         {'zep_api_key': 'test-zep-key'}
E         
E         Full diff:
E           {
E               'mongo_adapter': <MagicMock name='MongoDBAdapter()' id='140285523022176'>,
E         -     'zep_api_key': 'test-zep-key',
E           }

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:991: AssertionError

During handling of the above exception, another exception occurred:

self = <test_agent_factory.TestSolanaAgentFactory object at 0x7f96c5343460>
mock_query_service = <MagicMock name='QueryService' id='140285523018816'>
mock_memory_repo = <MagicMock name='MemoryRepository' id='140285523018144'>
mock_routing_service = <MagicMock name='RoutingService' id='140285523017808'>
mock_agent_service = <MagicMock name='AgentService' id='140285523021168'>
mock_openai_adapter = <MagicMock name='OpenAIAdapter' id='140285523021504'>
mock_mongo_adapter = <MagicMock name='MongoDBAdapter' id='140285523021840'>
zep_config = {'mongo': {'connection_string': 'mongodb://localhost:27017', 'database': 'test_db'}, 'openai': {'api_key': 'test-openai-key'}, 'zep': {'api_key': 'test-zep-key'}}

    @patch("solana_agent.factories.agent_factory.MongoDBAdapter")
    @patch("solana_agent.factories.agent_factory.OpenAIAdapter")
    @patch("solana_agent.factories.agent_factory.AgentService")
    @patch("solana_agent.factories.agent_factory.RoutingService")
    @patch("solana_agent.factories.agent_factory.MemoryRepository")
    @patch("solana_agent.factories.agent_factory.QueryService")
    def test_create_from_config_with_zep_and_mongo(
        self,
        mock_query_service,
        mock_memory_repo,
        mock_routing_service,
        mock_agent_service,
        mock_openai_adapter,
        mock_mongo_adapter,
        zep_config,
    ):
        """Test creating services with Zep and MongoDB configuration."""
        # Setup mocks
        mock_mongo_instance = MagicMock()
        mock_mongo_adapter.return_value = mock_mongo_instance
    
        mock_openai_instance = MagicMock()
        mock_openai_adapter.return_value = mock_openai_instance
    
        mock_memory_instance = MagicMock()
        mock_memory_repo.return_value = mock_memory_instance
    
        mock_agent_instance = MagicMock()
        mock_agent_service.return_value = mock_agent_instance
        mock_agent_instance.tool_registry.list_all_tools.return_value = []
    
        mock_routing_instance = MagicMock()
        mock_routing_service.return_value = mock_routing_instance
    
        mock_query_instance = MagicMock()
        mock_query_service.return_value = mock_query_instance
    
        # Call the factory
        result = SolanaAgentFactory.create_from_config(zep_config)
    
        # Verify calls
>       mock_memory_repo.assert_called_once_with(
            mongo_adapter=mock_mongo_instance, zep_api_key="test-zep-key"
        )
E       AssertionError: expected call not found.
E       Expected: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>, zep_api_key='test-zep-key')
E         Actual: MemoryRepository(mongo_adapter=<MagicMock name='MongoDBAdapter()' id='140285523022176'>)
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'mongo_adapt...85523022176'>} == {'mongo_adapt...test-zep-key'}
E         
E         Omitting 1 identical items, use -vv to show
E         Right contains 1 more item:
E         {'zep_api_key': 'test-zep-key'}
E         
E         Full diff:
E           {
E               'mongo_adapter': <MagicMock name='MongoDBAdapter()' id='140285523022176'>,
E         -     'zep_api_key': 'test-zep-key',
E           }

tests/unit/factories/test_agent_factory.py:427: AssertionError

Check warning on line 0 in tests.unit.factories.test_agent_factory.TestSolanaAgentFactory

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_create_from_config_with_zep_only (tests.unit.factories.test_agent_factory.TestSolanaAgentFactory) failed

junit/test-results-3.13.xml [took 0s]
Raw output
AssertionError: expected call not found.
Expected: MemoryRepository(zep_api_key='test-zep-key')
  Actual: MemoryRepository(mongo_adapter=None)

pytest introspection follows:

Kwargs:
assert {'mongo_adapter': None} == {'zep_api_key...test-zep-key'}
  
  Left contains 1 more item:
  {'mongo_adapter': None}
  Right contains 1 more item:
  {'zep_api_key': 'test-zep-key'}
  
  Full diff:
    {
  -     'zep_api_key': 'test-zep-key',
  +     'mongo_adapter': None,
    }
self = <MagicMock name='MemoryRepository' id='140285525515904'>, args = ()
kwargs = {'zep_api_key': 'test-zep-key'}
expected = call(zep_api_key='test-zep-key'), actual = call(mongo_adapter=None)
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f96c500e8e0>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: MemoryRepository(zep_api_key='test-zep-key')
E             Actual: MemoryRepository(mongo_adapter=None)

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:979: AssertionError

During handling of the above exception, another exception occurred:

self = <MagicMock name='MemoryRepository' id='140285525515904'>, args = ()
kwargs = {'zep_api_key': 'test-zep-key'}

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
            raise AssertionError(msg)
>       return self.assert_called_with(*args, **kwargs)
E       AssertionError: expected call not found.
E       Expected: MemoryRepository(zep_api_key='test-zep-key')
E         Actual: MemoryRepository(mongo_adapter=None)
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'mongo_adapter': None} == {'zep_api_key...test-zep-key'}
E         
E         Left contains 1 more item:
E         {'mongo_adapter': None}
E         Right contains 1 more item:
E         {'zep_api_key': 'test-zep-key'}
E         
E         Full diff:
E           {
E         -     'zep_api_key': 'test-zep-key',
E         +     'mongo_adapter': None,
E           }

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:991: AssertionError

During handling of the above exception, another exception occurred:

self = <test_agent_factory.TestSolanaAgentFactory object at 0x7f96c5213150>
mock_query_service = <MagicMock name='QueryService' id='140285525523296'>
mock_memory_repo = <MagicMock name='MemoryRepository' id='140285525515904'>
mock_routing_service = <MagicMock name='RoutingService' id='140285525523632'>
mock_agent_service = <MagicMock name='AgentService' id='140285525515568'>
mock_openai_adapter = <MagicMock name='OpenAIAdapter' id='140285525513888'>
zep_only_config = {'openai': {'api_key': 'test-openai-key'}, 'zep': {'api_key': 'test-zep-key'}}

    @patch("solana_agent.factories.agent_factory.OpenAIAdapter")
    @patch("solana_agent.factories.agent_factory.AgentService")
    @patch("solana_agent.factories.agent_factory.RoutingService")
    @patch("solana_agent.factories.agent_factory.MemoryRepository")
    @patch("solana_agent.factories.agent_factory.QueryService")
    def test_create_from_config_with_zep_only(
        self,
        mock_query_service,
        mock_memory_repo,
        mock_routing_service,
        mock_agent_service,
        mock_openai_adapter,
        zep_only_config,
    ):
        """Test creating services with Zep only configuration."""
        # Setup mocks
        mock_openai_instance = MagicMock()
        mock_openai_adapter.return_value = mock_openai_instance
    
        mock_memory_instance = MagicMock()
        mock_memory_repo.return_value = mock_memory_instance
    
        mock_agent_instance = MagicMock()
        mock_agent_service.return_value = mock_agent_instance
        mock_agent_instance.tool_registry.list_all_tools.return_value = []
    
        mock_routing_instance = MagicMock()
        mock_routing_service.return_value = mock_routing_instance
    
        mock_query_instance = MagicMock()
        mock_query_service.return_value = mock_query_instance
    
        # Call the factory
        result = SolanaAgentFactory.create_from_config(zep_only_config)
    
        # Verify calls
>       mock_memory_repo.assert_called_once_with(zep_api_key="test-zep-key")
E       AssertionError: expected call not found.
E       Expected: MemoryRepository(zep_api_key='test-zep-key')
E         Actual: MemoryRepository(mongo_adapter=None)
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'mongo_adapter': None} == {'zep_api_key...test-zep-key'}
E         
E         Left contains 1 more item:
E         {'mongo_adapter': None}
E         Right contains 1 more item:
E         {'zep_api_key': 'test-zep-key'}
E         
E         Full diff:
E           {
E         -     'zep_api_key': 'test-zep-key',
E         +     'mongo_adapter': None,
E           }

tests/unit/factories/test_agent_factory.py:469: AssertionError

Check warning on line 0 in tests.unit.factories.test_agent_factory.TestSolanaAgentFactory

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_create_from_config_with_invalid_zep (tests.unit.factories.test_agent_factory.TestSolanaAgentFactory) failed

junit/test-results-3.13.xml [took 0s]
Raw output
Failed: DID NOT RAISE <class 'ValueError'>
self = <test_agent_factory.TestSolanaAgentFactory object at 0x7f96c5213e50>
mock_query_service = <MagicMock name='QueryService' id='140285525512544'>
mock_routing_service = <MagicMock name='RoutingService' id='140285525514224'>
mock_agent_service = <MagicMock name='AgentService' id='140285525510192'>
mock_openai_adapter = <MagicMock name='OpenAIAdapter' id='140285525516912'>
invalid_zep_config = {'openai': {'api_key': 'test-openai-key'}, 'zep': {}}

    @patch("solana_agent.factories.agent_factory.OpenAIAdapter")
    @patch("solana_agent.factories.agent_factory.AgentService")
    @patch("solana_agent.factories.agent_factory.RoutingService")
    @patch("solana_agent.factories.agent_factory.QueryService")
    def test_create_from_config_with_invalid_zep(
        self,
        mock_query_service,
        mock_routing_service,
        mock_agent_service,
        mock_openai_adapter,
        invalid_zep_config,
    ):
        """Test creating services with invalid Zep configuration."""
        # Setup mocks
        mock_openai_instance = MagicMock()
        mock_openai_adapter.return_value = mock_openai_instance
    
        mock_agent_instance = MagicMock()
        mock_agent_service.return_value = mock_agent_instance
        mock_agent_instance.tool_registry.list_all_tools.return_value = []
    
        mock_routing_instance = MagicMock()
        mock_routing_service.return_value = mock_routing_instance
    
        mock_query_instance = MagicMock()
        mock_query_service.return_value = mock_query_instance
    
        # Call the factory - should raise ValueError
>       with pytest.raises(ValueError, match="Zep API key is required"):
E       Failed: DID NOT RAISE <class 'ValueError'>

tests/unit/factories/test_agent_factory.py:501: Failed

Check warning on line 0 in tests.unit.factories.test_agent_factory.TestSolanaAgentFactory

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_create_from_config_with_knowledge_base (tests.unit.factories.test_agent_factory.TestSolanaAgentFactory) failed

junit/test-results-3.13.xml [took 0s]
Raw output
AssertionError: expected call not found.
Expected: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=3072, create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', cloud_provider='aws', region='us-east-1', metric='cosine', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
  Actual: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=1536, cloud_provider='aws', region='us-east-1', metric='cosine', create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')

pytest introspection follows:

Kwargs:
assert {'api_key': '...s': 1536, ...} == {'api_key': '...s': 3072, ...}
  
  Omitting 11 identical items, use -vv to show
  Differing items:
  {'embedding_dimensions': 1536} != {'embedding_dimensions': 3072}
  
  Full diff:
    {
        'api_key': 'test-pinecone-key',
        'cloud_provider': 'aws',
        'create_index_if_not_exists': True,
  -     'embedding_dimensions': 3072,
  ?                              ^^^
  +     'embedding_dimensions': 1536,
  ?                             ++ ^
        'index_name': 'test-index',
        'initial_query_top_k_multiplier': 5,
        'metric': 'cosine',
        'region': 'us-east-1',
        'rerank_model': 'cohere-rerank-3.5',
        'rerank_text_field': 'content',
        'rerank_top_k': 3,
        'use_reranking': True,
    }
self = <MagicMock name='PineconeAdapter' id='140285523905904'>, args = ()
kwargs = {'api_key': 'test-pinecone-key', 'cloud_provider': 'aws', 'create_index_if_not_exists': True, 'embedding_dimensions': 3072, ...}
expected = call(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=3072, create_index_if_not_exists=True,...s', region='us-east-1', metric='cosine', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
actual = call(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=1536, cloud_provider='aws', region='us...=True, rerank_model='cohere-rerank-3.5', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f96c500d300>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=3072, create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', cloud_provider='aws', region='us-east-1', metric='cosine', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
E             Actual: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=1536, cloud_provider='aws', region='us-east-1', metric='cosine', create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:979: AssertionError

During handling of the above exception, another exception occurred:

self = <MagicMock name='PineconeAdapter' id='140285523905904'>, args = ()
kwargs = {'api_key': 'test-pinecone-key', 'cloud_provider': 'aws', 'create_index_if_not_exists': True, 'embedding_dimensions': 3072, ...}

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
            raise AssertionError(msg)
>       return self.assert_called_with(*args, **kwargs)
E       AssertionError: expected call not found.
E       Expected: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=3072, create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', cloud_provider='aws', region='us-east-1', metric='cosine', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
E         Actual: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=1536, cloud_provider='aws', region='us-east-1', metric='cosine', create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'api_key': '...s': 1536, ...} == {'api_key': '...s': 3072, ...}
E         
E         Omitting 11 identical items, use -vv to show
E         Differing items:
E         {'embedding_dimensions': 1536} != {'embedding_dimensions': 3072}
E         
E         Full diff:
E           {
E               'api_key': 'test-pinecone-key',
E               'cloud_provider': 'aws',
E               'create_index_if_not_exists': True,
E         -     'embedding_dimensions': 3072,
E         ?                              ^^^
E         +     'embedding_dimensions': 1536,
E         ?                             ++ ^
E               'index_name': 'test-index',
E               'initial_query_top_k_multiplier': 5,
E               'metric': 'cosine',
E               'region': 'us-east-1',
E               'rerank_model': 'cohere-rerank-3.5',
E               'rerank_text_field': 'content',
E               'rerank_top_k': 3,
E               'use_reranking': True,
E           }

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:991: AssertionError

During handling of the above exception, another exception occurred:

self = <test_agent_factory.TestSolanaAgentFactory object at 0x7f96c51911d0>
mock_query_service = <MagicMock name='QueryService' id='140285523917328'>
mock_memory_repo = <MagicMock name='MemoryRepository' id='140285523907920'>
mock_knowledge_base = <MagicMock name='KnowledgeBaseService' id='140285523917664'>
mock_pinecone_adapter = <MagicMock name='PineconeAdapter' id='140285523905904'>
mock_routing_service = <MagicMock name='RoutingService' id='140285523916656'>
mock_agent_service = <MagicMock name='AgentService' id='140285523916992'>
mock_openai_adapter = <MagicMock name='OpenAIAdapter' id='140285523911280'>
mock_mongo_adapter = <MagicMock name='MongoDBAdapter' id='140285523907584'>
knowledge_base_config = {'knowledge_base': {'collection': 'test_kb', 'pinecone': {'api_key': 'test-pinecone-key', 'cloud_provider': 'aws', 'cr...': {'connection_string': 'mongodb://localhost:27017', 'database': 'test_db'}, 'openai': {'api_key': 'test-openai-key'}}

    @patch("solana_agent.factories.agent_factory.MongoDBAdapter")
    @patch("solana_agent.factories.agent_factory.OpenAIAdapter")
    @patch("solana_agent.factories.agent_factory.AgentService")
    @patch("solana_agent.factories.agent_factory.RoutingService")
    @patch("solana_agent.factories.agent_factory.PineconeAdapter")
    # Added create=True
    @patch("solana_agent.factories.agent_factory.KnowledgeBaseService", create=True)
    # Added MemoryRepository mock
    @patch("solana_agent.factories.agent_factory.MemoryRepository")
    @patch("solana_agent.factories.agent_factory.QueryService")
    # Patches are applied bottom-up, arguments should match this order
    def test_create_from_config_with_knowledge_base(
        # Corrected argument order
        self,
        mock_query_service,
        mock_memory_repo,
        mock_knowledge_base,
        mock_pinecone_adapter,
        mock_routing_service,
        mock_agent_service,
        mock_openai_adapter,
        mock_mongo_adapter,
        knowledge_base_config,
    ):
        """Test creating services with knowledge base configuration."""
        # Setup mocks
        mock_mongo_instance = MagicMock()
        mock_mongo_adapter.return_value = mock_mongo_instance
    
        mock_openai_instance = MagicMock()
        mock_openai_adapter.return_value = mock_openai_instance
    
        mock_pinecone_instance = MagicMock()
        mock_pinecone_adapter.return_value = mock_pinecone_instance
    
        mock_kb_instance = MagicMock()
        mock_knowledge_base.return_value = mock_kb_instance
    
        # Mock MemoryRepository instance - should be created
        mock_memory_instance = MagicMock()
        mock_memory_repo.return_value = mock_memory_instance
    
        mock_agent_instance = MagicMock()
        mock_agent_service.return_value = mock_agent_instance
        mock_agent_instance.tool_registry.list_all_tools.return_value = []
    
        mock_routing_instance = MagicMock()
        mock_routing_service.return_value = mock_routing_instance
    
        mock_query_instance = MagicMock()
        mock_query_service.return_value = mock_query_instance
    
        # Call the factory
        result = SolanaAgentFactory.create_from_config(knowledge_base_config)
    
        # Verify calls
        # Adjusted assertion to match the actual call from the error log
>       mock_pinecone_adapter.assert_called_once_with(
            api_key="test-pinecone-key",
            index_name="test-index",
            embedding_dimensions=3072,
            create_index_if_not_exists=True,
            use_reranking=True,
            rerank_model="cohere-rerank-3.5",
            cloud_provider="aws",
            region="us-east-1",
            metric="cosine",
            rerank_top_k=3,
            initial_query_top_k_multiplier=5,
            rerank_text_field="content",
        )
E       AssertionError: expected call not found.
E       Expected: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=3072, create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', cloud_provider='aws', region='us-east-1', metric='cosine', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
E         Actual: PineconeAdapter(api_key='test-pinecone-key', index_name='test-index', embedding_dimensions=1536, cloud_provider='aws', region='us-east-1', metric='cosine', create_index_if_not_exists=True, use_reranking=True, rerank_model='cohere-rerank-3.5', rerank_top_k=3, initial_query_top_k_multiplier=5, rerank_text_field='content')
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'api_key': '...s': 1536, ...} == {'api_key': '...s': 3072, ...}
E         
E         Omitting 11 identical items, use -vv to show
E         Differing items:
E         {'embedding_dimensions': 1536} != {'embedding_dimensions': 3072}
E         
E         Full diff:
E           {
E               'api_key': 'test-pinecone-key',
E               'cloud_provider': 'aws',
E               'create_index_if_not_exists': True,
E         -     'embedding_dimensions': 3072,
E         ?                              ^^^
E         +     'embedding_dimensions': 1536,
E         ?                             ++ ^
E               'index_name': 'test-index',
E               'initial_query_top_k_multiplier': 5,
E               'metric': 'cosine',
E               'region': 'us-east-1',
E               'rerank_model': 'cohere-rerank-3.5',
E               'rerank_text_field': 'content',
E               'rerank_top_k': 3,
E               'use_reranking': True,
E           }

tests/unit/factories/test_agent_factory.py:684: AssertionError

Check warning on line 0 in tests.unit.factories.test_agent_factory.TestSolanaAgentFactory

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_create_from_config_with_kb_error_case_1 (tests.unit.factories.test_agent_factory.TestSolanaAgentFactory) failed

junit/test-results-3.13.xml [took 0s]
Raw output
AssertionError: expected call not found.
Expected: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[])
  Actual: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[], graph_memory=None)

pytest introspection follows:

Kwargs:
assert {'agent_servi...ount': 5, ...} == {'agent_servi...e': None, ...}
  
  Omitting 6 identical items, use -vv to show
  Left contains 1 more item:
  {'graph_memory': None}
  
  Full diff:
    {
        'agent_service': <MagicMock name='AgentService()' id='140285523029232'>,
  +     'graph_memory': None,
        'input_guardrails': [],
        'kb_results_count': 5,
        'knowledge_base': None,
        'memory_provider': <MagicMock name='MemoryRepository()' id='140285523020832'>,
        'routing_service': <MagicMock name='RoutingService()' id='140285523030240'>,
    }
self = <MagicMock name='QueryService' id='140285523914976'>, args = ()
kwargs = {'agent_service': <MagicMock name='AgentService()' id='140285523029232'>, 'input_guardrails': [], 'kb_results_count': 5, 'knowledge_base': None, ...}
expected = call(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingSer...agicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[])
actual = call(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingSer...ryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[], graph_memory=None)
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f96c4c58900>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[])
E             Actual: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[], graph_memory=None)

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:979: AssertionError

During handling of the above exception, another exception occurred:

self = <MagicMock name='QueryService' id='140285523914976'>, args = ()
kwargs = {'agent_service': <MagicMock name='AgentService()' id='140285523029232'>, 'input_guardrails': [], 'kb_results_count': 5, 'knowledge_base': None, ...}

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
            raise AssertionError(msg)
>       return self.assert_called_with(*args, **kwargs)
E       AssertionError: expected call not found.
E       Expected: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[])
E         Actual: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[], graph_memory=None)
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'agent_servi...ount': 5, ...} == {'agent_servi...e': None, ...}
E         
E         Omitting 6 identical items, use -vv to show
E         Left contains 1 more item:
E         {'graph_memory': None}
E         
E         Full diff:
E           {
E               'agent_service': <MagicMock name='AgentService()' id='140285523029232'>,
E         +     'graph_memory': None,
E               'input_guardrails': [],
E               'kb_results_count': 5,
E               'knowledge_base': None,
E               'memory_provider': <MagicMock name='MemoryRepository()' id='140285523020832'>,
E               'routing_service': <MagicMock name='RoutingService()' id='140285523030240'>,
E           }

/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/unittest/mock.py:991: AssertionError

During handling of the above exception, another exception occurred:

self = <test_agent_factory.TestSolanaAgentFactory object at 0x7f96c5253790>
mock_query_service = <MagicMock name='QueryService' id='140285523914976'>
mock_memory_repo = <MagicMock name='MemoryRepository' id='140285523026208'>
mock_knowledge_base = <MagicMock name='KnowledgeBaseService' id='140285523028896'>
mock_pinecone_adapter = <MagicMock name='PineconeAdapter' id='140285523028560'>
mock_routing_service = <MagicMock name='RoutingService' id='140285523020160'>
mock_agent_service = <MagicMock name='AgentService' id='140285523018480'>
mock_openai_adapter = <MagicMock name='OpenAIAdapter' id='140285523019488'>
mock_mongo_adapter = <MagicMock name='MongoDBAdapter' id='140285523019152'>
knowledge_base_config = {'knowledge_base': {'collection': 'test_kb', 'pinecone': {'api_key': 'test-pinecone-key', 'cloud_provider': 'aws', 'cr...': {'connection_string': 'mongodb://localhost:27017', 'database': 'test_db'}, 'openai': {'api_key': 'test-openai-key'}}

    @patch("solana_agent.factories.agent_factory.MongoDBAdapter")
    @patch("solana_agent.factories.agent_factory.OpenAIAdapter")
    @patch("solana_agent.factories.agent_factory.AgentService")
    @patch("solana_agent.factories.agent_factory.RoutingService")
    @patch("solana_agent.factories.agent_factory.PineconeAdapter")
    # Added create=True
    @patch("solana_agent.factories.agent_factory.KnowledgeBaseService", create=True)
    # Added MemoryRepository mock
    @patch("solana_agent.factories.agent_factory.MemoryRepository")
    @patch("solana_agent.factories.agent_factory.QueryService")
    # Patches are applied bottom-up, arguments should match this order
    def test_create_from_config_with_kb_error_case_1(
        # Corrected argument order
        self,
        mock_query_service,
        mock_memory_repo,
        mock_knowledge_base,
        mock_pinecone_adapter,
        mock_routing_service,
        mock_agent_service,
        mock_openai_adapter,
        mock_mongo_adapter,
        knowledge_base_config,
    ):
        """Test creating services when knowledge base initialization fails."""
        # Setup mocks
        mock_mongo_instance = MagicMock()
        mock_mongo_adapter.return_value = mock_mongo_instance
    
        mock_openai_instance = MagicMock()
        mock_openai_adapter.return_value = mock_openai_instance
    
        # Simulate Pinecone error causing KB init failure
        # No need to mock pinecone instance if side_effect is Exception
        mock_pinecone_adapter.side_effect = Exception("Pinecone error")
    
        # Mock MemoryRepository instance - should still be created
        mock_memory_instance = MagicMock()
        mock_memory_repo.return_value = mock_memory_instance
    
        mock_agent_instance = MagicMock()
        mock_agent_service.return_value = mock_agent_instance
        mock_agent_instance.tool_registry.list_all_tools.return_value = []
    
        mock_routing_instance = MagicMock()
        mock_routing_service.return_value = mock_routing_instance
    
        mock_query_instance = MagicMock()
        mock_query_service.return_value = mock_query_instance
    
        # Call the factory - should handle knowledge base error gracefully
        result = SolanaAgentFactory.create_from_config(knowledge_base_config)
    
        # Verify MemoryRepository was still called
        mock_memory_repo.assert_called_once_with(mongo_adapter=mock_mongo_instance)
    
        # Verify PineconeAdapter was called (attempted)
        mock_pinecone_adapter.assert_called_once()
        # Verify KnowledgeBaseService constructor was NOT called because Pinecone failed first
        mock_knowledge_base.assert_not_called()
    
        # Verify QueryService call includes the memory provider even if KB failed
>       mock_query_service.assert_called_once_with(
            agent_service=mock_agent_instance,
            routing_service=mock_routing_instance,
            memory_provider=mock_memory_instance,  # Expect the memory instance
            knowledge_base=None,
            kb_results_count=5,  # Comes from knowledge_base_config
            input_guardrails=[],
        )
E       AssertionError: expected call not found.
E       Expected: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[])
E         Actual: QueryService(agent_service=<MagicMock name='AgentService()' id='140285523029232'>, routing_service=<MagicMock name='RoutingService()' id='140285523030240'>, memory_provider=<MagicMock name='MemoryRepository()' id='140285523020832'>, knowledge_base=None, kb_results_count=5, input_guardrails=[], graph_memory=None)
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'agent_servi...ount': 5, ...} == {'agent_servi...e': None, ...}
E         
E         Omitting 6 identical items, use -vv to show
E         Left contains 1 more item:
E         {'graph_memory': None}
E         
E         Full diff:
E           {
E               'agent_service': <MagicMock name='AgentService()' id='140285523029232'>,
E         +     'graph_memory': None,
E               'input_guardrails': [],
E               'kb_results_count': 5,
E               'knowledge_base': None,
E               'memory_provider': <MagicMock name='MemoryRepository()' id='140285523020832'>,
E               'routing_service': <MagicMock name='RoutingService()' id='140285523030240'>,
E           }

tests/unit/factories/test_agent_factory.py:790: AssertionError

Check warning on line 0 in tests.unit.repositories.test_memory_repo.TestMemoryRepository

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_retrieve_mongo_only_returns_formatted_memory (tests.unit.repositories.test_memory_repo.TestMemoryRepository) failed

junit/test-results-3.13.xml [took 0s]
Raw output
AssertionError: assert '\nUser: Hello\nAssistant: Hi there' in 'User: Hello\nAssistant: Hi there\n'
self = <test_memory_repo.TestMemoryRepository object at 0x7f96c52436a0>
mock_mongo_adapter = <MagicMock spec='MongoDBAdapter' id='140285522415296'>

    @pytest.mark.asyncio
    async def test_retrieve_mongo_only_returns_formatted_memory(
        self, mock_mongo_adapter
    ):
        """Test retrieval from MongoDB only, returns formatted memory string."""
        # Setup: no Zep, only MongoDB
        repo = MemoryRepository(mongo_adapter=mock_mongo_adapter)
        # Mock MongoDB find to return a doc with user and assistant messages
        mock_mongo_adapter.find.return_value = [
            {"user_message": "Hello", "assistant_message": "Hi there"}
        ]
        result = await repo.retrieve("user123")
>       assert "\nUser: Hello\nAssistant: Hi there" in result
E       AssertionError: assert '\nUser: Hello\nAssistant: Hi there' in 'User: Hello\nAssistant: Hi there\n'

tests/unit/repositories/test_memory_repo.py:244: AssertionError

Check warning on line 0 in tests.unit.repositories.test_memory_repo.TestMemoryRepository

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_retrieve_mongo_only_handles_missing_fields (tests.unit.repositories.test_memory_repo.TestMemoryRepository) failed

junit/test-results-3.13.xml [took 0s]
Raw output
AssertionError: assert 'User: Hello\...stant: None\n' == ''
  
  + User: Hello
  + Assistant: None
self = <test_memory_repo.TestMemoryRepository object at 0x7f96c5131770>
mock_mongo_adapter = <MagicMock spec='MongoDBAdapter' id='140285523903552'>

    @pytest.mark.asyncio
    async def test_retrieve_mongo_only_handles_missing_fields(self, mock_mongo_adapter):
        """Test retrieval from MongoDB skips docs missing required fields."""
        repo = MemoryRepository(mongo_adapter=mock_mongo_adapter)
        # Missing assistant_message
        mock_mongo_adapter.find.return_value = [{"user_message": "Hello"}]
        result = await repo.retrieve("user123")
>       assert result == ""
E       AssertionError: assert 'User: Hello\...stant: None\n' == ''
E         
E         + User: Hello
E         + Assistant: None

tests/unit/repositories/test_memory_repo.py:261: AssertionError