-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: additional test cases and method refactor to follow old standa…
…rds (#33734) ## Description - Added fallback implementation for autocommit eligibility helper to avoid accessing FS for git connected apps when feature flags are switched off - Added test cases to verify the same - modified test cases names to follow standards - refactored method to follow standard ## Automation /ok-to-test tags="@tag.Git" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9244442582> > Commit: bb8e141 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9244442582&attempt=1" target="_blank">Click here!</a> > It seems like **no tests ran** 😔. We are not able to recognize it, please check workflow <a href="https://github.com/appsmithorg/appsmith/actions/runs/9244442582" target="_blank">here.</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No
- Loading branch information
1 parent
2da8440
commit 6ad9210
Showing
11 changed files
with
356 additions
and
159 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
app/server/appsmith-server/src/main/java/com/appsmith/server/git/GitRedisUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.appsmith.server.git; | ||
|
||
import com.appsmith.server.exceptions.AppsmithError; | ||
import com.appsmith.server.exceptions.AppsmithException; | ||
import com.appsmith.server.helpers.RedisUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
import reactor.core.publisher.Mono; | ||
import reactor.util.retry.Retry; | ||
|
||
import static com.appsmith.server.helpers.GitUtils.MAX_RETRIES; | ||
import static com.appsmith.server.helpers.GitUtils.RETRY_DELAY; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class GitRedisUtils { | ||
|
||
private final RedisUtils redisUtils; | ||
|
||
public Mono<Boolean> addFileLock(String defaultApplicationId) { | ||
return redisUtils | ||
.addFileLock(defaultApplicationId) | ||
.retryWhen(Retry.fixedDelay(MAX_RETRIES, RETRY_DELAY) | ||
.onRetryExhaustedThrow((retryBackoffSpec, retrySignal) -> { | ||
throw new AppsmithException(AppsmithError.GIT_FILE_IN_USE); | ||
})); | ||
} | ||
|
||
public Mono<Boolean> addFileLockWithoutRetry(String defaultApplicationId) { | ||
return redisUtils.addFileLock(defaultApplicationId); | ||
} | ||
|
||
public Mono<Boolean> releaseFileLock(String defaultApplicationId) { | ||
return redisUtils.releaseFileLock(defaultApplicationId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...va/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperFallbackImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.appsmith.server.helpers.ce.autocommit; | ||
|
||
import com.appsmith.server.domains.GitArtifactMetadata; | ||
import com.appsmith.server.dtos.PageDTO; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
import reactor.core.publisher.Mono; | ||
|
||
import static java.lang.Boolean.FALSE; | ||
|
||
@Slf4j | ||
@Component | ||
public class AutoCommitEligibilityHelperFallbackImpl implements AutoCommitEligibilityHelper { | ||
|
||
@Override | ||
public Mono<Boolean> isServerAutoCommitRequired(String workspaceId, GitArtifactMetadata gitMetadata) { | ||
return Mono.just(FALSE); | ||
} | ||
|
||
@Override | ||
public Mono<Boolean> isClientMigrationRequired(PageDTO pageDTO) { | ||
return Mono.just(FALSE); | ||
} | ||
|
||
@Override | ||
public Mono<AutoCommitTriggerDTO> isAutoCommitRequired( | ||
String workspaceId, GitArtifactMetadata gitArtifactMetadata, PageDTO pageDTO) { | ||
return Mono.just(new AutoCommitTriggerDTO(FALSE, FALSE, FALSE)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitTriggerDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.