Skip to content

Commit 9a5c6e1

Browse files
authored
Add storage type attribute to DevWorkspace configuration in API tests; fix EmptyWorkspace PR check (#23455)
* Add storage type attribute to DevWorkspace configuration in API tests * Get running devspaces-dashboard pod only * Enhance cleanup process in PR check workflow to free up disk space * Don't remove unused Docker images and containers * Set TS_SELENIUM_START_WORKSPACE_TIMEOUT=300 secs * Set MOCHA_DEFAULT_TIMEOUT=420000
1 parent 0bffc5e commit 9a5c6e1

File tree

4 files changed

+54
-9
lines changed

4 files changed

+54
-9
lines changed

.github/workflows/pr-check.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,35 @@ jobs:
120120
rm -rf assembly
121121
docker build -t quay.io/eclipse/che-e2e:"${{ env.pr_number }}" -f build/dockerfiles/Dockerfile .
122122
123-
# we have already ran API test, built test image and do not need e2e test-code, remove for saving disk space
124-
- name: Clean up resources
123+
- name: Clean up to save disk space
125124
run: |
126-
ls -la ${GITHUB_WORKSPACE}
127-
rm -rf ${GITHUB_WORKSPACE}/che
128-
docker images
125+
echo "Available space before cleanup:"
126+
df -h
127+
128+
# Clean up unused npm artifacts
129+
rm -rf node_modules
130+
npm cache clean --force
131+
132+
# Remove large packages
133+
sudo apt-get remove -y '^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' '^php.*'
134+
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel
135+
sudo apt-get autoremove -y
136+
sudo apt-get autoclean
137+
138+
# Remove large directories
139+
sudo rm -rf /usr/local/lib/android
140+
sudo rm -rf /usr/share/dotnet
141+
sudo rm -rf /opt/ghc
142+
sudo rm -rf /opt/hostedtoolcache/CodeQL
143+
144+
# we have already ran API test, built test image and do not need e2e test-code
145+
ls -la ${GITHUB_WORKSPACE}
146+
rm -rf ${GITHUB_WORKSPACE}/che
147+
148+
echo "Available space after cleanup:"
149+
df -h
150+
docker container ls
151+
docker images
129152
130153
- name: Run Empty Workspace UI test from che-e2e container
131154
run: |
@@ -140,7 +163,8 @@ jobs:
140163
-e TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=false \
141164
-e TS_SELENIUM_BASE_URL=https://$(kubectl get ingress che -n eclipse-che -o jsonpath='{.spec.rules[0].host}') \
142165
-e TS_SELENIUM_LOAD_PAGE_TIMEOUT=60000 \
143-
-e TS_SELENIUM_START_WORKSPACE_TIMEOUT=120000 \
166+
-e TS_SELENIUM_START_WORKSPACE_TIMEOUT=300000 \
167+
-e MOCHA_DEFAULT_TIMEOUT=420000 \
144168
-e TS_COMMON_DASHBOARD_WAIT_TIMEOUT=30000 \
145169
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \
146170
-e DELETE_WORKSPACE_ON_FAILED_TEST=true \

tests/e2e/constants/API_TEST_CONSTANTS.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const API_TEST_CONSTANTS: {
3535
TS_API_TEST_UDI_IMAGE: string | undefined;
3636
TS_API_TEST_NAMESPACE: string | undefined;
3737
TS_API_ACCEPTANCE_TEST_REGISTRY_URL(): string;
38+
TS_API_TEST_STORAGE_TYPE: string;
3839
} = {
3940
/**
4041
* possible values "oc" or "kubectl"
@@ -71,5 +72,7 @@ export const API_TEST_CONSTANTS: {
7172
return process.env.TS_API_ACCEPTANCE_TEST_REGISTRY_URL || '';
7273
},
7374

74-
TS_API_TEST_DEV_WORKSPACE_LIST: process.env.TS_API_TEST_DEV_WORKSPACE_LIST || undefined
75+
TS_API_TEST_DEV_WORKSPACE_LIST: process.env.TS_API_TEST_DEV_WORKSPACE_LIST || undefined,
76+
77+
TS_API_TEST_STORAGE_TYPE: process.env.TS_API_TEST_STORAGE_TYPE || 'per-user'
7578
};

tests/e2e/utils/DevWorkspaceConfigurationHelper.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ export class DevWorkspaceConfigurationHelper {
6060
if (!this.params.projects) {
6161
this.params.projects = [];
6262
}
63-
return await this.generator.generateDevfileContext(
63+
64+
const devfileContext: DevfileContext = await this.generator.generateDevfileContext(
6465
{
6566
...this.params,
6667
projects: this.params.projects
6768
},
6869
axios.default as any
6970
);
71+
72+
this.patchDevWorkspaceConfigWithStorageTypeAttribute(devfileContext);
73+
74+
return devfileContext;
7075
}
7176

7277
// write templates and then DevWorkspace in a single file
@@ -108,4 +113,17 @@ export class DevWorkspaceConfigurationHelper {
108113
controller.devfile.io/scc: container-build
109114
controller.devfile.io/storage-type: per-user`);
110115
}
116+
117+
/**
118+
* add storage type attribute to fix issue CRW-8922.
119+
*/
120+
patchDevWorkspaceConfigWithStorageTypeAttribute(
121+
devfileContextDevWorkspace: DevfileContext,
122+
storageType: string = API_TEST_CONSTANTS.TS_API_TEST_STORAGE_TYPE
123+
): void {
124+
Logger.debug();
125+
devfileContextDevWorkspace.devWorkspace?.spec?.template &&
126+
(devfileContextDevWorkspace.devWorkspace.spec.template.attributes = YAML.parse(`
127+
controller.devfile.io/storage-type: ${storageType}`));
128+
}
111129
}

tests/e2e/utils/DevfilesHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class DevfilesHelper {
6262
console.log(`command: ${command}`);
6363
const podName: string = this.getShellExecutor()
6464
.executeArbitraryShellScript(
65-
`oc get pods -n ${BASE_TEST_CONSTANTS.TS_PLATFORM}-${BASE_TEST_CONSTANTS.TESTING_APPLICATION_NAME()} | grep dashboard | awk \'{print $1}\'`
65+
`oc get pods -n ${BASE_TEST_CONSTANTS.TS_PLATFORM}-${BASE_TEST_CONSTANTS.TESTING_APPLICATION_NAME()} --field-selector status.phase=Running | grep dashboard | awk \'{print $1}\'`
6666
)
6767
.trim();
6868
const containerName: string = this.getShellExecutor().executeArbitraryShellScript(

0 commit comments

Comments
 (0)