Skip to content
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions apps/dokploy/__test__/env/compose-env-upsert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,29 @@ describe("deployCompose exact revision guard", () => {
expect(dbMocks.set).toHaveBeenCalledWith({ composeStatus: "error" });
});

it("fetches the exact revision inside the authenticated clone command", async () => {
await expect(
deployCompose({
composeId: "compose_1",
titleLog: "Exact deployment",
descriptionLog: "",
operationId: "operation-1",
expectedRevision: requestedRevision,
}),
).rejects.toMatchObject({ code: "CONFLICT" });

expect(exactMocks.cloneGitRepository).toHaveBeenCalledWith(
expect.objectContaining({ checkoutRevision: requestedRevision }),
);
const [, verifyCommand] = exactMocks.execAsync.mock.calls.map(([command]) =>
String(command),
);
// The stored remote carries no credentials, so a separate fetch would
// fail for private repositories.
expect(verifyCommand).not.toContain("fetch");
expect(verifyCommand).toContain("rev-parse");
});

it("keeps successful deployment state when terminal finalization is ambiguous", async () => {
vi.clearAllMocks();
exactMocks.execAsync.mockReset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ describe("Git provider clone command boundary", () => {
});

it("quotes GitHub clone metadata", async () => {
const expectedCloneUrl = `https://oauth2:${fixtures.githubToken}@github.com/${fixtures.githubOwner}/${fixtures.githubRepository}.git`;
const expectedCloneUrl = `https://github.com/${fixtures.githubOwner}/${fixtures.githubRepository}.git`;
const command = await cloneGithubRepository({
appName: "app",
branch: fixtures.branch,
Expand All @@ -284,7 +284,7 @@ describe("Git provider clone command boundary", () => {

it("quotes GitLab clone metadata", async () => {
const repoClone = `${fixtures.gitlabBaseUrl.replace(/^https?:\/\//, "")}/${fixtures.gitlabNamespace}.git`;
const expectedCloneUrl = `https://oauth2:${fixtures.gitlabToken}@${repoClone}`;
const expectedCloneUrl = `https://${repoClone}`;
const command = await cloneGitlabRepository({
appName: "app",
enableSubmodules: false,
Expand All @@ -306,7 +306,7 @@ describe("Git provider clone command boundary", () => {

it("quotes Bitbucket clone metadata", async () => {
const repoClone = `bitbucket.org/${fixtures.bitbucketOwner}/${fixtures.bitbucketRepository}.git`;
const expectedCloneUrl = `https://x-bitbucket-api-token-auth:${fixtures.bitbucketToken}@${repoClone}`;
const expectedCloneUrl = `https://${repoClone}`;
const command = await cloneBitbucketRepository({
appName: "app",
bitbucketBranch: fixtures.branch,
Expand Down Expand Up @@ -567,7 +567,7 @@ describe("Git provider clone command boundary", () => {

it("quotes Gitea clone metadata", async () => {
const baseUrl = fixtures.giteaBaseUrl.replace(/^https?:\/\//, "");
const expectedCloneUrl = `https://oauth2:${fixtures.giteaToken}@${baseUrl}/${fixtures.giteaOwner}/${fixtures.giteaRepository}.git`;
const expectedCloneUrl = `https://${baseUrl}/${fixtures.giteaOwner}/${fixtures.giteaRepository}.git`;
const command = await cloneGiteaRepository({
appName: "app",
enableSubmodules: false,
Expand Down
Loading
Loading