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

test: fix test failures in ActionEventInterceptorTest #8938

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public EventVO answer(InvocationOnMock invocation) throws Throwable {
account.setId(ACCOUNT_ID);
user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone",
UUID.randomUUID().toString(), User.Source.UNKNOWN);
CallContext.register(user, account);
weizhouapache marked this conversation as resolved.
Show resolved Hide resolved

Mockito.when(accountDao.findById(ACCOUNT_ID)).thenReturn(account);
}
Expand All @@ -197,6 +198,8 @@ public void teardown() {

utils.init();

CallContext.unregister();

componentContextMocked.close();
}

Expand Down Expand Up @@ -265,7 +268,6 @@ public void testInterceptException() throws NoSuchMethodException {

@Test
public void testInterceptExceptionResource() throws NoSuchMethodException {
CallContext.register(user, account);
Long resourceId = 1L;
ApiCommandResourceType resourceType = ApiCommandResourceType.VirtualMachine;
CallContext.current().setEventResourceId(resourceId);
Expand All @@ -282,7 +284,6 @@ public void testInterceptExceptionResource() throws NoSuchMethodException {
Assert.assertEquals(eventVO.getState(), com.cloud.event.Event.State.Completed);
Assert.assertEquals(eventVO.getResourceId(), resourceId);
Assert.assertEquals(eventVO.getResourceType(), resourceType.toString());
CallContext.unregister();
}

@Test
Expand Down
Loading