-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server): improved subscription testing DX + tests for common subs + new subs #3554
Conversation
q.leftJoin(UserEmails.name, UserEmails.col.userId, Users.col.id).where({ | ||
[UserEmails.col.primary]: true | ||
q.leftJoin(UserEmails.name, (j1) => { | ||
j1.on(UserEmails.col.userId, Users.col.id).andOnVal(UserEmails.col.primary, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was causing getUser(s) to return null, even if the user was there, because user_emails is not synced to the region db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we querying users from the region db?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gjedlicska test prep. even outside of that, the query is invalid - it should not filter out users just because they dont have a UserEmails entry
edit: i suppose in theory you could also want to omit users w/o user_emails, but I still believe that in practice in shouldn't
) => { | ||
const { db } = deps | ||
const { owner, stream } = options || {} | ||
export async function createTestCommits( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes more sense for these to autoresolve the projectdb, instead of test writers having to do that manually beforehand
}) | ||
let id: string | ||
if (streamObj.workspaceId) { | ||
const createWorkspaceProject = createWorkspaceProjectFactory({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if u want a multiregion project, do createTestStream
w/ workspaceId set AND run tests in multiregion mode
📸 Preview service has generated an image. |
📸 Preview service has generated an image. |
📸 Preview service has generated an image. |
const useRegion = isMultiRegionTestMode() && regionKey | ||
|
||
if (!FF_WORKSPACES_MODULE_ENABLED) { | ||
// Just skip creation and set id to undefined - this allows this to be invoked the same way if FFs are on or off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can see how this is kinda hacky, but this allows me to write the same test code that works in both no-workspaces/with workspaces but not multiregion/with workspaces and multiregion mode
if there's better options, i'm open to it
📸 Preview service has generated an image. |
totalCount: await getUserStreamsCount(filter) | ||
totalCount: await getUserStreamsCount({ | ||
...filter, | ||
searchQuery: filter.search || undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workspace.projects.totalCount when filter was applied was busted until now
@@ -108,7 +108,8 @@ const { | |||
filter: { | |||
search: (search.value || '').trim() || null, | |||
onlyWithRoles: selectedRoles.value?.length ? selectedRoles.value : null | |||
} | |||
}, | |||
cursor: null as Nullable<string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts error from previous code, @Mikehrn @andrewwallacespeckle plz check that TS linting works on ur end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabis94 Generally my linting is working as expected, but this never threw an error 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mikehrn it appears that vue-tsc, the CI linter doesn't pick up on this, which explains why it got through to main. in VSCode I definitely see squiggly lines in Dashboard.vue due to the type not being valid 🤔
@@ -451,9 +490,9 @@ export async function init() { | |||
} | |||
|
|||
export async function shutdown(params: { | |||
graphqlServer: ApolloServer<GraphQLContext> | |||
graphqlServer: Optional<ApolloServer<GraphQLContext>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server will be undefined if test beforeAll
hook fails
import { BasicTestStream, createTestStreams } from '@/test/speckle-helpers/streamHelper' | ||
import { expect } from 'chai' | ||
|
||
describe('Core GraphQL Subscriptions (New)', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NEW PATTERN FOR SUBSCRIPTION TESTING - EASY AND FAST
@@ -24,6 +24,7 @@ | |||
"dev:server:test": "cross-env DISABLE_NOTIFICATIONS_CONSUMPTION=true NODE_ENV=test LOG_LEVEL=silent LOG_PRETTY=true node ./bin/ts-www", | |||
"test": "cross-env NODE_ENV=test LOG_LEVEL=silent LOG_PRETTY=true mocha", | |||
"test:multiregion": "cross-env RUN_TESTS_IN_MULTIREGION_MODE=true FF_WORKSPACES_MODULE_ENABLED=true FF_WORKSPACES_MULTI_REGION_ENABLED=true yarn test", | |||
"test:no-ff": "cross-env DISABLE_ALL_FFS=true yarn test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new easy way to run all tests w/ FFs off, even locally
📸 Preview service has generated an image. |
📸 Preview service has generated an image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FE looks good 🚀
Description & motivation
Changes:
To-do before merge:
Screenshots:
Validation of changes:
Checklist:
References