The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Show the remote sync test connection result inline like the database form (#83794)
Alexander Polyankin30a93b01b936
diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitSettingsSection.tsx b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitSettingsSection.tsxindex d9c238aa19f..aa54af65078 100644--- a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitSettingsSection.tsx+++ b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitSettingsSection.tsx@@ -9,8 +9,8 @@ import { TOKEN_KEY, URL_KEY } from "../../constants";import type { RemoteSyncSettingsFormState } from "../../types";import { getEnvSettingProps } from "../../utils";+import { GitTestConnectionButton } from "./GitTestConnectionButton";import { RemoteSyncSettingsSection } from "./RemoteSyncSettingsSection";-import { TestConnectionButton } from "./TestConnectionButton";export const GitSettingsSection = () => {const { values } = useFormikContext<RemoteSyncSettingsFormState>();@@ -39,7 +39,10 @@ export const GitSettingsSection = () => {})}/><Box>- <TestConnectionButton values={values} />+ <GitTestConnectionButton+ url={values[URL_KEY]}+ token={values[TOKEN_KEY]}+ /></Box></RemoteSyncSettingsSection>);diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitTestConnectionButton.tsx b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitTestConnectionButton.tsxnew file mode 100644index 00000000000..9406bb2836f--- /dev/null+++ b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitTestConnectionButton.tsx@@ -0,0 +1,56 @@+import { t } from "ttag";+import _ from "underscore";++import { getErrorMessage } from "metabase/api/utils";+import {+ TestConnectionButton,+ type TestConnectionResult,+} from "metabase/common/components/TestConnectionButton";+import { useTestRemoteSyncConnectionMutation } from "metabase-enterprise/api/remote-sync";+import type { TestRemoteSyncConnectionRequest } from "metabase-types/api";++import { TOKEN_KEY, URL_KEY } from "../../constants";++const getTestResult = (+ isSuccess: boolean,+ error: unknown,+): TestConnectionResult | null => {+ if (error != null) {+ return {+ status: "error",+ message: getErrorMessage(error, t`Could not connect to repository`),+ };+ }++ return isSuccess ? { status: "success" } : null;+};++interface GitTestConnectionButtonProps {+ url: string | null | undefined;+ token: string | null | undefined;+}++export const GitTestConnectionButton = ({+ url,+ token,+}: GitTestConnectionButtonProps) => {+ const [testConnection, { isSuccess, error, isLoading, originalArgs }] =+ useTestRemoteSyncConnectionMutation();+ const request: TestRemoteSyncConnectionRequest = {+ [URL_KEY]: url,+ [TOKEN_KEY]: token,+ };+ const result = _.isEqual(originalArgs, request)+ ? getTestResult(isSuccess, error)+ : null;++ return (+ <TestConnectionButton+ data-testid="remote-sync-test-connection-button"+ result={result}+ isLoading={isLoading}+ disabled={!url}+ onClick={() => testConnection(request)}+ />+ );+};diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitTestConnectionButton.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitTestConnectionButton.unit.spec.tsxnew file mode 100644index 00000000000..30f956436ac--- /dev/null+++ b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/GitTestConnectionButton.unit.spec.tsx@@ -0,0 +1,70 @@+import userEvent from "@testing-library/user-event";++import { setupRemoteSyncTestConnectionEndpoint } from "__support__/server-mocks";+import { renderWithProviders, screen } from "__support__/ui";++import { GitTestConnectionButton } from "./GitTestConnectionButton";++const URL = "https://github.com/test/repo.git";+const TOKEN = "ghp_abc123";++const setup = ({+ error,+}: {+ error?: { status: number; message: string };+} = {}) => {+ setupRemoteSyncTestConnectionEndpoint({ error });+ const { rerender } = renderWithProviders(+ <GitTestConnectionButton url={URL} token={TOKEN} />,+ );+ return {+ rerender: ({+ url = URL,+ token = TOKEN,+ }: {+ url?: string;+ token?: string;+ }) => rerender(<GitTestConnectionButton url={url} token={token} />),+ };+};++const clickTestConnection = () =>+ userEvent.click(screen.getByRole("button", { name: /Test connection/i }));++describe("GitTestConnectionButton", () => {+ it("should show the success icon when the connection succeeds", async () => {+ setup();+ await clickTestConnection();+ expect(+ await screen.findByLabelText("Connection successful"),+ ).toBeInTheDocument();+ });++ it("should show the server error in the failure icon's tooltip", async () => {+ setup({+ error: { status: 400, message: "Authentication failed" },+ });+ await clickTestConnection();++ await userEvent.hover(await screen.findByLabelText("Connection failed"));+ expect(await screen.findByRole("tooltip")).toHaveTextContent(+ "Authentication failed",+ );+ });++ it.each([+ { name: "URL", change: { url: "https://github.com/x/y.git" } },+ { name: "token", change: { token: "ghp_other" } },+ ])("should clear the result when the $name changes", async ({ change }) => {+ const { rerender } = setup();+ await clickTestConnection();+ expect(+ await screen.findByLabelText("Connection successful"),+ ).toBeInTheDocument();++ rerender(change);+ expect(+ screen.queryByLabelText("Connection successful"),+ ).not.toBeInTheDocument();+ });+});diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/RemoteSyncSettingsForm.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/RemoteSyncSettingsForm.unit.spec.tsxindex 3e0b560ae87..678144cf8a9 100644--- a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/RemoteSyncSettingsForm.unit.spec.tsx+++ b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/RemoteSyncSettingsForm.unit.spec.tsx@@ -584,7 +584,7 @@ describe("RemoteSyncSettingsForm", () => {});});- it("should still call the endpoint when the connection fails so the user gets feedback", async () => {+ it("should show the connection error in the failure icon's tooltip", async () => {setup({remoteSyncType: "read-only",remoteSyncUrl: "https://github.com/test/repo.git",@@ -610,11 +610,10 @@ describe("RemoteSyncSettingsForm", () => {expect(testRequest).toBeDefined();});- // Failures must not crash the form — the button stays enabled afterward- // and the URL field keeps its value.- expect(- screen.getByRole("button", { name: /Test connection/i }),- ).toBeEnabled();+ await userEvent.hover(await screen.findByLabelText("Connection failed"));+ expect(await screen.findByRole("tooltip")).toHaveTextContent(+ "Authentication failed: Please check your git credentials",+ );expect(screen.getByLabelText(/Repository URL/i)).toHaveValue("https://github.com/test/repo.git",);diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/TestConnectionButton.tsx b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/TestConnectionButton.tsxdeleted file mode 100644index 58af4a1a95c..00000000000--- a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/RemoteSyncAdminSettings/TestConnectionButton.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { useCallback } from "react";-import { t } from "ttag";--import { getErrorMessage } from "metabase/api/utils";-import { useToast } from "metabase/common/hooks";-import { Button } from "metabase/ui";-import { useTestRemoteSyncConnectionMutation } from "metabase-enterprise/api/remote-sync";-import type {- RemoteSyncConfigurationSettings,- TestRemoteSyncConnectionRequest,-} from "metabase-types/api";--import { TOKEN_KEY, URL_KEY } from "../../constants";--interface TestConnectionButtonProps {- values: RemoteSyncConfigurationSettings;-}--export const TestConnectionButton = ({ values }: TestConnectionButtonProps) => {- const [testConnection, { isLoading }] = useTestRemoteSyncConnectionMutation();- const [sendToast] = useToast();-- const handleTestConnection = useCallback(async () => {- const body: TestRemoteSyncConnectionRequest = {- [URL_KEY]: values[URL_KEY],- [TOKEN_KEY]: values[TOKEN_KEY],- };-- try {- await testConnection(body).unwrap();- sendToast({- message: t`Connected to remote sync repository`,- icon: "check",- });- } catch (error) {- sendToast({- message: getErrorMessage(error, t`Could not connect to repository`),- icon: "warning",- });- }- }, [testConnection, values, sendToast]);-- return (- <Button- data-testid="remote-sync-test-connection-button"- disabled={isLoading || !values[URL_KEY]}- loading={isLoading}- onClick={handleTestConnection}- >- {t`Test connection`}- </Button>- );-};diff --git a/frontend/src/metabase/common/components/TestConnectionButton/TestConnectionButton.tsx b/frontend/src/metabase/common/components/TestConnectionButton/TestConnectionButton.tsxnew file mode 100644index 00000000000..bbe46d06650--- /dev/null+++ b/frontend/src/metabase/common/components/TestConnectionButton/TestConnectionButton.tsx@@ -0,0 +1,75 @@+import { match } from "ts-pattern";+import { t } from "ttag";++import { useDebouncedValue } from "metabase/common/hooks/use-debounced-value";+import { Button, Icon, Tooltip } from "metabase/ui";++const LOADING_INDICATOR_DELAY_MS = 300;++const isLoadingStarting = (_lastValue: boolean, newValue: boolean) => newValue;++export type TestConnectionResult =+ | { status: "success" }+ | { status: "error"; message: string };++const TestResultIcon = ({ result }: { result: TestConnectionResult }) =>+ match(result)+ .with({ status: "success" }, () => (+ <Icon+ name="check_filled"+ c="feedback-positive"+ aria-label={t`Connection successful`}+ />+ ))+ .with({ status: "error" }, ({ message }) => (+ <Tooltip label={message} multiline maw="20rem">+ <Icon+ name="warning_round_filled"+ c="feedback-negative"+ aria-label={t`Connection failed`}+ />+ </Tooltip>+ ))+ .exhaustive();++interface TestConnectionButtonProps {+ result: TestConnectionResult | null;+ isLoading: boolean;+ disabled?: boolean;+ "data-testid"?: string;+ onClick: () => void;+}++/** Renders a "Test connection" button with a delayed loader and the `result` icon. */+export const TestConnectionButton = ({+ result,+ isLoading,+ disabled,+ "data-testid": dataTestId,+ onClick,+}: TestConnectionButtonProps) => {+ const showLoading = useDebouncedValue(+ isLoading,+ LOADING_INDICATOR_DELAY_MS,+ isLoadingStarting,+ );++ const handleClick = () => {+ // the button stays clickable until the delayed loader appears+ if (!isLoading) {+ onClick();+ }+ };++ return (+ <Button+ data-testid={dataTestId}+ disabled={disabled}+ loading={showLoading}+ rightSection={result && <TestResultIcon result={result} />}+ onClick={handleClick}+ >+ {t`Test connection`}+ </Button>+ );+};diff --git a/frontend/src/metabase/common/components/TestConnectionButton/TestConnectionButton.unit.spec.tsx b/frontend/src/metabase/common/components/TestConnectionButton/TestConnectionButton.unit.spec.tsxnew file mode 100644index 00000000000..2fdb9b2c9b4--- /dev/null+++ b/frontend/src/metabase/common/components/TestConnectionButton/TestConnectionButton.unit.spec.tsx@@ -0,0 +1,90 @@+import userEvent from "@testing-library/user-event";++import { render, screen, waitFor } from "__support__/ui";++import {+ TestConnectionButton,+ type TestConnectionResult,+} from "./TestConnectionButton";++const setup = ({+ result = null,+ disabled = false,+}: {+ result?: TestConnectionResult | null;+ disabled?: boolean;+} = {}) => {+ const onClick = jest.fn();+ const renderButton = (isLoading: boolean) => (+ <TestConnectionButton+ result={result}+ isLoading={isLoading}+ disabled={disabled}+ onClick={onClick}+ />+ );+ const { rerender } = render(renderButton(false));+ return {+ onClick,+ setLoading: (isLoading: boolean) => rerender(renderButton(isLoading)),+ };+};++const getButton = () =>+ screen.getByRole("button", { name: /Test connection/i });++describe("TestConnectionButton", () => {+ it("should call onClick when clicked", async () => {+ const { onClick } = setup();+ await userEvent.click(getButton());+ expect(onClick).toHaveBeenCalledTimes(1);+ });++ it("should be disabled when disabled is set", () => {+ setup({ disabled: true });+ expect(getButton()).toBeDisabled();+ });++ it("should ignore clicks and delay the loader while loading", async () => {+ const { onClick, setLoading } = setup();+ setLoading(true);++ expect(getButton()).not.toHaveAttribute("data-loading");+ await userEvent.click(getButton());+ expect(onClick).not.toHaveBeenCalled();++ await waitFor(() =>+ expect(getButton()).toHaveAttribute("data-loading", "true"),+ );+ });++ it("should show no result icon without a result", () => {+ setup();+ expect(+ screen.queryByLabelText("Connection successful"),+ ).not.toBeInTheDocument();+ expect(+ screen.queryByLabelText("Connection failed"),+ ).not.toBeInTheDocument();+ });++ it("should show the success icon for a successful result", () => {+ setup({ result: { status: "success" } });+ expect(screen.getByLabelText("Connection successful")).toBeInTheDocument();+ expect(+ screen.queryByLabelText("Connection failed"),+ ).not.toBeInTheDocument();+ });++ it("should show the error message in the failure icon's tooltip", async () => {+ setup({ result: { status: "error", message: "Wrong password" } });+ expect(+ screen.queryByLabelText("Connection successful"),+ ).not.toBeInTheDocument();++ await userEvent.hover(screen.getByLabelText("Connection failed"));+ expect(await screen.findByRole("tooltip")).toHaveTextContent(+ "Wrong password",+ );+ });+});diff --git a/frontend/src/metabase/common/components/TestConnectionButton/index.ts b/frontend/src/metabase/common/components/TestConnectionButton/index.tsnew file mode 100644index 00000000000..03d2c0fddc8--- /dev/null+++ b/frontend/src/metabase/common/components/TestConnectionButton/index.ts@@ -0,0 +1 @@+export * from "./TestConnectionButton";diff --git a/frontend/src/metabase/databases/components/DatabaseForm/DatabaseTestConnectionButton.tsx b/frontend/src/metabase/databases/components/DatabaseForm/DatabaseTestConnectionButton.tsxindex bf82b129905..0df65e4b241 100644--- a/frontend/src/metabase/databases/components/DatabaseForm/DatabaseTestConnectionButton.tsx+++ b/frontend/src/metabase/databases/components/DatabaseForm/DatabaseTestConnectionButton.tsx@@ -1,26 +1,25 @@import { type FormikErrors, useFormikContext } from "formik";-import { useState } from "react";-import { match } from "ts-pattern";+import { useMemo } from "react";import { t } from "ttag";+import _ from "underscore";import { useListEnginesQuery, useValidateDatabaseMutation } from "metabase/api";import { getErrorMessage } from "metabase/api/utils";-import { useDebouncedValue } from "metabase/common/hooks/use-debounced-value";-import { Button, Icon, Tooltip } from "metabase/ui";-import type { DatabaseData } from "metabase-types/api";+import {+ TestConnectionButton,+ type TestConnectionResult,+} from "metabase/common/components/TestConnectionButton";+import type {+ DatabaseData,+ Engine,+ ValidateDatabaseRequest,+ ValidateDatabaseResponse,+} from "metabase-types/api";import { getSubmitValues } from "../../utils/schema";import { getEngine } from "./utils";-const LOADING_INDICATOR_DELAY_MS = 300;--const isLoadingStarting = (_lastValue: boolean, newValue: boolean) => newValue;--type TestResult =- | { status: "success"; valuesAtTest: DatabaseData }- | { status: "error"; valuesAtTest: DatabaseData; message: string };-/** Formik types this as a string, but per-field errors arrive as an object keyed by field name */const getDetailErrorPaths = (details: unknown): string[] => {if (typeof details === "object" && details !== null) {@@ -38,47 +37,69 @@ const getConnectionErrorPaths = ({...getDetailErrorPaths(details),];-const TestResultIcon = ({ result }: { result: TestResult }) =>- match(result)- .with({ status: "success" }, () => (- <Icon- name="check_filled"- c="feedback-positive"- aria-label={t`Connection successful`}- />- ))- .with({ status: "error" }, ({ message }) => (- <Tooltip label={message} multiline maw="20rem">- <Icon- name="warning_round_filled"- c="feedback-negative"- aria-label={t`Connection failed`}- />- </Tooltip>- ))- .exhaustive();+const getValidateRequest = (+ engines: Record<string, Engine>,+ values: DatabaseData,+): ValidateDatabaseRequest | null => {+ const engineKey = values.engine;+ if (engineKey == null) {+ return null;+ }++ const submitValues = getSubmitValues(+ getEngine(engines, engineKey),+ values,+ true,+ );++ return {+ details: {+ engine: engineKey,+ details: submitValues.details ?? {},+ // lets the backend resolve details we sent back redacted+ ...(values.id != null && { id: values.id }),+ },+ };+};++const getTestResult = (+ data: ValidateDatabaseResponse | undefined,+ error: unknown,+): TestConnectionResult | null => {+ if (error != null) {+ return {+ status: "error",+ message: getErrorMessage(error, t`Couldn't connect to the database`),+ };+ }++ if (data == null) {+ return null;+ }++ return data.valid+ ? { status: "success" }+ : {+ status: "error",+ message: data.message ?? t`Couldn't connect to the database`,+ };+};export const DatabaseTestConnectionButton = () => {const { values, validateForm, setFieldError, setFieldTouched } =useFormikContext<DatabaseData>();const { data: engines = {} } = useListEnginesQuery();- const [validateDatabase, { isLoading }] = useValidateDatabaseMutation();- const showLoading = useDebouncedValue(- isLoading,- LOADING_INDICATOR_DELAY_MS,- isLoadingStarting,+ const [validateDatabase, { data, error, isLoading, originalArgs }] =+ useValidateDatabaseMutation();+ const request = useMemo(+ () => getValidateRequest(engines, values),+ [engines, values],);- const [lastResult, setLastResult] = useState<TestResult | null>(null);-- // Formik replaces `values` on every edit, so a new reference means the result is stale- const result = lastResult?.valuesAtTest === values ? lastResult : null;+ const result = _.isEqual(originalArgs, request)+ ? getTestResult(data, error)+ : null;const handleTestConnection = async () => {- // the button stays clickable until the delayed loader appears- if (isLoading) {- return;- }-const invalidPaths = getConnectionErrorPaths(await validateForm());if (invalidPaths.length > 0) {@@ -86,60 +107,24 @@ export const DatabaseTestConnectionButton = () => {return;}- const engineKey = values.engine;- if (engineKey == null) {+ if (request == null) {return;}- const submitValues = getSubmitValues(- getEngine(engines, engineKey),- values,- true,- );-- try {- const response = await validateDatabase({- details: {- engine: engineKey,- details: submitValues.details ?? {},- // lets the backend resolve details we sent back redacted- ...(values.id != null && { id: values.id }),- },- }).unwrap();-- if (response.valid) {- setLastResult({ status: "success", valuesAtTest: values });- return;- }-- Object.entries(response.errors ?? {}).forEach(([name, message]) => {- setFieldTouched(`details.${name}`, true, false);- setFieldError(`details.${name}`, message);- });-- setLastResult({- status: "error",- valuesAtTest: values,- message: response.message ?? t`Couldn't connect to the database`,- });- } catch (error) {- setLastResult({- status: "error",- valuesAtTest: values,- message: getErrorMessage(error, t`Couldn't connect to the database`),- });- }+ const { data: response } = await validateDatabase(request);+ Object.entries(response?.errors ?? {}).forEach(([name, message]) => {+ setFieldTouched(`details.${name}`, true, false);+ setFieldError(`details.${name}`, message);+ });};return (- <Button+ <TestConnectionButtondata-testid="database-test-connection-button"+ result={result}+ isLoading={isLoading}disabled={values.engine == null}- loading={showLoading}- rightSection={result && <TestResultIcon result={result} />}onClick={handleTestConnection}- >- {t`Test connection`}- </Button>+ />);};diff --git a/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsx b/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsxindex d17d91eddc4..647b685bce6 100644--- a/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsx+++ b/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsx@@ -77,7 +77,7 @@ describe("DatabaseForm > test connection", () => {expect(request.body.details.id).toBe(id);});- it("should show the result until the form is edited, including while re-testing", async () => {+ it("should show the result until the form is edited or re-tested", async () => {await setupTestConnection({initialValues: POSTGRES_VALUES,validateDelayMs: 200,@@ -89,11 +89,13 @@ describe("DatabaseForm > test connection", () => {).toBeInTheDocument();await clickTestConnection();- expect(screen.getByLabelText("Connection successful")).toBeInTheDocument();- await waitFor(async () => {- expect(await findValidateRequests()).toHaveLength(2);- });- expect(screen.getByLabelText("Connection successful")).toBeInTheDocument();+ expect(+ screen.queryByLabelText("Connection successful"),+ ).not.toBeInTheDocument();+ expect(+ await screen.findByLabelText("Connection successful"),+ ).toBeInTheDocument();+ expect(await findValidateRequests()).toHaveLength(2);await userEvent.type(screen.getByLabelText("Host"), "x");expect(diff --git a/frontend/test/__support__/server-mocks/remote-sync.ts b/frontend/test/__support__/server-mocks/remote-sync.tsindex 19f658c0d37..48451f6c3d7 100644--- a/frontend/test/__support__/server-mocks/remote-sync.ts+++ b/frontend/test/__support__/server-mocks/remote-sync.ts@@ -37,17 +37,13 @@ export const setupRemoteSyncBranchesEndpoint = (};/**- * Setup the remote-sync current-task endpoint+ * Setup the remote-sync current-task endpoint with no current task*/-const setupRemoteSyncCurrentTaskEndpoint = (- status: "idle" | "running" | "completed" = "idle",-) => {+const setupRemoteSyncCurrentTaskEndpoint = () => {fetchMock.removeRoute("remote-sync-current-task");- fetchMock.get(- "path:/api/ee/remote-sync/current-task",- { status },- { name: "remote-sync-current-task" },- );+ fetchMock.get("path:/api/ee/remote-sync/current-task", 204, {+ name: "remote-sync-current-task",+ });};export interface RemoteSyncSettingsResponse {@@ -177,7 +173,7 @@ export const setupRemoteSyncTestConnectionEndpoint = ({} else {fetchMock.post("path:/api/ee/remote-sync/test-connection",- { status: "success" },+ { body: { status: "success" } },{ name: "remote-sync-test-connection" },);}@@ -211,7 +207,7 @@ export const setupRemoteSyncEndpoints = ({} = {}) => {setupRemoteSyncBranchesEndpoint(branches);setupRemoteSyncDirtyEndpoint({ dirty, changedCollections });- setupRemoteSyncCurrentTaskEndpoint("idle");+ setupRemoteSyncCurrentTaskEndpoint();setupRemoteSyncImportEndpoint();setupRemoteSyncExportEndpoint();setupRemoteSyncExportPreflightEndpoint(exportPreflight);