Skip to content

Conversation

evrii
Copy link
Collaborator

@evrii evrii commented Mar 27, 2023

Description:


PR checklist

  • This PR meets the Acceptance Criteria in the JIRA story
  • The JIRA story has been moved to Dev Review
  • This PR includes appropriate unit tests
  • I have added explanatory comments where the logic is not obvious
  • I have run and tested this change locally, and my testing process is described here
  • If this includes a new feature flag, I have created and linked new JIRA tickets to (a) turn on the feature flag and (b) remove it later
  • If this includes an API change, I have run the E2E tests on this change against my local server with yarn test-local because this PR won't be covered by the CircleCI tests
  • If this includes a UI change, I have taken screen recordings or screenshots of the new behavior and notified the PO and UX designer in Slack
  • If this change impacts deployment safety (e.g. removing/altering APIs which are in use) I have documented these in the description
  • If this includes an API change, I have updated the appropriate Swagger definitions and updated the appropriate API consumers

@evrii evrii changed the title Eric/rw 9608 [RW-9608][risk=no] Added polling for app status Mar 27, 2023
});
});

// these tests assume that there are no User GKE Apps
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are indirectly testing the getAppsByDisplayGroup functionality, and are therefore unnecessary. Since these tests also rely on store values, parallel tests make them impractical to test effectively.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done.

@evrii evrii marked this pull request as ready for review April 3, 2023 19:28
const { runtime } = useStore(runtimeStore);
const { config } = useStore(serverConfigStore);
// all GKE apps (not Jupyter)
const { userApps } = useStore(userAppsStore);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have an ontology here? For example, Set(allUserApps) = Set(gkeUserApps) + Set(nonGkeUserApps)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the terms "user apps" and "GKE apps" are equivalent. Jupyter uses (GCE or DataProc) "runtimes" instead of (GKE) "user apps"

User Environments is the set of both (user apps + runtimes)

},
};

describe('User Apps Helper functions', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like these. I get a sense as to how the utilities work.

Comment on lines 45 to 51
export const createUserApp = (namespace, config: CreateAppRequest) => {
return appsApi()
.createApp(namespace, config)
.then(() => {
maybeStartPollingForUserApps(namespace);
});
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love how clean and clear these are. I prefer the syntax that omits the block whenever I don't need it because it calls to attention the cases where I do need it.

Suggested change
export const createUserApp = (namespace, config: CreateAppRequest) => {
return appsApi()
.createApp(namespace, config)
.then(() => {
maybeStartPollingForUserApps(namespace);
});
};
export const createUserApp = (namespace, config: CreateAppRequest) =>
appsApi()
.createApp(namespace, config)
.then(() => maybeStartPollingForUserApps(namespace));

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the look of this too. Thanks for pointing it out.

});
});

// these tests assume that there are no User GKE Apps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done.

@evrii evrii merged commit fe29489 into main Apr 4, 2023
@evrii evrii deleted the eric/RW-9608 branch April 4, 2023 13:17
expect(findAvailableApps(wrapper, false).exists()).toBeFalsy();
});

it('should pause a running RStudio app', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not like the "getAppsByDisplayGroup" tests above - are there equivalents for these tests elsewhere? @evrii

.listAppsInWorkspace(namespace)
.then((listAppsResponse) => {
userAppsStore.set({ userApps: listAppsResponse, updating: false });
if (doUserAppsRequireUpdates()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this polling is easy to understand

});
};

export const createUserApp = (namespace, config: CreateAppRequest) =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like these too

}

export interface UserAppsStore {
updating?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these be non-optional? we should always have these values if the store is populated, right?

);
await userAppsUtils.maybeStartPollingForUserApps('fakeNameSpace');

jest.advanceTimersByTime(20e3);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit/thinking out loud ... would be nice to have a const to compare this against. Something like "appPollingInterval + 1e3" to show that it's clearly longer than that interval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants