-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
ui: reintroduce end-to-end UI tests with cypress #85095
ui: reintroduce end-to-end UI tests with cypress #85095
Conversation
do-not-merge added because I need to merge cockroachdb/yarn-vendored#98 first :) |
4e1d960
to
b361527
Compare
Don't get scared by the line count here — most of that is a new |
I guess I should add a README.md to that tree huh 😅 |
b361527
to
8db07af
Compare
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 have some questions, but overall this Someone else should do a pass on the docker/bazel stuff who has relevant knowledge.
Reviewed 25 of 26 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @sjbarag and @srosenberg)
build/teamcity/cockroach/ci/tests/ui_e2e_test_impl.sh
line 3 at r2 (raw file):
#!/usr/bin/env bash function build_docker_image() { # Buffer noisy output and only print it on failure.
Smart! Do we do this in other places?
build/teamcity/cockroach/ci/tests/ui_e2e_test_impl.sh
line 15 at r2 (raw file):
SPEC_ARG="" if [ "health" = "${$1:='EMPTY'}" ]; then SPEC_ARG="--spec 'cypress/e2e/health-check/**'"
Is there a reason to specify the directory? Does --e2e
not work because the tests are nested in the health-check
directory?
pkg/ui/workspaces/e2e-tests/.eslintrc.json
line 13 at r2 (raw file):
"@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/ban-types": "off", "@typescript-eslint/no-unused-vars": "off",
Why are these rules overridden to off? Wouldn't we want these on?
pkg/ui/workspaces/e2e-tests/Dockerfile
line 28 at r2 (raw file):
# cockroachdb/cockroach-ci-ui FROM cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
Ah, maybe we should use this image in managed-service too, so the cypress version in CI always matches what we use locally 🤔
pkg/ui/workspaces/e2e-tests/Dockerfile
line 43 at r2 (raw file):
# Use the compiled CRDB binary from a previous TC job via Artifact Dependency: # TODO(barag): include a TC link here
Is this a TODO for post-merge?
pkg/ui/workspaces/e2e-tests/prettier.config.js
line 12 at r2 (raw file):
module.exports = { trailingComma: "all",
Our shared eslint config includes prettier rules. Do we need this config?
pkg/ui/workspaces/e2e-tests/cypress/fixtures/example.json
line 2 at r2 (raw file):
{ "name": "Using fixtures to represent data",
Are these being used? It looks like dummy data.
pkg/ui/workspaces/e2e-tests/cypress/plugins/index.ts
line 29 at r2 (raw file):
The plugins file is no longer supported as of Cypress version 10.0.0.
https://docs.cypress.io/guides/references/migration-guide#Plugins-File-Removed
Was this file added by default? It's no longer supported 🤔
pkg/ui/workspaces/e2e-tests/cypress/support/commands.ts
line 33 at r2 (raw file):
}); import "@testing-library/cypress/add-commands";
Why is this at the bottom?
pkg/ui/workspaces/e2e-tests/cypress/support/index.ts
line 41 at r2 (raw file):
} import "./commands";
Should the imports be at the bottom?
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @laurenbarker, @sjbarag, and @srosenberg)
build/teamcity/cockroach/ci/tests/ui_e2e_test_impl.sh
line 3 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Smart! Do we do this in other places?
Thanks, but I get no credit! I copied this from a few other files in build/teamcity/cockroach/…
😄
build/teamcity/cockroach/ci/tests/ui_e2e_test_impl.sh
line 15 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Is there a reason to specify the directory? Does
--e2e
not work because the tests are nested in thehealth-check
directory?
By default --e2e
runs every test it finds! That works perfectly, but there's a use-case where we'll want to run only the health-check tests within that health-check
directory, as part of a short-running job per-PR.
pkg/ui/workspaces/e2e-tests/.eslintrc.json
line 13 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Why are these rules overridden to off? Wouldn't we want these on?
TBH I copied them from db-console
:) I'll see if I can just take the defaults without much trouble (there's not much code here, so it'll probably be easy)
pkg/ui/workspaces/e2e-tests/Dockerfile
line 43 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Is this a TODO for post-merge?
Yes!
pkg/ui/workspaces/e2e-tests/prettier.config.js
line 12 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Our shared eslint config includes prettier rules. Do we need this config?
Probably not! I'll remove it and let you know.
pkg/ui/workspaces/e2e-tests/cypress/fixtures/example.json
line 2 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Are these being used? It looks like dummy data.
Correct, this was generated by default. I can remove it.
pkg/ui/workspaces/e2e-tests/cypress/plugins/index.ts
line 29 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
The plugins file is no longer supported as of Cypress version 10.0.0.
https://docs.cypress.io/guides/references/migration-guide#Plugins-File-RemovedWas this file added by default? It's no longer supported 🤔
It was! That's hilarious, this was a from-scratch integration. I'll remove it.
pkg/ui/workspaces/e2e-tests/cypress/support/commands.ts
line 33 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Why is this at the bottom?
🤷 that was default — I'll hoist it!
pkg/ui/workspaces/e2e-tests/cypress/support/index.ts
line 41 at r2 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
Should the imports be at the bottom?
Probably not! I'll hoist it. This was just the default location for Cypress.
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @laurenbarker, @sjbarag, and @srosenberg)
pkg/ui/workspaces/e2e-tests/.eslintrc.json
line 13 at r2 (raw file):
Previously, sjbarag (Sean Barag) wrote…
TBH I copied them from
db-console
:) I'll see if I can just take the defaults without much trouble (there's not much code here, so it'll probably be easy)
I would suggest we drop them, as we have these rules suppressed in DB Console for legacy code. Since we are starting over with the E2E tests we should hold them to a higher standard.
8db07af
to
f2ffe37
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @laurenbarker, @sjbarag, and @srosenberg)
a discussion (no related file):
Thanks for the review, @laurenbarker !
Changed in r2:
- a README.md for these tests
- support for
dev ui e2e --headed
, so that working with./dev
is at parity with directyarn
invocations - tests for
dev ui e2e
f2ffe37
to
a9d0635
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @laurenbarker, @sjbarag, and @srosenberg)
pkg/ui/workspaces/e2e-tests/.eslintrc.json
line 13 at r2 (raw file):
Previously, nathanstilwell (Nathan Stilwell) wrote…
I would suggest we drop them, as we have these rules suppressed in DB Console for legacy code. Since we are starting over with the E2E tests we should hold them to a higher standard.
Fixed in r3
pkg/ui/workspaces/e2e-tests/cypress/support/commands.ts
line 33 at r2 (raw file):
Previously, sjbarag (Sean Barag) wrote…
🤷 that was default — I'll hoist it!
Fixed in r3
pkg/ui/workspaces/e2e-tests/cypress/support/index.ts
line 41 at r2 (raw file):
Previously, sjbarag (Sean Barag) wrote…
Probably not! I'll hoist it. This was just the default location for Cypress.
Fixed in r3
pkg/ui/workspaces/e2e-tests/prettier.config.js
line 12 at r2 (raw file):
Previously, sjbarag (Sean Barag) wrote…
Probably not! I'll remove it and let you know.
Removed in r3
pkg/ui/workspaces/e2e-tests/cypress/fixtures/example.json
line 2 at r2 (raw file):
Previously, sjbarag (Sean Barag) wrote…
Correct, this was generated by default. I can remove it.
Removed in r4
pkg/ui/workspaces/e2e-tests/cypress/plugins/index.ts
line 29 at r2 (raw file):
Previously, sjbarag (Sean Barag) wrote…
It was! That's hilarious, this was a from-scratch integration. I'll remove it.
Removed in r3
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.
Reviewed 6 of 9 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @laurenbarker, @sjbarag, and @srosenberg)
pkg/ui/workspaces/e2e-tests/README.md
line 1 at r4 (raw file):
# End-to-end Tests for CockroachDB UI
Very nice docs!
pkg/ui/workspaces/e2e-tests/README.md
line 53 at r4 (raw file):
## Health Checks vs All Tests Each CockroachDB pull request results in only the tests in `./cypress/e2e/health-checks` being executed. These are intended to confirm only
Ah, now I get it
33db6b4
to
046d776
Compare
As a demo, here's a passing health-check suite: https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_ScratchProjectPutTcExperimentsInHere_WipBaragCypressHealth/5936309 Once this merges, we can make the necessary TeamCity changes to copy this configuration into the proper cockroach/ci/tests folder and add a nearly-identical one that runs |
--multitenant=false \ | ||
--http-port=8080 \ | ||
--listening-url-file=$CONN_URL_FILE \ | ||
--execute 'select pg_sleep(1000000)' & |
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.
Curious why movr
? Isn't intended for interactive sessions? Why not start-single-node
?
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.
start-single-node
required a significant amount of setup before the tests could start executing — mostly generating certs, creating a non-root user with a password, creating a few tables, etc. cockroach workload
helps with that slightly, but doing it manually winds up being quite a bit slower than cockroach demo movr
as well. I found an early attempt at that and it was slower and more effort for no benefit :) https://gist.github.com/sjbarag/30eb3c3e253235fef00c461affa1348f
Curiously, a lot of that is handled in build/deploy/cockroach.sh (the entrypoint for the cockroachdb/cockroach
and cockroachdb/cockroach-ci
docker images). I've got a WIP implementation that uses docker compose
for these purposes in CI, so I'll see if I can make that script work for dev uses as well.
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.
Curiously, a lot of that is handled in build/deploy/cockroach.sh
Right, democluster.NewDemoCluster
does essentially the same bootstrapping as in cockroach.sh
but then switches into ShellCtx
. It looks like this predates cockroach.sh
[1] which was added relatively recently and expressly for use with Docker :)
[1] 2862374
I've got a WIP implementation that uses docker compose for these purposes in CI, so I'll see if I can make that script work for dev uses as well.
I think that would be nicer, thanks!
0dc5abe
to
d1365a5
Compare
@rickystewart / @srosenberg how would you feel about merging this before TeamCity gets support for |
I am in support of merging. The stability period starts on Monday; the extra safety net wrt UI e2e tests is going to give us more confidence. |
d1365a5
to
975530c
Compare
bors r=laurenbarker,nathanstilwell,rickystewart,srosenberg |
👎 Rejected by code reviews |
booooooo. @rickystewart looks like we need your approval to unblock this merge ❤️ |
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.
Bumping the version in ./dev
seems like a good idea.
@@ -0,0 +1,14 @@ | |||
#!/usr/bin/env bash | |||
function load_cockroach_docker_image() { | |||
docker load --input upstream_artifacts/cockroach-docker-image.tar.gz &> artifacts/docker-load.log || (cat artifacts/docker-load.log && false) |
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.
Nifty.
975530c
to
05f4130
Compare
Dev bumped to 53. Thanks y'all! |
bors r=laurenbarker,nathanstilwell,rickystewart,srosenberg |
🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
GitHub status checks took too long to complete, so bors is giving up. You can adjust bors configuration to have it wait longer if you like. |
bors r+ |
🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
GitHub status checks took too long to complete, so bors is giving up. You can adjust bors configuration to have it wait longer if you like. |
@sjbarag The CLA check didn't work, you might try doing a no-op commit --amend and re-pushing to re-trigger it. |
A recent commit [1] removed the stale, unused end-to-end tests. In their place, add newly-written tests that can run headlessly in TeamCity (via Docker) as a quick-failing health check and as a more exhaustive suite. [1] 3d171b2 (ui: remove unused end-to-end UI tests, 2022-07-25) Release note: None
05f4130
to
c58279d
Compare
Strange! Rebased on master, so let's give this another go: bors r=laurenbarker,nathanstilwell,rickystewart,srosenberg (🤔 do I need to specify reviewers again, or is |
Build failed (retrying...): |
Build failed (retrying...): |
Build succeeded: |
This commit bumps version since there appears to have been a "merge skew" between cockroachdb#85095 and cockroachdb#86167, and somehow I had a `dev` binary that didn't include the benchmark fix from the latter. Release justification: test-only change. Release note: None
83531: rfc: add rfc for invisible index feature r=wenyihu6 a=wenyihu6 This commit adds an RFC for the invisible index feature. Related issue: #72576, #82363 Release justification: low risk to the existing functionality; this commit just adds rfc. Release Note: none 86267: allocator: select a good enough store for decom/recovery r=lidorcarmel a=lidorcarmel Until now, when decommissioning a node, or when recovering from a dead node, the allocator tries to pick one of the best possible stores as the target for the recovery. Because of that, we sometimes see multiple stores recover replicas to the same store, for example, when decommissioning a node and at the same time adding a new node. This PR changes the way we select a destination store by choosing a random store out of all the stores that are "good enough" for the replica. The risk diversity is still enforced, but we may recover a replica to a store that is considered "over full", for example. Note that during upreplication the allocator will still try to use one of the "best" stores as targets. Fixes: #86265 Release note: None Release justification: a relatively small change, and it can be reverted by setting kv.allocator.recovery_store_selector=best. 86345: clusterversion: prevent upgrades from development versions r=ajwerner a=dt This change defines a new "unstableVersionsAbove" point on the cluster version line, above which any cluster versions are considered unstable development-only versions which are still subject to change. Performing an upgrade to a version while it is still unstable leaves a cluster in a state where it persists a version that claims it has done that upgrade and all prior, however those upgrades are still subject to change by nature of being unstable. If it subsequently upgraded to a stable version, this could result in subtle and nearly impossible to detect issues, as being at or above a particular version is used to assume that all subsequent version upgrades _as released_ were run; on a cluster that ran an earlier iteration of an upgrade this does not hold. Thus to prevent clusters which upgrade to development versions from subsequently upgrading to a stable version, we offset all development versions -- those above the unstableVersionsAbove point -- into the far future by adding one million to their major version e.g. v22.x-y becomes 1000022.x-y. This means an attempt to subsequently "upgrade" to a stable version -- such as v22.2 -- will look like a downgrade and be forbidden. On the release branch, prior to starting to publish upgradable releases, the unstableVersionsAbove value should be set to invalidVersionKey to reflect that all version upgrades in that release branch are now considered to be stable, meaning they must be treated as immutable and append-only. Release note (ops change): clusters that are upgraded to an alpha or other manual build from the development branch will not be able to be subsequently upgraded to a release build. Release justification: high-priority change to existing functionality, to allow releasing alphas with known version upgrade bugs while ensuring they do not subsequently upgrade into stable version but silently corrupted clusters. 86630: kvserver: add additional testing to multiqueue r=AlexTalks a=AlexTalks Add testing for cancelation of multi-queue requests and fix a bug where the channel wasn't closed on task cancelation. Release justification: Test-only change. Release note: None 86801: ttl: add queries to job details r=otan a=rafiss fixes #81905 This helps with observability so users can understand what the TTL job is doing behind the scenes. The job details in the DB console will show: ``` ttl for defaultdb.public.t -- for each range, iterate to find rows: SELECT id FROM [108 AS tbl_name] AS OF SYSTEM TIME '30s' WHERE <crdb_internal_expiration OR ttl_expiration_expression> <= $1 AND (id) > (<range start>) AND (id) < (<range end>) ORDER BY id LIMIT <ttl_select_batch_size> -- then delete with: DELETE FROM [108 AS tbl_name] WHERE <crdb_internal_expiration OR ttl_expiration_expression> <= $1 AND (id) IN (<rows selected above>) ``` Release note: None Release justification: low risk change 86876: kv: Include error information in `crdb_internal.active_range_feeds` r=miretskiy a=miretskiy Include error count, and the last error information in `crdb_internal.active_range_feeds` table whenever rangefeed disconnects due to an error. Release justification: observability improvement. Release note: None 86901: sql: fix cluster_execution_insights priority level r=j82w a=j82w This fixes the priority level and converts it to be a string. closes: #86900, closes #86867 Release justification: Category 2: Bug fixes and low-risk updates to new functionality Release note (sql change): Fix the insight execution priority to have correct value instead of always being default. Changed the column to be a string to avoid converting it in the ui. 86921: kvserver: incorporate sending queue priority into snapshot requests r=AlexTalks a=AlexTalks This change modifies the `(Delegated)SnapshotRequest` Raft RPCs in order to incorporate the name of the sending queue, as well as the sending queue's priority, in order to be used to prioritize queued snapshots on a receiving store. Release justification: Low-risk change to existing functionality. Release note: None 86923: dev: bump version r=yuzefovich a=yuzefovich This commit bumps version since there appears to have been a "merge skew" between #85095 and #86167, and somehow I had a `dev` binary that didn't include the benchmark fix from the latter. Release justification: test-only change. Release note: None Co-authored-by: wenyihu3 <[email protected]> Co-authored-by: Lidor Carmel <[email protected]> Co-authored-by: David Taylor <[email protected]> Co-authored-by: Alex Sarkesian <[email protected]> Co-authored-by: Rafi Shamim <[email protected]> Co-authored-by: Yevgeniy Miretskiy <[email protected]> Co-authored-by: j82w <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]>
A recent commit [1] removed the stale, unused end-to-end tests. In their
place, add newly-written tests that can run headlessly in TeamCity (via
Docker) as a quick-failing health check and as a more exhaustive suite.
[1] 3d171b2 (ui: remove unused end-to-end UI tests, 2022-07-25)
Release note: None