chore: changes to pinpoint errors in ApplicationServiceCETest (#28213)
## Description > ApplicationServiceCETest is flaky in the setup, so breaking down the setup into multiple steps to pinpoint the failure. #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
This commit is contained in:
parent
93c2a2dde8
commit
d9b2cc8e95
|
|
@ -1,5 +1,6 @@
|
|||
package com.appsmith.server.services;
|
||||
|
||||
import com.appsmith.server.configurations.CommonConfig;
|
||||
import com.appsmith.server.configurations.WithMockAppsmithUser;
|
||||
import com.appsmith.server.domains.LoginSource;
|
||||
import com.appsmith.server.domains.User;
|
||||
|
|
@ -12,9 +13,10 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
|
@ -26,8 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
@Slf4j
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(properties = {"signup.disabled = true", "admin.emails = dummy_admin@appsmith.com,dummy2@appsmith.com"})
|
||||
@DirtiesContext
|
||||
@SpringBootTest
|
||||
public class UserServiceWithDisabledSignupTest {
|
||||
|
||||
@Autowired
|
||||
|
|
@ -48,11 +49,17 @@ public class UserServiceWithDisabledSignupTest {
|
|||
@Autowired
|
||||
PermissionGroupRepository permissionGroupRepository;
|
||||
|
||||
@SpyBean
|
||||
CommonConfig commonConfig;
|
||||
|
||||
Mono<User> userMono;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
userMono = userService.findByEmail("usertest@usertest.com");
|
||||
Mockito.when(commonConfig.isSignupDisabled()).thenReturn(Boolean.TRUE);
|
||||
Mockito.when(commonConfig.getAdminEmails())
|
||||
.thenReturn(Set.of("dummy_admin@appsmith.com", "dummy2@appsmith.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.appsmith.server.domains.User;
|
|||
import com.appsmith.server.domains.Workspace;
|
||||
import com.appsmith.server.dtos.ActionCollectionDTO;
|
||||
import com.appsmith.server.dtos.ApplicationAccessDTO;
|
||||
import com.appsmith.server.dtos.ApplicationJson;
|
||||
import com.appsmith.server.dtos.ApplicationPagesDTO;
|
||||
import com.appsmith.server.dtos.PageDTO;
|
||||
import com.appsmith.server.dtos.UserHomepageDTO;
|
||||
|
|
@ -287,28 +288,32 @@ public class ApplicationServiceCETest {
|
|||
.getDefaultEnvironmentId(workspaceId, environmentPermission.getExecutePermission())
|
||||
.block();
|
||||
|
||||
gitConnectedApp = new Application();
|
||||
gitConnectedApp.setWorkspaceId(workspaceId);
|
||||
Application gitConnectedApp1 = new Application();
|
||||
gitConnectedApp1.setWorkspaceId(workspaceId);
|
||||
GitApplicationMetadata gitData = new GitApplicationMetadata();
|
||||
gitData.setBranchName("testBranch");
|
||||
gitData.setDefaultBranchName("testBranch");
|
||||
gitData.setRepoName("testRepo");
|
||||
gitData.setRemoteUrl("git@test.com:user/testRepo.git");
|
||||
gitData.setRepoName("testRepo");
|
||||
gitConnectedApp.setGitApplicationMetadata(gitData);
|
||||
gitConnectedApp1.setGitApplicationMetadata(gitData);
|
||||
// This will be altered in update app by branch test
|
||||
gitConnectedApp.setName("gitConnectedApp");
|
||||
gitConnectedApp = applicationPageService
|
||||
.createApplication(gitConnectedApp)
|
||||
gitConnectedApp1.setName("gitConnectedApp");
|
||||
Application newGitConnectedApp = applicationPageService
|
||||
.createApplication(gitConnectedApp1)
|
||||
.flatMap(application -> {
|
||||
application.getGitApplicationMetadata().setDefaultApplicationId(application.getId());
|
||||
return applicationService.save(application);
|
||||
})
|
||||
// Assign the branchName to all the resources connected to the application
|
||||
.flatMap(application ->
|
||||
exportApplicationService.exportApplicationById(application.getId(), gitData.getBranchName()))
|
||||
.flatMap(applicationJson -> importApplicationService.importApplicationInWorkspaceFromGit(
|
||||
workspaceId, applicationJson, gitConnectedApp.getId(), gitData.getBranchName()))
|
||||
.block();
|
||||
|
||||
// Assign the branchName to all the resources connected to the application
|
||||
ApplicationJson gitConnectedApplicationJson = exportApplicationService
|
||||
.exportApplicationById(newGitConnectedApp.getId(), gitData.getBranchName())
|
||||
.block();
|
||||
gitConnectedApp = importApplicationService
|
||||
.importApplicationInWorkspaceFromGit(
|
||||
workspaceId, gitConnectedApplicationJson, newGitConnectedApp.getId(), gitData.getBranchName())
|
||||
.block();
|
||||
|
||||
testPlugin = pluginService.findByPackageName("restapi-plugin").block();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user