Skip to content

Commit

Permalink
Improve E2E tests (#12366)
Browse files Browse the repository at this point in the history
* Improve pod.spec test

* Improve another repo spec test

* vai test improvements

* Various fixes

* pagination change fixes

* pagination change fixes + new settings

* Update settings-utils.ts

* Fixes

* create name fixes

* improve namespace picker test

* Fix user response

* fixes

* fixes

* fixes

* Make up for userpreference lag by waiting for desired value

* Dont include junk revision in mock resources
- causes MASSSIVE socket spam if the rancher revision exceeds it

* update burger menu, make it clear there's pinned and other cluster lists

also comment out .skip, they play HAVOC with test reports

* improve tableRowsPerPageAndNamespaceFilter

* fix project-namespace

* more fixes...

* Revert "Dont include junk revision in mock resources"

This reverts commit 9aaaabb.

* real revision fix

* lint fixes are commenting out skip

* use common resource revision

* safer userpref check

* fix standard user tests

* more linting

* because why not

* fixes/improvements

* Add retry to updateNamespaceFilter

* improve CRD list check for count

* after own review

* tie in failure and retry to tableRowsPerPageAndNamespaceFilter

* handle events count less than 500...

* fix merge fail
  • Loading branch information
richard-cox authored Nov 7, 2024
1 parent 2c0c8ad commit 024f92c
Show file tree
Hide file tree
Showing 85 changed files with 1,323 additions and 938 deletions.
1 change: 1 addition & 0 deletions cypress/e2e/blueprints/blueprint.utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CYPRESS_SAFE_RESOURCE_REVISION = 999999999;
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../blueprint.utils';

export const createPayloadData = {
id: 'e2e-pod-security-admission-1705617529465',
type: 'management.cattle.io.podsecurityadmissionconfigurationtemplate',
Expand All @@ -12,7 +14,7 @@ export const createPayloadData = {
},
kind: 'PodSecurityAdmissionConfigurationTemplate',
metadata: {
fields: ['e2e-pod-security-admission-1705617529465', '18s'], name: 'e2e-pod-security-admission-1705617529465', resourceVersion: '831667'
fields: ['e2e-pod-security-admission-1705617529465', '18s'], name: 'e2e-pod-security-admission-1705617529465', resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION
},
description: 'e2e-pod-security-admission-1705617529465-description'
};
Expand All @@ -31,7 +33,7 @@ export const updatePayloadData = {
},
kind: 'PodSecurityAdmissionConfigurationTemplate',
metadata: {
fields: ['e2e-pod-security-admission-1705628550961', '7s'], name: 'e2e-pod-security-admission-1705628550961', resourceVersion: '938739'
fields: ['e2e-pod-security-admission-1705628550961', '7s'], name: 'e2e-pod-security-admission-1705628550961', resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION
},
description: 'e2e-pod-security-admission-1705628550961-description-edit'
};
12 changes: 7 additions & 5 deletions cypress/e2e/blueprints/explorer/cluster/events.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../../blueprint.utils';

// GET /v1/events - return empty events data
const eventsGetEmptyEventsSet = {
type: 'collection',
links: { self: `${ Cypress.env('api') }/v1/events` },
createTypes: { event: `${ Cypress.env('api') }/v1/events` },
actions: {},
resourceType: 'event',
revision: Number.MAX_VALUE, // The UI will use this point in history to start watching for changes from. If it's too low (than the global system revision) we will spam with requests
revision: CYPRESS_SAFE_RESOURCE_REVISION, // The UI will use this point in history to start watching for changes from. If it's too low (than the global system revision) we will spam with requests
data: []
};

Expand All @@ -16,7 +18,7 @@ const eventsGetResponseSmallSet = {
createTypes: { event: `${ Cypress.env('api') }/v1/events` },
actions: {},
resourceType: 'event',
revision: Number.MAX_VALUE, // The UI will use this point in history to start watching for changes from. If it's too low (than the global system revision) we will spam with requests
revision: CYPRESS_SAFE_RESOURCE_REVISION, // The UI will use this point in history to start watching for changes from. If it's too low (than the global system revision) we will spam with requests
count: 3,
data: [
{
Expand All @@ -40,7 +42,7 @@ const eventsGetResponseSmallSet = {
name: 'fleet-agent-0.17d80b90a6d2c7ab',
namespace: 'cattle-fleet-local-system',
relationships: null,
resourceVersion: '0',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -71,7 +73,7 @@ const eventsGetResponseSmallSet = {
name: 'fleet-agent-0.17d80b90a6d2c7ab',
namespace: 'cattle-fleet-local-system',
relationships: null,
resourceVersion: '0',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -102,7 +104,7 @@ const eventsGetResponseSmallSet = {
name: 'fleet-agent-0.17d80b90a6d2c7ab',
namespace: 'cattle-fleet-local-system',
relationships: null,
resourceVersion: '0',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down
12 changes: 7 additions & 5 deletions cypress/e2e/blueprints/explorer/core/service-accounts-get.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../../blueprint.utils';

// GET /v1/serviceaccounts - return empty service accounts data
const serviceAccGetResponseEmpty = {
type: 'collection',
links: { self: 'https://yonasb29.qa.rancher.space/v1/serviceaccounts' },
createTypes: { serviceaccount: 'https://yonasb29.qa.rancher.space/v1/serviceaccounts' },
actions: {},
resourceType: 'serviceaccount',
revision: '129651',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 0,
data: []
};
Expand All @@ -17,7 +19,7 @@ const serviceAcctResponseSmallSet = {
createTypes: { serviceaccount: 'https://yonasb29.qa.rancher.space/v1/serviceaccounts' },
actions: {},
resourceType: 'serviceaccount',
revision: '129651',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 3,
data: [
{
Expand Down Expand Up @@ -55,7 +57,7 @@ const serviceAcctResponseSmallSet = {
state: 'succeeded'
}
],
resourceVersion: '7124',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -104,7 +106,7 @@ const serviceAcctResponseSmallSet = {
state: 'deployed'
}
],
resourceVersion: '9344',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -165,7 +167,7 @@ const serviceAcctResponseSmallSet = {
state: 'deployed'
}
],
resourceVersion: '9342',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down
10 changes: 6 additions & 4 deletions cypress/e2e/blueprints/explorer/fleet/contents-get.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../../blueprint.utils';

// GET /v1/fleet.cattle.io.contents - return empty contents data
const fleetContentsGetResponseEmpty = {
type: 'collection',
links: { self: 'https://yonasb29head.qa.rancher.space/v1/fleet.cattle.io.contents' },
createTypes: { 'fleet.cattle.io.content': 'https://yonasb29head.qa.rancher.space/v1/fleet.cattle.io.contents' },
actions: {},
resourceType: 'fleet.cattle.io.content',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 0,
data: []
};
Expand All @@ -17,7 +19,7 @@ const fleetContentsResponseSmallSet = {
createTypes: { 'fleet.cattle.io.content': 'https://yonasb29head.qa.rancher.space/v1/fleet.cattle.io.contents' },
actions: {},
resourceType: 'fleet.cattle.io.content',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 2,
data: [
{
Expand All @@ -41,7 +43,7 @@ const fleetContentsResponseSmallSet = {
generation: 1,
name: 's-65075fe21d0e5087693027a2fdbb5ed559295ed1ffeb5957f98d77decb4a5',
relationships: null,
resourceVersion: '4380255',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -73,7 +75,7 @@ const fleetContentsResponseSmallSet = {
generation: 1,
name: 's-807cc7bcb0de2dae39c913c375f676238d021519258d34913ccc842519c63',
relationships: null,
resourceVersion: '8041',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../../../blueprint.utils';

// GET /v1/apiextensions.k8s.io.customresourcedefinitions - small set of crds data
const crdsGetResponseSmallSet = {
type: 'collection',
links: { self: 'https://yonasb29head.qa.rancher.space/v1/apiextensions.k8s.io.customresourcedefinitions' },
createTypes: { 'apiextensions.k8s.io.customresourcedefinition': 'https://yonasb29head.qa.rancher.space/v1/apiextensions.k8s.io.customresourcedefinitions' },
actions: {},
resourceType: 'apiextensions.k8s.io.customresourcedefinition',
revision: Number.MAX_VALUE, // The UI will use this point in history to start watching for changes from. If it's too low (than the global system revision) we will spam with requests
revision: CYPRESS_SAFE_RESOURCE_REVISION, // The UI will use this point in history to start watching for changes from. If it's too low (than the global system revision) we will spam with requests
count: 2,
data: [
{
Expand All @@ -28,7 +30,7 @@ const crdsGetResponseSmallSet = {
generation: 1,
name: 'users.management.cattle.io',
relationships: null,
resourceVersion: '4473',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'CRD is established',
Expand Down Expand Up @@ -129,7 +131,7 @@ const crdsGetResponseSmallSet = {
state: 'deployed'
}
],
resourceVersion: '1417',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'CRD is established',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../../blueprint.utils';

// GET /v1/rbac.authorization.k8s.io.clusterrolebinding - return empty cluster role binding data
const clusterRoleBindingGetResponseEmpty = {
type: 'collection',
links: { self: 'https://yonasb29head.qa.rancher.space/v1/rbac.authorization.k8s.io.clusterrolebindings' },
createTypes: { 'rbac.authorization.k8s.io.clusterrolebinding': 'https://yonasb29head.qa.rancher.space/v1/rbac.authorization.k8s.io.clusterrolebindings' },
actions: {},
resourceType: 'rbac.authorization.k8s.io.clusterrolebinding',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 0,
data: []
};
Expand All @@ -17,7 +19,7 @@ const clusterRoleBindingResponseSmallSet = {
createTypes: { 'rbac.authorization.k8s.io.clusterrolebinding': 'https://yonasb29head.qa.rancher.space/v1/rbac.authorization.k8s.io.clusterrolebindings' },
actions: {},
resourceType: 'rbac.authorization.k8s.io.clusterrolebinding',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 2,
data: [
{
Expand Down Expand Up @@ -58,7 +60,7 @@ const clusterRoleBindingResponseSmallSet = {
state: 'deployed'
}
],
resourceVersion: '434584',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -118,7 +120,7 @@ const clusterRoleBindingResponseSmallSet = {
state: 'deployed'
}
],
resourceVersion: '5149',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down
10 changes: 6 additions & 4 deletions cypress/e2e/blueprints/explorer/rbac/cluster-roles-get.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../../blueprint.utils';

// GET /v1/rbac.authorization.k8s.io.clusterrolebinding - return empty cluster roles data
const clusterRolesGetResponseEmpty = {
type: 'collection',
links: { self: 'https://yonasb29h3.qa.rancher.space/v1/rbac.authorization.k8s.io.clusterroles' },
createTypes: { 'rbac.authorization.k8s.io.clusterrole': 'https://yonasb29h3.qa.rancher.space/v1/rbac.authorization.k8s.io.clusterroles' },
actions: {},
resourceType: 'rbac.authorization.k8s.io.clusterrole',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 0,
data: []
};
Expand All @@ -17,7 +19,7 @@ const clusterRolesResponseSmallSet = {
createTypes: { 'rbac.authorization.k8s.io.clusterrole': 'https://yonasb29h3.qa.rancher.space/v1/rbac.authorization.k8s.io.clusterroles' },
actions: {},
resourceType: 'rbac.authorization.k8s.io.clusterrole',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 2,
data: [
{
Expand Down Expand Up @@ -49,7 +51,7 @@ const clusterRolesResponseSmallSet = {
labels: { 'kubernetes.io/bootstrapping': 'rbac-defaults' },
name: 'admin',
relationships: null,
resourceVersion: '4878',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -94,7 +96,7 @@ const clusterRolesResponseSmallSet = {
state: 'deployed'
}
],
resourceVersion: '4838',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down
12 changes: 7 additions & 5 deletions cypress/e2e/blueprints/explorer/rbac/role-bindings-get.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CYPRESS_SAFE_RESOURCE_REVISION } from '../../blueprint.utils';

// GET /v1/rbac.authorization.k8s.io.rolebindings- return empty role binding data
const roleBindingGetResponseEmpty = {
type: 'collection',
links: { self: 'https://yonasb29head.qa.rancher.space/v1/rbac.authorization.k8s.io.rolebindings' },
createTypes: { 'rbac.authorization.k8s.io.rolebinding': 'https://yonasb29head.qa.rancher.space/v1/rbac.authorization.k8s.io.rolebindings' },
actions: {},
resourceType: 'rbac.authorization.k8s.io.rolebinding',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 0,
data: []
};
Expand All @@ -17,7 +19,7 @@ const roleBindingResponseSmallSet = {
createTypes: { 'rbac.authorization.k8s.io.rolebinding': 'https://yonasb29head.qa.rancher.space/v1/rbac.authorization.k8s.io.rolebindings' },
actions: {},
resourceType: 'rbac.authorization.k8s.io.rolebinding',
revision: '123',
revision: CYPRESS_SAFE_RESOURCE_REVISION,
count: 3,
data: [
{
Expand Down Expand Up @@ -66,7 +68,7 @@ const roleBindingResponseSmallSet = {
message: 'Resource is current'
}
],
resourceVersion: '445143',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -134,7 +136,7 @@ const roleBindingResponseSmallSet = {
message: 'Resource is current'
}
],
resourceVersion: '4386433',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down Expand Up @@ -203,7 +205,7 @@ const roleBindingResponseSmallSet = {
state: 'deployed'
}
],
resourceVersion: '5141',
resourceVersion: CYPRESS_SAFE_RESOURCE_REVISION,
state: {
error: false,
message: 'Resource is current',
Expand Down
Loading

0 comments on commit 024f92c

Please sign in to comment.