Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Do not review: Feature branch: EVG-19395: Enable test isolation #2055

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e30ba31
EVG-20408, EVG-20411, EVG-20767: Reseed EVG e2e test data before and …
SupaJoon Sep 7, 2023
5ca14c8
Merge branch 'EVG-19395' of github.com:evergreen-ci/spruce into EVG-1…
SupaJoon Sep 8, 2023
53309f5
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-19395
SupaJoon Sep 8, 2023
771b8d7
EVG-20711 & EVG-20712: Fix test failures in various specs (#2006)
SupaJoon Sep 8, 2023
645916b
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-19395
SupaJoon Sep 12, 2023
a62a6c4
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-19395
SupaJoon Sep 14, 2023
9157744
EVG-20813: Update patch_with_aborted_task (#2036)
SupaJoon Sep 14, 2023
49be716
EVG-20766: Fix test_table flake (#2029)
SupaJoon Sep 14, 2023
a0aeb26
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-19395
SupaJoon Sep 18, 2023
1fd8e4b
Merge branch 'EVG-19395' of github.com:evergreen-ci/spruce into EVG-1…
SupaJoon Sep 18, 2023
041258d
merge main
SupaJoon Sep 21, 2023
0aa34d8
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-19395-…
SupaJoon Sep 25, 2023
702fb3a
EVG-20818: Remove testIsolation for notification preferences (#2063)
sophstad Sep 27, 2023
926f5fa
EVG-20820: Enable test isolation in commit_queue.ts (#2068)
minnakt Sep 29, 2023
9b051ab
CHORE(NPM) - bump @leafygreen-ui/loading-indicator from 2.0.5 to 2.0.…
dependabot[bot] Sep 26, 2023
05fd84c
CHORE(NPM) - bump @types/prompts from 2.4.4 to 2.4.5 (#2061)
dependabot[bot] Sep 26, 2023
9741e97
EVG-19947: Support EC2 Fleet on provider settings page (#2050)
minnakt Sep 27, 2023
40f3264
EVG-20939: Install @leafygreen-ui/[email protected] (#2065)
SupaJoon Sep 27, 2023
4d4deb2
EVG-20832: Install @leafygreen-ui/[email protected] (#2064)
SupaJoon Sep 27, 2023
c9722ad
EVG-20880: Add hosts section for static providers (#2058)
minnakt Sep 27, 2023
fb6e793
v3.0.142
ablack12 Sep 27, 2023
855c48b
v3.0.143
khelif96 Sep 27, 2023
af7e1d4
EVG-19951: Add bootstrap methods to host settings (#2043)
sophstad Sep 27, 2023
133deca
EVG-20863: Install @leafygreen-ui/[email protected] (#2066)
SupaJoon Sep 27, 2023
44d0032
v3.0.144
SupaJoon Sep 28, 2023
a789295
v3.0.145
khelif96 Sep 28, 2023
cc64dca
v3.0.146
khelif96 Sep 28, 2023
93a2194
v3.0.147
SupaJoon Sep 28, 2023
9e24f74
v3.0.148
ablack12 Sep 29, 2023
7a42cab
v3.0.149
minnakt Sep 29, 2023
aecab86
EVG-20837: Install [email protected] (#2067)
SupaJoon Sep 29, 2023
b784c8c
EVG-18598 Surface warning when restarting a disabled task. (#2069)
khelif96 Sep 29, 2023
74f42a0
EVG-19948: Support EC2 On-Demand on provider settings page (#2071)
minnakt Sep 29, 2023
1ce62b3
v3.0.150
khelif96 Oct 2, 2023
ffb55c4
EVG-19254: Show details.description regardless of task status (#2070)
minnakt Oct 2, 2023
29d1b5b
EVG-20408, EVG-20411, EVG-20767: Reseed EVG e2e test data before and …
SupaJoon Sep 7, 2023
5fcb31e
Merge branch 'main' into EVG-19395-feature-branch
khelif96 Oct 2, 2023
bd842d0
EVG-20710, EVG-20911: Isolate project_settings tests (#2056)
SupaJoon Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ functions:
params:
working_dir: spruce/evergreen
command: make configure-mongod

- command: shell.exec
type: setup
params:
shell: bash
script: |
${PREPARE_SHELL}
cd $PROJECT_DIRECTORY
mkdir mongodb-tools && cd mongodb-tools
curl ${mongodb_tools_url} -o mongodb-tools.tgz
${decompress} mongodb-tools.tgz
mv ./mongodb-*/bin/* .
setup-node:
- command: subprocess.exec
params:
Expand Down Expand Up @@ -202,7 +212,7 @@ functions:
script: |
${PREPARE_SHELL}
yarn build-storybook

yarn-snapshot:
command: shell.exec
params:
Expand Down Expand Up @@ -247,8 +257,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
["spruce/cypress/screenshots/*"]
local_files_include_filter: ["spruce/cypress/screenshots/*"]
remote_file: spruce/${task_id}/
bucket: mciuploads
content_type: image/png
Expand All @@ -259,8 +268,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
["spruce/cypress/videos/*"]
local_files_include_filter: ["spruce/cypress/videos/*"]
remote_file: spruce/${task_id}/
bucket: mciuploads
content_type: video/mp4
Expand Down Expand Up @@ -290,8 +298,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
["spruce/storybook-static/*.html"]
local_files_include_filter: ["spruce/storybook-static/*.html"]
remote_file: spruce/${task_id}/storybook/
bucket: mciuploads
content_type: text/html
Expand All @@ -303,7 +310,10 @@ functions:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
["spruce/storybook-static/**/*.js$", "spruce/storybook-static/**/*.mjs$"]
[
"spruce/storybook-static/**/*.js$",
"spruce/storybook-static/**/*.mjs$",
]
remote_file: spruce/${task_id}/storybook/
bucket: mciuploads
content_type: application/javascript
Expand All @@ -314,8 +324,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
["spruce/storybook-static/**/*.js.map"]
local_files_include_filter: ["spruce/storybook-static/**/*.js.map"]
remote_file: spruce/${task_id}/storybook/
bucket: mciuploads
content_type: application/json
Expand All @@ -326,8 +335,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
["spruce/storybook-static/**/*.css"]
local_files_include_filter: ["spruce/storybook-static/**/*.css"]
remote_file: spruce/${task_id}/storybook/
bucket: mciuploads
content_type: text/css
Expand All @@ -338,8 +346,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
["spruce/storybook-static/**/*.json"]
local_files_include_filter: ["spruce/storybook-static/**/*.json"]
remote_file: spruce/${task_id}/storybook/
bucket: mciuploads
content_type: application/json
Expand All @@ -358,7 +365,7 @@ functions:
content_type: font/woff2
permissions: public-read
preserve_path: true

attach-codegen-diff:
command: s3.put
type: system
Expand All @@ -371,7 +378,7 @@ functions:
bucket: mciuploads
content_type: text/plain
permissions: public-read

attach-email:
command: s3.put
type: system
Expand Down Expand Up @@ -412,7 +419,7 @@ functions:
EOF

echo "Done populating"

prod-deploy:
command: shell.exec
params:
Expand All @@ -429,8 +436,6 @@ functions:
AUTHOR_EMAIL=${author_email} \
yarn deploy:prod



#######################################
# Tasks #
#######################################
Expand Down Expand Up @@ -476,7 +481,7 @@ tasks:
- func: yarn-serve
- func: wait-for-evergreen
- func: run-cypress-tests

- name: check_codegen
commands:
- func: sym-link
Expand All @@ -497,6 +502,7 @@ buildvariants:
goroot: /opt/golang/go1.20
mongodb_url_2204: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.6.tgz
mongosh_url_2204: https://downloads.mongodb.com/compass/mongosh-1.9.0-linux-x64.tgz
mongodb_tools_url: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.8.0.tgz
node_version: 16.17.0
modules:
- evergreen
Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Spruce is the React UI for MongoDB's continuous integration software.
### Running Locally

1. Clone the Spruce Github repository
2. Ensure you have Node.js 16+ installed
2. Ensure you have Node.js v16+ and MongoDB Command Line Database Tools
v100.8.0+ installed
3. Ask a colleague for their .cmdrc.json file and follow the instructions
[here](#environment-variables)
4. Run `yarn`
Expand Down Expand Up @@ -159,10 +160,13 @@ on localhost:9090 for the front-end to work.
In order to run the Cypress tests, do the following, assuming you have this repo
checked out and all the dependencies installed by yarn:

1. Start the evergreen back-end with the sample local test data. You can do this
1. Increase the limit on open files by running `ulimit -n 64000` before running
mongod in the same shell.
2. Start the evergreen back-end with the sample local test data. You can do this
by typing `make local-evergreen` in your evergreen folder.
2. Start the Spruce local server by typing `yarn build:local && yarn serve` in this repo.
3. Run Cypress by typing one of the following:
3. Start the Spruce local server by typing `yarn build:local && yarn serve` in
this repo.
4. Run Cypress by typing one of the following:
- `yarn cy:open` - opens the Cypress app in interactive mode. You can select
tests to run from here in the Cypress browser.
- `yarn cy:run` - runs all the Cypress tests at the command-line and reports
Expand Down Expand Up @@ -200,22 +204,26 @@ production environments.
switched to db mci
mci:SECONDARY> db.distro.find({_id: "archlinux-small"}) // the full query
```

5. Exit from the mongo shell and prepare to run `mongoexport`

```
mongoexport --db=mci --collection=distro --out=distro.json --query='{_id: "archlinux-small"}'
mongoexport --db=mci --collection=distro --out=distro.json --query='{_id: "archlinux-small"}'
2020-07-29T17:41:50.266+0000 connected to: localhost
2020-07-29T17:41:50.269+0000 exported 1 record
```

After running this command a file will be saved to your home directory with
the results of the `mongoexport`

_Note you may need to provide the full path to mongoexport on the staging db_

```
/var/lib/mongodb-mms-automation/mongodb-linux-x86_64-4.0.5/bin/mongoexport --db=mci --collection=distro --out=distro.json --query='{_id: "archlinux-small"}'
/var/lib/mongodb-mms-automation/mongodb-linux-x86_64-4.0.5/bin/mongoexport --db=mci --collection=distro --out=distro.json --query='{_id: "archlinux-small"}'
2020-07-29T17:41:50.266+0000 connected to: localhost
2020-07-29T17:41:50.269+0000 exported 1 record
```

6. Exit the ssh session using `exit` or `Ctrl + D`
7. You can now transfer this json file to your local system by running the
following command. `scp <db you sshed into>:~/distro.json .` This will save a
Expand All @@ -225,9 +233,8 @@ production environments.
from within the evergreen folder
9. Once you have this file you can copy the contents of it to the relevant
`testdata/local/<collection>.json` file with in the evergreen folder
10. You can then delete `/bin/.load-local-data` within the evergreen folder and
run `make local-evergreen` to repopulate the local database with your new
data.
10. You can then run `yarn evg-db-ops --reseed` to repopulate the local database
with your new data.

**Notes**

Expand Down Expand Up @@ -266,4 +273,5 @@ Run one of the following commands to deploy to the appropriate environment
3. `yarn deploy:beta` = deploy to https://spruce-beta.corp.mongodb.com (Beta
connects to the production backend)

In case of emergency (i.e. Evergreen, GitHub, or other systems are down), a production build can be pushed directly to S3 with `yarn deploy:prod --local`.
In case of emergency (i.e. Evergreen, GitHub, or other systems are down), a
production build can be pushed directly to S3 with `yarn deploy:prod --local`.
17 changes: 17 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from "cypress";
import { execSync } from "child_process";

export default defineConfig({
e2e: {
Expand All @@ -11,5 +12,21 @@ export default defineConfig({
specPattern: "cypress/integration/**/*.ts",
viewportWidth: 1920,
viewportHeight: 1080,
setupNodeEvents(on) {
on("before:run", () => {
try {
execSync("yarn evg-db-ops --dump");
} catch (e) {
console.error(e);
}
});
on("after:run", () => {
try {
execSync("yarn evg-db-ops --clean-up");
} catch (e) {
console.error(e);
}
});
},
},
});
9 changes: 3 additions & 6 deletions cypress/integration/announcements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ import {
} from "constants/cookies";

describe("Announcement overlays", () => {
beforeEach(() => {
cy.clearCookie(CY_DISABLE_NEW_USER_WELCOME_MODAL);
cy.clearCookie(CY_DISABLE_COMMITS_WELCOME_MODAL);
cy.clearCookie("This is an important notification");
});

it("Displays a welcome modal only when you first visit spruce", () => {
cy.clearCookie(CY_DISABLE_NEW_USER_WELCOME_MODAL);
cy.visit("/");
cy.dataCy("welcome-modal").should("exist");
cy.dataCy("close-welcome-modal").click();
Expand All @@ -19,6 +14,7 @@ describe("Announcement overlays", () => {
});

it("Should not show a Sitewide banner after it has been dismissed", () => {
cy.clearCookie("This is an important notification");
cy.visit("/");
cy.dataCy("sitewide-banner-success").should("exist");
cy.closeBanner("sitewide-banner-success");
Expand All @@ -41,6 +37,7 @@ describe("Announcement overlays", () => {
});

it("visiting the commits page for the first time should show a welcome modal", () => {
cy.clearCookie(CY_DISABLE_COMMITS_WELCOME_MODAL);
cy.visit("/commits/spruce");
cy.dataCy("welcome-modal").should("be.visible");
cy.dataCy("close-welcome-modal").click();
Expand Down
22 changes: 10 additions & 12 deletions cypress/integration/commit_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,47 @@ const COMMIT_QUEUE_ROUTE_2 = `/commit-queue/${commitQueue.id2}`;
const INVALID_COMMIT_QUEUE_ROUTE = `/commit-queue/${commitQueue.id3}`;
const COMMIT_QUEUE_ROUTE_4 = `/commit-queue/${commitQueue.id4}`;

describe("commit queue page", { testIsolation: false }, () => {
describe("commit queue page", () => {
describe(COMMIT_QUEUE_ROUTE_1, () => {
before(() => {
beforeEach(() => {
cy.visit(COMMIT_QUEUE_ROUTE_1);
});

it("Should render the commit queue page with one card", () => {
cy.dataCy("commit-queue-card").should("have.length", 1);
});

it("Clicking on Total Code changes should toggle a drop down table", () => {
it("Clicking on 'Total code changes' should show the code changes table", () => {
cy.dataCy("code-changes-table").should("not.be.visible");
cy.dataCy("accordion-toggle").click();
cy.dataCy("code-changes-table").should("be.visible");
});

it("Clicking on remove a patch from the commit queue should work", () => {
it("Should be able to remove a patch from the commit queue", () => {
cy.dataCy("commit-queue-card").should("exist");
cy.dataCy("commit-queue-patch-button").should("exist");
cy.dataCy("commit-queue-patch-button").click();
cy.dataCy("commit-queue-confirmation-modal").should("be.visible");
cy.dataCy("commit-queue-confirmation-modal").within(() => {
cy.contains("Remove").click();
cy.contains("button", "Remove").click();
});
cy.dataCy("commit-queue-confirmation-modal").should("not.exist");
cy.dataCy("commit-queue-card").should("not.exist");
});
});

describe(COMMIT_QUEUE_ROUTE_2, () => {
before(() => {
cy.visit(COMMIT_QUEUE_ROUTE_2);
});
it("visiting a page with multiple sets of code changes should have multiple tables", () => {
cy.visit(COMMIT_QUEUE_ROUTE_2);
cy.dataCy("accordion-toggle").should("have.length", 4);
});
});

describe(COMMIT_QUEUE_ROUTE_4, () => {
before(() => {
beforeEach(() => {
cy.visit(COMMIT_QUEUE_ROUTE_4);
});

it("should display the commit queue message if there is one", () => {
cy.dataCy("commit-queue-message").should("exist");
cy.dataCy("commit-queue-message").should(
Expand All @@ -75,10 +75,8 @@ describe("commit queue page", { testIsolation: false }, () => {
});

describe(INVALID_COMMIT_QUEUE_ROUTE, () => {
before(() => {
it("visiting a nonexistent commit queue page should display an error", () => {
cy.visit(INVALID_COMMIT_QUEUE_ROUTE);
});
it("visiting a non existent commit queue page should display an error", () => {
cy.validateToast("error", "There was an error loading the commit queue");
});
});
Expand Down
8 changes: 5 additions & 3 deletions cypress/integration/preferences/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ describe("global subscription settings", () => {
"aria-disabled",
"true"
);
cy.dataCy("slack-member-id-field").clear().type("12345");
cy.dataCy("slack-member-id-field").clear();
cy.dataCy("slack-member-id-field").type("12345");
cy.dataCy("save-profile-changes-button").should(
"not.have.attr",
"aria-disabled",
Expand All @@ -17,7 +18,8 @@ describe("global subscription settings", () => {
});
it("saving changes to a field should work", () => {
cy.visit(pageRoute);
cy.dataCy("slack-username-field").clear().type("slack.user");
cy.dataCy("slack-username-field").clear();
cy.dataCy("slack-username-field").type("slack.user");
cy.dataCy("save-profile-changes-button").click();
cy.validateToast("success", "Your changes have successfully been saved.");
});
Expand Down Expand Up @@ -73,7 +75,7 @@ describe("user subscriptions table", () => {
);
});

describe("Deleting subscriptions", { testIsolation: false }, () => {
describe("Deleting subscriptions", () => {
it("Deletes a single subscription", () => {
cy.dataCy("subscription-row")
.eq(0)
Expand Down
Loading