-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance status checking in with notebooks deployed in internal regist…
…ries
- Loading branch information
1 parent
28efbe4
commit 09aab22
Showing
4 changed files
with
116 additions
and
70 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
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
35 changes: 35 additions & 0 deletions
35
frontend/src/pages/projects/screens/detail/notebooks/__tests__/useNotebookImageData.spec.ts
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,35 @@ | ||
import { mockNotebookK8sResource } from '~/__mocks__'; | ||
import { mockImageStreamK8sResource } from '~/__mocks__/mockImageStreamK8sResource'; | ||
import { getNotebookImageData } from '~/pages/projects/screens/detail/notebooks/useNotebookImageData'; | ||
import { NotebookImageAvailability } from '~/pages/projects/screens/detail/notebooks/const'; | ||
|
||
describe('getNotebookImageData', () => { | ||
it('should return image data when image stream exists and image version exists', () => { | ||
const notebook = mockNotebookK8sResource({ | ||
image: | ||
'quay.io/opendatahub/notebooks@sha256:a138838e1c9acd7708462e420bf939e03296b97e9cf6c0aa0fd9a5d20361ab75', | ||
}); | ||
const images = [ | ||
mockImageStreamK8sResource({ | ||
imageTag: | ||
'quay.io/opendatahub/notebooks@sha256:a138838e1c9acd7708462e420bf939e03296b97e9cf6c0aa0fd9a5d20361ab75', | ||
}), | ||
]; | ||
const result = getNotebookImageData(notebook, images); | ||
expect(result?.imageAvailability).toBe(NotebookImageAvailability.ENABLED); | ||
}); | ||
|
||
it('should return image data when image stream exists and image version does not exist', () => { | ||
const notebook = mockNotebookK8sResource({ | ||
image: | ||
'quay.io/opendatahub/notebooks@sha256:a138838e1c9acd7708462e420bf939e03296b97e9cf6c0aa0fd9a5d20361ab75', | ||
}); | ||
const images = [ | ||
mockImageStreamK8sResource({ | ||
imageTag: 'quay.io/opendatahub/notebooks@sha256:invalid', | ||
}), | ||
]; | ||
const result = getNotebookImageData(notebook, images); | ||
expect(result?.imageAvailability).toBe(NotebookImageAvailability.DELETED); | ||
}); | ||
}); |
134 changes: 69 additions & 65 deletions
134
frontend/src/pages/projects/screens/detail/notebooks/useNotebookImageData.ts
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