-
Type:
Bug
-
Resolution: Low Engagement
-
Priority:
Low
-
None
-
Affects Version/s: None
-
Component/s: None
-
Severity 3 - Minor
-
0
Summary
After a hook has been created, RepositoryHookDao.findByKey(internalRepository, hookKey) returns null. However, RepositoryHookService.getById(hookId) returns the record.
Environment
- Tested against 5.1.6 + H2
- Customer reports failures from 5.0 onwards (see Notes)
Steps to Reproduce
- Create a hook through RepositoryHookDao.create()
- Retrieve it through RepositoryHookDao.findByKey(internalRepository, hookKey)
Expected Results
The created record is returned.
Actual Results
null is returned.
Notes
Originally asked in this Community post.
We ran the plug-in of the customer and could reproduce the behaviour against 5.1.6 while debugging (breakpoint in RepositoryHookService.enable()):
- RepositoryHookService.getById(hookId) returns record
- RepositoryHookDao.findByKey(internalRepository, hookKey) returns null
- RepositoryHookDao.findAll(internalRepository, new PageRequestImpl(0,200)) does not return the record
However, when writing a test to validate:
InternalRepository one = repositoryDao.loadById(1);
String hookKey = "some.hook.key";
String data = "{\"cloneType\":\"http\",\"ignoreCerts\":true,\"jenkinsBase\":\"http://localhost\"}";
InternalRepositoryHook.Builder hookBuilder = new InternalRepositoryHook.Builder()
.hookKey(hookKey)
.repository(convertToInternalRepository(one))
.enabled(true);
hookBuilder.settings(data);
dao.create(hookBuilder.build());
InternalRepositoryHook hook = dao.findByKey(one, hookKey);
assertNotNull(hook);
We could not reproduce the issue (above test passes). Still, we are confident this is a bug in Bitbucket Server.
Workaround
Not applicable.
- is depended on by
-
DEVHELP-707 Loading...
- mentioned in
-
Page Loading...