Skip to content

Commit

Permalink
fix: Unexpected error message No IDE URL after 20 sec during workspac…
Browse files Browse the repository at this point in the history
…e startup (#1207)

* fix: StartingStepOpenWorkspace render

Signed-off-by: Oleksii Orel <oorel@redhat.com>

* fixup! fix: StartingStepOpenWorkspace render

Signed-off-by: Oleksii Orel <oorel@redhat.com>

---------

Signed-off-by: Oleksii Orel <oorel@redhat.com>
  • Loading branch information
olexii4 committed Oct 1, 2024
1 parent b512ab1 commit 0442b35
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,29 @@ describe('Starting steps, opening an editor', () => {
.build();
});

test('should not show notification alert if STARTING', async () => {
store = new FakeStoreBuilder()
.withDevWorkspaces({
workspaces: [
new DevWorkspaceBuilder()
.withName(workspaceName)
.withNamespace(namespace)
.withStatus({ phase: 'STARTING' })
.build(),
],
})
.build();
renderComponent(store);
jest.runAllTimers();

// trigger timeout
const timeoutButton = screen.queryByRole('button', {
name: 'onTimeout',
});
expect(timeoutButton).toBeNull();
expect(mockOnError).not.toHaveBeenCalled();
});

test('notification alert', async () => {
renderComponent(store);
jest.runAllTimers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ class StartingStepOpenWorkspace extends ProgressStep<Props, State> {
const { distance, hasChildren } = this.props;
const { name, lastError } = this.state;

const isActive = distance === 0;
// status may flicker from starting to running and back to starting
// but we need to run the timer only when the workspace is running
const workspace = this.findTargetWorkspace(this.props);
const isActive = workspace?.isRunning && distance === 0;

const isError = false;
const isWarning = lastError !== undefined;

Expand Down

0 comments on commit 0442b35

Please sign in to comment.