Skip to content
This repository was archived by the owner on Apr 30, 2023. It is now read-only.

Commit c1c2de3

Browse files
authored
Merge branch 'master' into update.cypress.Dockerfile
2 parents aae5e7d + 7579e90 commit c1c2de3

15 files changed

+340
-22
lines changed

.github/workflows/mergeToMaster.yaml renamed to .github/workflows/mergeToSelectedBranches.yaml

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: Build and push on merge to master
1+
name: Build and push on merge to selected branches
22

33
on:
44
push:
55
branches:
66
- master
7+
- wizard
78

89
jobs:
910
build:
@@ -12,13 +13,23 @@ jobs:
1213
- name: Set environment variables
1314
run: |
1415
echo "NODE_OPTIONS=--max-old-space-size=8192" >> $GITHUB_ENV
16+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
17+
echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
1518
echo "REACT_APP_GIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
1619
echo "REACT_APP_VERSION=${{ env.GIT_TAG }}" >> $GITHUB_ENV
17-
- name: Get tag
18-
id: get_tag
19-
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
20-
- run: |
21-
echo Detected GIT_TAG: ${GIT_TAG}
20+
- name: Set IMAGE_TAGS env variable
21+
if: github.ref == 'refs/heads/master'
22+
run: |
23+
echo "IMAGE_TAGS=latest,${{ github.sha }},${GITHUB_REF#refs/heads/}-${{ github.sha }}" >> $GITHUB_ENV
24+
- name: Set IMAGE_TAGS env variable
25+
if: github.ref != 'refs/heads/master'
26+
run: |
27+
echo "IMAGE_TAGS=${{ github.sha }},${GITHUB_REF#refs/heads/}-${{ github.sha }}" >> $GITHUB_ENV
28+
- name: Read environment variables
29+
run: |
30+
echo BRANCH: ${BRANCH}
31+
echo GIT_TAG: ${GIT_TAG}
32+
echo IMAGE_TAGS: ${IMAGE_TAGS}
2233
echo NODE_OPTIONS: ${NODE_OPTIONS}
2334
echo REACT_APP_GIT_SHA: ${REACT_APP_GIT_SHA}
2435
echo REACT_APP_VERSION: ${REACT_APP_VERSION}
@@ -44,7 +55,7 @@ jobs:
4455
password: ${{ secrets.QUAYIO_OCPMETAL_PASSWORD }}
4556
registry: quay.io
4657
dockerfile: Dockerfile
47-
tags: 'latest,${{ github.sha }}'
58+
tags: '${{ env.IMAGE_TAGS }}'
4859
- name: Publish integration tests to quay.io
4960
uses: elgohr/Publish-Docker-Github-Action@2.14
5061
with:
@@ -53,4 +64,4 @@ jobs:
5364
password: ${{ secrets.QUAYIO_OCPMETAL_PASSWORD }}
5465
registry: quay.io
5566
dockerfile: Dockerfile.cypress
56-
tags: 'latest,${{ github.sha }}'
67+
tags: '${{ env.IMAGE_TAGS }}'

.github/workflows/pullRequest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build on pull request to master
33
on:
44
pull_request:
55
branches:
6-
- master
6+
- "*"
77

88
jobs:
99
build:

CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
* @mareklibra @jtomasek @rawagner @irosenzw
22

3-
/cypress @mareklibra @jtomasek @gamli75 @lalon4 @ukalifon @yobshans @cdvultur @nshidlin @achuzhoy
3+
/cypress @mareklibra @jtomasek @gamli75 @lalon4 @ukalifon @yobshans @cdvultur @nshidlin @achuzhoy @hardengl

cypress/integration/shared/clusterConfiguration.ts

+153
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import {
22
DEFAULT_SAVE_BUTTON_TIMEOUT,
33
HOST_REGISTRATION_TIMEOUT,
44
VALIDATE_CHANGES_TIMEOUT,
5+
HOSTS_DISCOVERY_TIMEOUT,
6+
HOST_DISCOVERY_TIMEOUT,
57
} from './constants';
8+
9+
import { makeApiCall, clusterIdFromUrl } from './common';
10+
611
import { DNS_DOMAIN_NAME, NUM_MASTERS, NUM_WORKERS } from './variables';
712

813
export const hostDetailSelector = (shiftedRowIndex: number, label: string) =>
@@ -78,6 +83,40 @@ export const waitForHostTablePopulation = (
7883
});
7984
};
8085

86+
export const waitForHostsSubnet = (cy: Cypress.cy) => {
87+
// wait until hosts subnet populated in the cluster details
88+
cy.get('#form-input-hostSubnet-field')
89+
.find('option', { timeout: HOST_DISCOVERY_TIMEOUT })
90+
.should(($els) => {
91+
expect($els.length).to.be.gt(0);
92+
})
93+
.and(($els) => {
94+
expect($els[0]).not.to.have.text('No subnets available');
95+
});
96+
};
97+
98+
export const waitForHostsToBeReady = (
99+
cy: Cypress.cy,
100+
numMasters = NUM_MASTERS,
101+
numWorkers = NUM_WORKERS,
102+
) => {
103+
// wait until hosts are getting to pending input state
104+
for (let i = 2; i <= numMasters + numWorkers + 1; i++) {
105+
cy.contains(hostDetailSelector(i, 'Status'), 'Ready', {
106+
timeout: HOSTS_DISCOVERY_TIMEOUT,
107+
});
108+
}
109+
};
110+
111+
export const setClusterSubnetCidr = (cy: Cypress.cy) => {
112+
// select the first subnet from list
113+
cy.get('#form-input-hostSubnet-field')
114+
.find('option')
115+
.then(($els) => $els.get(1).setAttribute('selected', 'selected'))
116+
.parent()
117+
.trigger('change');
118+
};
119+
81120
export const setHostsRole = (
82121
cy: Cypress.cy,
83122
masterHostnamePrefix: string,
@@ -100,3 +139,117 @@ export const setHostsRole = (
100139
cy.get(`ul[aria-labelledby=${toggleSelector}] > li#worker`).click();
101140
}
102141
};
142+
143+
export const getDhcpVipState = (cy: Cypress.cy) => {
144+
return new Cypress.Promise((resolve, reject) => {
145+
clusterIdFromUrl(cy).then((id) => {
146+
const readDhcpAllocation = (response) => {
147+
resolve(response.body.vip_dhcp_allocation);
148+
};
149+
150+
makeApiCall(`/api/assisted-install/v1/clusters/${id}`, 'GET', readDhcpAllocation);
151+
});
152+
});
153+
};
154+
155+
export const disableDhcpVip = (cy: Cypress.cy, apiVip = null, ingressVip = null) => {
156+
getDhcpVipState(cy).then((state) => {
157+
if (state) {
158+
cy.get('#form-input-vipDhcpAllocation-field').click();
159+
}
160+
});
161+
162+
if (apiVip) {
163+
cy.get('#form-input-apiVip-field').clear();
164+
cy.get('#form-input-apiVip-field').type(apiVip);
165+
}
166+
if (ingressVip) {
167+
cy.get('#form-input-ingressVip-field').clear();
168+
cy.get('#form-input-ingressVip-field').type(ingressVip);
169+
}
170+
};
171+
172+
export const enableDhcpVip = (cy: Cypress.cy) => {
173+
getDhcpVipState(cy).then((state) => {
174+
if (!state) {
175+
cy.get('#form-input-vipDhcpAllocation-field').click();
176+
}
177+
});
178+
};
179+
180+
export const getAdvancedNetworkingState = (cy: Cypress.cy) => {
181+
return new Cypress.Promise((resolve, reject) => {
182+
clusterIdFromUrl(cy).then((id) => {
183+
const advancedNetworkingState = (response) => {
184+
// the advanced networking checkbox in the GUI is off when the
185+
// settings are the following hardcoded values:
186+
// clusterCidr = 10.128.0.0/14
187+
// networkPrefix = 23
188+
// serviceCidr = 172.30.0.0/16
189+
if (
190+
response.body.service_network_cidr == '172.30.0.0/16' &&
191+
response.body.cluster_network_cidr == '10.128.0.0/14' &&
192+
response.body.cluster_network_host_prefix == '23'
193+
) {
194+
resolve(false);
195+
} else {
196+
resolve(true); // GUI shows advanced networking enabled
197+
}
198+
};
199+
200+
makeApiCall(`/api/assisted-install/v1/clusters/${id}`, 'GET', advancedNetworkingState);
201+
});
202+
});
203+
};
204+
205+
export const enableAdvancedNetworking = (
206+
cy: Cypress.cy,
207+
clusterCidr = null,
208+
networkPrefix = null,
209+
serviceCidr = null,
210+
) => {
211+
getAdvancedNetworkingState(cy).then((state) => {
212+
if (!state) {
213+
cy.get('#useAdvancedNetworking').click();
214+
cy.get('#useAdvancedNetworking').should('have.prop', 'checked');
215+
}
216+
});
217+
cy.get('#form-input-serviceNetworkCidr-field').click(); // just to scroll to it
218+
cy.get('#form-input-clusterNetworkCidr-field').should('be.visible');
219+
cy.get('#form-input-clusterNetworkHostPrefix-field').should('be.visible');
220+
cy.get('#form-input-serviceNetworkCidr-field').should('be.visible');
221+
222+
if (clusterCidr) {
223+
cy.get('#form-input-clusterNetworkCidr-field').clear();
224+
cy.get('#form-input-clusterNetworkCidr-field').type(clusterCidr);
225+
}
226+
227+
if (serviceCidr) {
228+
cy.get('#form-input-serviceNetworkCidr-field').clear();
229+
cy.get('#form-input-serviceNetworkCidr-field').type(serviceCidr);
230+
}
231+
232+
if (networkPrefix) {
233+
cy.get('#form-input-clusterNetworkHostPrefix-field').clear();
234+
cy.get('#form-input-clusterNetworkHostPrefix-field').type(networkPrefix);
235+
}
236+
};
237+
238+
export const getDomains = (cy: Cypress.cy) => {
239+
return new Cypress.Promise((resolve, reject) => {
240+
const readDomains = (response) => {
241+
resolve(response.body[0].provider);
242+
};
243+
244+
makeApiCall(`/api/assisted-install/v1/domains`, 'GET', readDomains);
245+
});
246+
};
247+
248+
export const enableRoute53 = (cy: Cypress.cy) => {
249+
cy.get('#form-input-useRedHatDnsService-field').click();
250+
getDomains(cy).then((provider) => {
251+
if (provider) {
252+
cy.get('#form-input-baseDnsDomain-field').contains(provider);
253+
}
254+
});
255+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {
2+
START_INSTALLATION_TIMEOUT,
3+
INSTALL_PREPARATION_TIMEOUT,
4+
CLUSTER_CREATION_TIMEOUT,
5+
} from './constants';
6+
7+
export const startClusterInstallation = (cy: Cypress.cy) => {
8+
// wait up to 10 seconds for the install button to be enabled
9+
cy.get('button[name="install"]', { timeout: START_INSTALLATION_TIMEOUT }).should(($elem) => {
10+
expect($elem).to.be.enabled;
11+
});
12+
cy.get('button[name="install"]').click();
13+
// wait for the progress description to say "Installing"
14+
cy.contains('#cluster-progress-status-value', 'Installing', {
15+
timeout: INSTALL_PREPARATION_TIMEOUT,
16+
});
17+
};
18+
19+
export const waitForClusterInstallation = (cy: Cypress.cy) => {
20+
// wait up to 1 hour for the progress description to say "Installed"
21+
cy.contains('#cluster-progress-status-value', 'Installed', { timeout: CLUSTER_CREATION_TIMEOUT });
22+
};

cypress/integration/shared/clusterListPage.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
HOSTS_DISCOVERY_TIMEOUT,
77
} from './constants';
88
import { TEST_INFRA_CLUSTER_NAME } from './testInfraCluster';
9-
import { OCM_USER } from './variables';
9+
import { OCM_USER, OPENSHIFT_VERSION } from './variables';
1010

1111
// Selectors
1212
export const getClusterNameLinkSelector = (clusterName: string) => `#cluster-link-${clusterName}`;
@@ -49,6 +49,7 @@ export const createClusterFillForm = (cy: Cypress.cy, clusterName: string, pullS
4949
// type correct dummy cluster name
5050
cy.get('#form-input-name-field').type(`{selectall}{backspace}${clusterName}`);
5151
cy.get('#form-input-name-field').should('have.value', clusterName);
52+
cy.get('#form-input-openshiftVersion-field').select(OPENSHIFT_VERSION);
5253
if (!OCM_USER) {
5354
cy.get('#form-input-pullSecret-field').clear();
5455
pasteText(cy, '#form-input-pullSecret-field', pullSecret);

0 commit comments

Comments
 (0)