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;
|
package com.appsmith.server.services;
|
||||||
|
|
||||||
|
import com.appsmith.server.configurations.CommonConfig;
|
||||||
import com.appsmith.server.configurations.WithMockAppsmithUser;
|
import com.appsmith.server.configurations.WithMockAppsmithUser;
|
||||||
import com.appsmith.server.domains.LoginSource;
|
import com.appsmith.server.domains.LoginSource;
|
||||||
import com.appsmith.server.domains.User;
|
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.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.Mockito;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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 org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.test.StepVerifier;
|
import reactor.test.StepVerifier;
|
||||||
|
|
@ -26,8 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@SpringBootTest(properties = {"signup.disabled = true", "admin.emails = dummy_admin@appsmith.com,dummy2@appsmith.com"})
|
@SpringBootTest
|
||||||
@DirtiesContext
|
|
||||||
public class UserServiceWithDisabledSignupTest {
|
public class UserServiceWithDisabledSignupTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -48,11 +49,17 @@ public class UserServiceWithDisabledSignupTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
PermissionGroupRepository permissionGroupRepository;
|
PermissionGroupRepository permissionGroupRepository;
|
||||||
|
|
||||||
|
@SpyBean
|
||||||
|
CommonConfig commonConfig;
|
||||||
|
|
||||||
Mono<User> userMono;
|
Mono<User> userMono;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
userMono = userService.findByEmail("usertest@usertest.com");
|
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
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import com.appsmith.server.domains.User;
|
||||||
import com.appsmith.server.domains.Workspace;
|
import com.appsmith.server.domains.Workspace;
|
||||||
import com.appsmith.server.dtos.ActionCollectionDTO;
|
import com.appsmith.server.dtos.ActionCollectionDTO;
|
||||||
import com.appsmith.server.dtos.ApplicationAccessDTO;
|
import com.appsmith.server.dtos.ApplicationAccessDTO;
|
||||||
|
import com.appsmith.server.dtos.ApplicationJson;
|
||||||
import com.appsmith.server.dtos.ApplicationPagesDTO;
|
import com.appsmith.server.dtos.ApplicationPagesDTO;
|
||||||
import com.appsmith.server.dtos.PageDTO;
|
import com.appsmith.server.dtos.PageDTO;
|
||||||
import com.appsmith.server.dtos.UserHomepageDTO;
|
import com.appsmith.server.dtos.UserHomepageDTO;
|
||||||
|
|
@ -287,28 +288,32 @@ public class ApplicationServiceCETest {
|
||||||
.getDefaultEnvironmentId(workspaceId, environmentPermission.getExecutePermission())
|
.getDefaultEnvironmentId(workspaceId, environmentPermission.getExecutePermission())
|
||||||
.block();
|
.block();
|
||||||
|
|
||||||
gitConnectedApp = new Application();
|
Application gitConnectedApp1 = new Application();
|
||||||
gitConnectedApp.setWorkspaceId(workspaceId);
|
gitConnectedApp1.setWorkspaceId(workspaceId);
|
||||||
GitApplicationMetadata gitData = new GitApplicationMetadata();
|
GitApplicationMetadata gitData = new GitApplicationMetadata();
|
||||||
gitData.setBranchName("testBranch");
|
gitData.setBranchName("testBranch");
|
||||||
gitData.setDefaultBranchName("testBranch");
|
gitData.setDefaultBranchName("testBranch");
|
||||||
gitData.setRepoName("testRepo");
|
gitData.setRepoName("testRepo");
|
||||||
gitData.setRemoteUrl("git@test.com:user/testRepo.git");
|
gitData.setRemoteUrl("git@test.com:user/testRepo.git");
|
||||||
gitData.setRepoName("testRepo");
|
gitData.setRepoName("testRepo");
|
||||||
gitConnectedApp.setGitApplicationMetadata(gitData);
|
gitConnectedApp1.setGitApplicationMetadata(gitData);
|
||||||
// This will be altered in update app by branch test
|
// This will be altered in update app by branch test
|
||||||
gitConnectedApp.setName("gitConnectedApp");
|
gitConnectedApp1.setName("gitConnectedApp");
|
||||||
gitConnectedApp = applicationPageService
|
Application newGitConnectedApp = applicationPageService
|
||||||
.createApplication(gitConnectedApp)
|
.createApplication(gitConnectedApp1)
|
||||||
.flatMap(application -> {
|
.flatMap(application -> {
|
||||||
application.getGitApplicationMetadata().setDefaultApplicationId(application.getId());
|
application.getGitApplicationMetadata().setDefaultApplicationId(application.getId());
|
||||||
return applicationService.save(application);
|
return applicationService.save(application);
|
||||||
})
|
})
|
||||||
// Assign the branchName to all the resources connected to the application
|
.block();
|
||||||
.flatMap(application ->
|
|
||||||
exportApplicationService.exportApplicationById(application.getId(), gitData.getBranchName()))
|
// Assign the branchName to all the resources connected to the application
|
||||||
.flatMap(applicationJson -> importApplicationService.importApplicationInWorkspaceFromGit(
|
ApplicationJson gitConnectedApplicationJson = exportApplicationService
|
||||||
workspaceId, applicationJson, gitConnectedApp.getId(), gitData.getBranchName()))
|
.exportApplicationById(newGitConnectedApp.getId(), gitData.getBranchName())
|
||||||
|
.block();
|
||||||
|
gitConnectedApp = importApplicationService
|
||||||
|
.importApplicationInWorkspaceFromGit(
|
||||||
|
workspaceId, gitConnectedApplicationJson, newGitConnectedApp.getId(), gitData.getBranchName())
|
||||||
.block();
|
.block();
|
||||||
|
|
||||||
testPlugin = pluginService.findByPackageName("restapi-plugin").block();
|
testPlugin = pluginService.findByPackageName("restapi-plugin").block();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user