Skip to content

Commit

Permalink
Cluster management (rancher#10161)
Browse files Browse the repository at this point in the history
* actions on cluster tests

* initial iteration for cluster drivers tests

* node drivers tests

* rke templates tests

* cloud credentials tests and initial node templates tests

* completed node templates tests

* pod security admissions and policy templates

* MachineDeployments MachineSets and Machines tests

* repositories tests

* filter out tests with @Jenkins tag
  • Loading branch information
yonasberhe23 authored Feb 6, 2024
1 parent af5731a commit b189f8e
Show file tree
Hide file tree
Showing 72 changed files with 2,824 additions and 80 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
run: |
yarn e2e:prod
env:
GREP_TAGS: ${{ matrix.role.tag }}Setup+${{ matrix.features[0] }} ${{ matrix.role.tag }}Setup+${{ matrix.features[1] || matrix.features[0] }}
GREP_TAGS: ${{ matrix.role.tag }}Setup+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}Setup+${{ matrix.features[1] || matrix.features[0] }} --@jenkins
TEST_USERNAME: admin
TEST_ONLY: setup

Expand All @@ -84,7 +84,7 @@ jobs:
[ "$BUILD_DASHBOARD" != "false" ] || exit 0
env:
TEST_SKIP: setup
GREP_TAGS: ${{ matrix.role.tag }}+${{ matrix.features[0] }} ${{ matrix.role.tag }}+${{ matrix.features[1] || matrix.features[0] }}
GREP_TAGS: ${{ matrix.role.tag }}+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}+${{ matrix.features[1] || matrix.features[0] }} --@jenkins
TEST_USERNAME: ${{ matrix.role.username }}

- name: Upload screenshots
Expand Down
4 changes: 3 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export default defineConfig({
username,
password: process.env.CATTLE_BOOTSTRAP_PASSWORD || process.env.TEST_PASSWORD,
bootstrapPassword: process.env.CATTLE_BOOTSTRAP_PASSWORD,
grepTags: process.env.GREP_TAGS
grepTags: process.env.GREP_TAGS,
awsAccessKey: process.env.AWS_ACCESS_KEY_ID,
awsSecretKey: process.env.AWS_SECRET_ACCESS_KEY
},
e2e: {
fixturesFolder: 'cypress/e2e/blueprints',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
creationTimestamp: '2023-12-07T18:14:50Z'
generation: 1
labels:
cluster.x-k8s.io/cluster-name: local
managedFields:
- apiVersion: cluster.x-k8s.io/v1beta1
fieldsType: FieldsV1
fieldsV1:
f:spec:
.: {}
f:clusterName: {}
f:selector: {}
f:template:
.: {}
f:metadata: {}
f:spec:
.: {}
f:clusterName: {}
manager: rancher
operation: Update
time: '2023-12-07T18:14:50Z'
name: e2e-machinedeployment-name-1701972886077
namespace: default
resourceVersion: '22851'
uid: f5bf052d-7bbf-483a-a20a-b2f6e48d1e15
spec:
clusterName: local
minReadySeconds: 0
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 1
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: local
cluster.x-k8s.io/deployment-name: e2e-machinedeployment-name-1701972886077
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
cluster.x-k8s.io/cluster-name: local
cluster.x-k8s.io/deployment-name: e2e-machinedeployment-name-1701972886077
spec:
bootstrap: {}
clusterName: local
infrastructureRef: {}
65 changes: 65 additions & 0 deletions cypress/e2e/blueprints/cluster_management/machine-deployments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: e2etest
namespace: default
# annotations: key: string
# labels: key: string
spec:
selector:
matchLabels:# key: string
# matchExpressions:
# - key: string
# operator: string
# values:
# - string
template:
metadata:
labels:# key: string
# annotations: key: string
# generateName: string
# name: string
# namespace: string
# ownerReferences:
# - apiVersion: string
# blockOwnerDeletion: boolean
# controller: boolean
# kind: string
# name: string
# uid: string
spec:
# bootstrap:
# configRef:
# apiVersion: string
# fieldPath: string
# kind: string
# name: string
# namespace: string
# resourceVersion: string
# uid: string
# data: string
# dataSecretName: string
clusterName: local
# failureDomain: string
# infrastructureRef:
# apiVersion: string
# fieldPath: string
# kind: string
# name: string
# namespace: string
# resourceVersion: string
# uid: string
# nodeDrainTimeout: string
# providerID: string
# version: string
clusterName: local
# minReadySeconds: int
# paused: boolean
# progressDeadlineSeconds: int
# replicas: int
# revisionHistoryLimit: int
# strategy:
# type: string
# rollingUpdate:
# maxSurge: json
# maxUnavailable: json
44 changes: 44 additions & 0 deletions cypress/e2e/blueprints/cluster_management/machine-sets-edit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineSet
metadata:
creationTimestamp: '2023-12-06T23:41:44Z'
generation: 3
labels:
cluster.x-k8s.io/cluster-name: local
managedFields:
- apiVersion: cluster.x-k8s.io/v1beta1
fieldsType: FieldsV1
fieldsV1:
f:spec:
.: {}
f:clusterName: {}
f:replicas: {}
f:selector: {}
f:template:
.: {}
f:metadata: {}
f:spec:
.: {}
f:clusterName: {}
manager: rancher
operation: Update
time: '2023-12-06T23:46:28Z'
name: e2e-machine-name-1701906098950
namespace: default
resourceVersion: '647485'
uid: 98380f64-0706-4522-8dc2-b91a7f012dcf
spec:
clusterName: local
deletePolicy: Random
replicas: 1
selector:
matchLabels:
cluster.x-k8s.io/set-name: e2e-machine-name-1701906098950
template:
metadata:
labels:
cluster.x-k8s.io/set-name: e2e-machine-name-1701906098950
spec:
bootstrap: {}
clusterName: local
infrastructureRef: {}
58 changes: 58 additions & 0 deletions cypress/e2e/blueprints/cluster_management/machine-sets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineSet
metadata:
name: e2etest
namespace: default
# annotations: key: string
# labels: key: string
spec:
selector:
matchLabels:# key: string
# matchExpressions:
# - key: string
# operator: string
# values:
# - string
template:
metadata:
labels:# key: string
# annotations: key: string
# generateName: string
# name: string
# namespace: string
# ownerReferences:
# - apiVersion: string
# blockOwnerDeletion: boolean
# controller: boolean
# kind: string
# name: string
# uid: string
spec:
bootstrap:
# configRef:
# apiVersion: string
# fieldPath: string
# kind: string
# name: string
# namespace: string
# resourceVersion: string
# uid: string
# data: string
dataSecretName: secretName
clusterName: local
# failureDomain: string
# infrastructureRef:
# apiVersion: string
# fieldPath: string
# kind: string
# name: string
# namespace: string
# resourceVersion: string
# uid: string
# nodeDrainTimeout: string
# providerID: string
# version: string
clusterName: local
# deletePolicy: string
# minReadySeconds: int
# replicas: int
33 changes: 33 additions & 0 deletions cypress/e2e/blueprints/cluster_management/machines-edit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Machine
metadata:
creationTimestamp: '2023-12-06T22:21:54Z'
generation: 1
labels:
cluster.x-k8s.io/cluster-name: local
managedFields:
- apiVersion: cluster.x-k8s.io/v1beta1
fieldsType: FieldsV1
fieldsV1:
f:spec:
.: {}
f:bootstrap:
.: {}
f:dataSecretName: {}
f:clusterName: {}
f:infrastructureRef: {}
manager: rancher
operation: Update
time: '2023-12-06T22:21:54Z'
name: e2e-machine-name-1701901308645
namespace: default
resourceVersion: '609444'
uid: 7d61939a-b44a-4113-a7d1-9db2eda08811
spec:
bootstrap:
dataSecretName: secretname
clusterName: local
infrastructureRef:
namespace: default
resourceVersion: abc123
nodeDeletionTimeout: 10s
32 changes: 32 additions & 0 deletions cypress/e2e/blueprints/cluster_management/machines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Machine
metadata:
name: string
namespace: default
# annotations: key: string
# labels: key: string
spec:
bootstrap:
# configRef:
# apiVersion: string
# fieldPath: string
# kind: string
# name: string
# namespace: string
# resourceVersion: string
# uid: string
# data: string
dataSecretName: secretname
clusterName: local
# failureDomain: string
# infrastructureRef:
# apiVersion: string
# fieldPath: string
# kind: string
# name: string
# namespace: string
# resourceVersion: string
# uid: string
# nodeDrainTimeout: string
# providerID: string
# version: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export const createPayloadData = {
id: 'e2e-pod-security-admission-1705617529465',
type: 'management.cattle.io.podsecurityadmissionconfigurationtemplate',
apiVersion: 'management.cattle.io/v3',
configuration: {
defaults: {
audit: 'baseline', 'audit-version': 'latest', enforce: 'privileged', 'enforce-version': 'latest', warn: 'restricted', 'warn-version': 'latest'
},
exemptions: {
usernames: ['admin', 'user'], runtimeClasses: ['myclass1', 'myclass2'], namespaces: ['ingress-nginx', 'kube-system']
}
},
kind: 'PodSecurityAdmissionConfigurationTemplate',
metadata: {
fields: ['e2e-pod-security-admission-1705617529465', '18s'], name: 'e2e-pod-security-admission-1705617529465', resourceVersion: '831667'
},
description: 'e2e-pod-security-admission-1705617529465-description'
};

export const updatePayloadData = {
id: 'e2e-pod-security-admission-1705628550961',
type: 'management.cattle.io.podsecurityadmissionconfigurationtemplate',
apiVersion: 'management.cattle.io/v3',
configuration: {
defaults: {
audit: 'baseline', 'audit-version': 'v1.25', enforce: 'privileged', 'enforce-version': 'v1.25', warn: 'restricted', 'warn-version': 'v1.25'
},
exemptions: {
usernames: ['admin1', 'user1'], runtimeClasses: ['myclass3', 'myclass4'], namespaces: ['cattle-system', 'cattle-epinio-system']
}
},
kind: 'PodSecurityAdmissionConfigurationTemplate',
metadata: {
fields: ['e2e-pod-security-admission-1705628550961', '7s'], name: 'e2e-pod-security-admission-1705628550961', resourceVersion: '938739'
},
description: 'e2e-pod-security-admission-1705628550961-description-edit'
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ export default class ResourceListMastheadPo extends ComponentPo {
title() {
return this.self().get('.title h1').invoke('text');
}

create() {
return this.self().find('[data-testid="masthead-create-yaml"]').click();
}
}
17 changes: 17 additions & 0 deletions cypress/e2e/po/components/cru-resource.po.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import ComponentPo from '@/cypress/e2e/po/components/component.po';
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';

export default class CruResourcePo extends ComponentPo {
selectSubType(groupIndex: number, itemIndex: number) {
return this.self().find('.subtypes-container > div')
.eq(groupIndex).find('.item')
.eq(itemIndex);
}

selectSubTypeByIndex(index: number) {
return this.self().find('.subtypes-container > div')
.eq(index);
}

saveOrCreate(): AsyncButtonPo {
return new AsyncButtonPo('[data-testid="form-save"]', this.self());
}

saveAndWaitForRequests(method: string, url: string) {
cy.intercept(method, url).as('request');
this.saveOrCreate().click();

return cy.wait('@request', { timeout: 10000 });
}
}
Loading

0 comments on commit b189f8e

Please sign in to comment.