Skip to content
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

E2E tests #6779

Merged
merged 127 commits into from
Apr 16, 2024
Merged

E2E tests #6779

merged 127 commits into from
Apr 16, 2024

Conversation

enisdenjo
Copy link
Collaborator

@enisdenjo enisdenjo commented Apr 1, 2024

  • Tests are buildless; meaning, no need to run yarn build beforehand
  • Tests are isolated (and should be kept isolated); meaning, all tests can, and should, run concurrently
  • Tests can run services - commands or docker containers. No need to have a "pretest" step to run them
  • Test utilities automatically clean up leftover processes and temporary files

TODO

  • Compose and serve configs work in both ESM and CJS environments
  • DefaultLogger logs to stderr, stdout is to be used for output / results
  • Compose will write the result to stdout by default when target is not specified
  • Fix compose writing to json target
  • FS operations in utils don't depend on Node types
  • When composing, use target's absolute path if detected (wrong path was used before)
  • Skip the resolver if it has required variables that the parent subgraph doesn't have See the changeset for the details
  • Migrate v1 examples to e2e. Except for examples needing secrets or non-node environments, like:
    • openapi-location-weather
    • openapi-youtrack
    • integrations/*
  • Destroy pubsub on process kill signals in serve-cli
  • Fix leak in neo4j e2e fusiongraphExecutor (causes detect open handle to hang)
  • Fix Mesh not exiting on SIGTERM in mysql-rfam e2e
    1. cd e2e/mysql-rfam
    2. node --import tsx ../../packages/compose-cli/src/bin.ts --target=fusiongraph.graphql
    3. node --import tsx ../../packages/serve-cli/src/bin.ts --fusiongraph=fusiongraph.graphql
    4. *In other terminal kill -15 <pid of serve-cli> (CTRL+C works)
    5. serve-cli receives the signal but does not die
  • Disallow new lines in paths when checking with isValidPath graphql-tools#6055 (causes e2e/json-schema-subscriptions to fail)
  • Fix Unsupported protocol: /api/v3/pet/1 in petstore OpenAPI v3 (see snapshot)
  • Fix federation example errors in executed query (see snapshot)

Copy link

codesandbox bot commented Apr 1, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Apr 1, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-mesh/cache-cfw-kv 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-file 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-localforage 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-redis 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/compose-cli 0.3.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-execution 0.0.3-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-federation 0.0.3-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-runtime 0.3.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
json-machete 0.97.2-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/apollo-link 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/cli 0.90.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/config 0.100.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/graphql 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/grpc 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/json-schema 0.100.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/mongoose 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/mysql 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/neo4j 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/odata 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/openapi 0.100.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/postgraphile 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/raml 0.100.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/soap 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/supergraph 0.4.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/thrift 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/tuql 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/http 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-bare 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-federation 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-stitching 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/runtime 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/store 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-cache 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-encapsulate 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-extend 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-federation 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-filter-schema 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hive 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hoist-field 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-naming-convention 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prefix 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prune 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rate-limit 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rename 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-replace-field 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-resolvers-composition 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-transfer-schema 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-type-merging 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/types 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/urql-exchange 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/utils 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/json-schema 0.100.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/mysql 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/neo4j 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/openapi 0.100.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/raml 0.100.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/soap 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/sqlite 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@omnigraph/thrift 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-deduplicate-request 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-hive 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-cache 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-details-extensions 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-live-query 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-mock 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-newrelic 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-field-permissions 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-headers 0.1.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 0.99.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-rate-limit 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-response-cache 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-snapshot 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-statsd 0.98.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/serve-cli 0.4.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/serve-runtime 0.3.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-common 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-http 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-mysql 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-neo4j 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-rest 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-soap 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-sqlite 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-thrift 0.2.0-alpha-20240416153537-842cdc4eb3155ee15a843c59831be5204976cb6d npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Apr 1, 2024

💻 Website Preview

The latest changes are available as preview in: https://4aec52a3.graphql-mesh.pages.dev

e2e/tenv.ts Outdated Show resolved Hide resolved
e2e/tenv.ts Outdated Show resolved Hide resolved
e2e/tenv.ts Outdated Show resolved Hide resolved
e2e/tenv.ts Outdated Show resolved Hide resolved
e2e/tenv.ts Outdated Show resolved Hide resolved
e2e/tenv.ts Outdated Show resolved Hide resolved
import 'dotenv/config';
import 'tsx/cjs';
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's interesting, why do we need to specifically load the CJS version of tsx ?

Copy link
Collaborator Author

@enisdenjo enisdenjo Apr 3, 2024

Choose a reason for hiding this comment

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

Because the bin itself is written in CJS.

"bin": {
"mesh-serve": "dist/cjs/bin.js"
},

Copy link
Owner

Choose a reason for hiding this comment

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

We can convert it to ESM if possible btw.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If node doesn't have a problem with ESM executables, I am fine with changing this. However, I'd leave this for a separate PR not to overdo this one.

}

warn(...args: any[]) {
const message = this.getLoggerMessage({
args,
});
const fullMessage = `${this.prefix} ⚠️ ${warnColor(message)}`;
if (console.warn) {
console.warn(fullMessage);
if (typeof process === 'object') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This means we are changing the priority of the logging function ? We call console.warn only on non-node env where process is not available ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean by changing priority? By convention, stderr is for diagnostics while stdout is for program output. This makes sure various shell techniques still work. Things like piping to a variable or file while still seeing logs (without them being in the destination).

@enisdenjo enisdenjo force-pushed the e2e branch 3 times, most recently from cd6480d to 34af9d9 Compare April 5, 2024 14:13
@enisdenjo enisdenjo force-pushed the e2e branch 5 times, most recently from 842112b to 38250db Compare April 12, 2024 17:35
@enisdenjo enisdenjo force-pushed the e2e branch 3 times, most recently from d2f2ebc to d9150d5 Compare April 16, 2024 11:51
@enisdenjo enisdenjo marked this pull request as ready for review April 16, 2024 11:51
@ardatan ardatan merged commit 6399add into master Apr 16, 2024
20 checks passed
@ardatan ardatan deleted the e2e branch April 16, 2024 15:56
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