Closed (fixed)
Project:
Elasticsearch Connector
Version:
8.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Aug 2025 at 09:05 UTC
Updated:
12 May 2026 at 16:40 UTC
Jump to comment: Most recent
Comments
Comment #2
drdam commentedComment #3
mparker17@drdam, thank you very much!
I think for now, let's add the "original Id" of the index only in the IndexParamsEvent; and work on the other events in future issues, because it will be easier for me to review and merge smaller changes. Also, once we have figured out all the work that we need to do for this ticket, the future tickets will be easier/faster.
Comment #5
mparker17I've created a merge request with the changes; let's see what testbot thinks.
Comment #6
mparker17Moving the issue to Needs Review.
Comment #7
mparker17Updating issue tags
Comment #8
mparker17Briefly checking the status of this issue after releasing 8.0.0-alpha5...
Comment #9
drdam commentedI have find the bug, but now I have an error I don't understand :
Comment #10
mparker17@drdam, I apologize for the time it has taken me to respond to your message!
The error you were seeing...
... is related to test doubles (a technique used for writing unit tests)...
In this case, the error is telling us that we need to update an
\Drupal\search_api\IndexInterfacetest-double that we are using in the test (\Drupal\Tests\elasticsearch_connector\Unit\SearchAPI\IndexParamBuilderTest::testbuildIndexParams()) to expect a new call to a method namedgetOriginalId()- we added this call in the production code when we create an IndexParamsEvent in \Drupal\elasticsearch_connector\SearchAPI\IndexParamBuilder::buildIndexParams().In this case, to tell the test-double what to do when
getOriginalId()gets called on it, we would change it like this...Aside:
"Test doubles" are sometimes called "substitutions", and they're simple substitute objects that you can use in place of something more complicated, and there are bunch of related terms: "mock objects"/"mocks", "dummy objects"/"dummies", "fakes", "stubs", "spies", etc. Basically, we want unit tests to be as decoupled (and fast to write and run) as possible, so we use test doubles so our unit test can run in isolation, regardless of how those other systems change. We tell the test doubles what to expect, and they alert us (i.e.: with an error like what you saw) when the expectations change. When we get an error like that, we have to decide if that change was accidental (i.e.: fix our production code) or intentional (i.e.: fix our tests) - in this case, it was intentional, so we fixed our tests by telling the test double to expect something new.
If you want to find out more about test doubles, I recommend reading:
I'm hoping to merge this code before a beta release, so I'm going to work on this issue a bit (I will probably write more tests). I'll post here when I'm done, and will likely request that you test my changes. Thank you in advance for your patience with me!
Comment #11
mparker17Actually, it turns out that IndexParamsEvent already has a functional test in
\Drupal\elasticsearch_connector_test\EventSubscriber\ElasticSearchEventSubscribers::onIndexParams(); and we know the new functionality is already tested because of the test-double error that we fixed earlier.I'll write a change record, create a 9.0.x branch, then merge it.
Thank you very much for your contribution, @drdam!
Comment #12
mparker17Comment #13
mparker17I've added a change record: IndexParamsEvent now has a getOriginalIndexId() method
I will now create a merge request for the 9.0.x branch. I am tagging this issue with "Needs backport to 8.0.x" so I remember to merge the original MR.
Comment #15
mparker17Comment #17
mparker17Merged to 9.0.x; will merge to 8.0.x next.
Comment #19
mparker17Merged to 8.0.x, and published the change record.
I will update this issue when I make a release.
Comment #21
mparker17The changes in this issue were released in elasticsearch_connector-9.0.0-alpha3, and elasticsearch_connector-8.0.0-alpha7