-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend the ssh url check with the ssh://[<user>@]<host>[:<port>]/~<us…
…er>/<path-to-git-repo> format (#1268) see https://git-scm.com/docs/git-clone#_git_urls
- Loading branch information
Showing
2 changed files
with
44 additions
and
28 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -694,6 +694,32 @@ describe('Creating steps, fetching a devfile', () => { | |
const host = 'che-host'; | ||
const protocol = 'http://'; | ||
const factoryUrl = '[email protected]:user/repository-name.git'; | ||
const emptyStore = new MockStoreBuilder().build(); | ||
const sshPrivateRepoAllertItem = expect.objectContaining({ | ||
title: 'Warning', | ||
variant: AlertVariant.warning, | ||
children: ( | ||
<ExpandableWarning | ||
textBefore="Devfile resolve from a privatre repositry via an SSH url is not supported." | ||
errorMessage="Could not reach devfile" | ||
textAfter="Apply a Personal Access Token to fetch the devfile.yaml content." | ||
/> | ||
), | ||
actionCallbacks: [ | ||
expect.objectContaining({ | ||
title: 'Continue with default devfile', | ||
callback: expect.any(Function), | ||
}), | ||
expect.objectContaining({ | ||
title: 'Reload', | ||
callback: expect.any(Function), | ||
}), | ||
expect.objectContaining({ | ||
title: 'Open Documentation page', | ||
callback: expect.any(Function), | ||
}), | ||
], | ||
}); | ||
|
||
let spyWindowLocation: jest.SpyInstance; | ||
let location: Location; | ||
|
@@ -746,43 +772,31 @@ describe('Creating steps, fetching a devfile', () => { | |
}); | ||
|
||
it('should show warning on SSH url', async () => { | ||
const expectAlertItem = expect.objectContaining({ | ||
title: 'Warning', | ||
variant: AlertVariant.warning, | ||
children: ( | ||
<ExpandableWarning | ||
textBefore="Devfile resolve from a privatre repositry via an SSH url is not supported." | ||
errorMessage="Could not reach devfile" | ||
textAfter="Apply a Personal Access Token to fetch the devfile.yaml content." | ||
/> | ||
), | ||
actionCallbacks: [ | ||
expect.objectContaining({ | ||
title: 'Continue with default devfile', | ||
callback: expect.any(Function), | ||
}), | ||
expect.objectContaining({ | ||
title: 'Reload', | ||
callback: expect.any(Function), | ||
}), | ||
expect.objectContaining({ | ||
title: 'Open Documentation page', | ||
callback: expect.any(Function), | ||
}), | ||
], | ||
}); | ||
searchParams = new URLSearchParams({ | ||
[FACTORY_URL_ATTR]: '[email protected]:user/repository.git', | ||
}); | ||
const emptyStore = new MockStoreBuilder().build(); | ||
|
||
renderComponent(emptyStore, searchParams, location); | ||
|
||
await jest.advanceTimersByTimeAsync(MIN_STEP_DURATION_MS); | ||
await waitFor(() => expect(mockOnNextStep).not.toHaveBeenCalled); | ||
|
||
expect(mockOpenOAuthPage).not.toHaveBeenCalled(); | ||
expect(mockOnError).toHaveBeenCalledWith(sshPrivateRepoAllertItem); | ||
}); | ||
|
||
it('should show warning on bitbucket-server SSH url', async () => { | ||
searchParams = new URLSearchParams({ | ||
[FACTORY_URL_ATTR]: 'ssh://[email protected]/~user/repository.git', | ||
}); | ||
|
||
renderComponent(emptyStore, searchParams, location); | ||
|
||
await jest.advanceTimersByTimeAsync(MIN_STEP_DURATION_MS); | ||
await waitFor(() => expect(mockOnNextStep).not.toHaveBeenCalled); | ||
|
||
expect(mockOpenOAuthPage).not.toHaveBeenCalled(); | ||
expect(mockOnError).toHaveBeenCalledWith(expectAlertItem); | ||
expect(mockOnError).toHaveBeenCalledWith(sshPrivateRepoAllertItem); | ||
}); | ||
}); | ||
}); | ||
|
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