Skip to content

Commit

Permalink
Revert "fix: update run devfile acceptance test command in package.js…
Browse files Browse the repository at this point in the history
…on (#22624)"

This reverts commit f98fe6d.
  • Loading branch information
mdolhalo committed Oct 30, 2023
1 parent 9dab095 commit 71c1b4f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 138 deletions.
81 changes: 0 additions & 81 deletions tests/e2e/configs/sh-scripts/runDevfileAcceptanceTests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test-docker-mount-e2e": "npm run cleanup-docker && docker run -it --shm-size=2g -p 5920:5920 --name selenium-e2e -e TS_SELENIUM_BASE_URL=$TS_SELENIUM_BASE_URL -v $(pwd):/tmp/e2e:Z eclipse/che-e2e:nightly",
"test-all-devfiles": " ./configs/sh-scripts/initDefaultValues.sh && ./configs/sh-scripts/initDevfileTests.sh",
"functional-test-suite": "configs/sh-scripts/runFunctionalTests.sh",
"devfile-acceptance-test-suite": "configs/sh-scripts/runDevfileAcceptanceTests.sh"
"devfile-acceptance-test-suite": "./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export TS_USE_WEB_DRIVER_FOR_TEST=false && mocha 'dist/specs/api/*.js' --config dist/configs/mocharc.js --delay --grep 'Devfile acceptance test suite'"
},
"author": "Ihor Okhrimenko ([email protected])",
"license": "ISC",
Expand Down
6 changes: 1 addition & 5 deletions tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { CLASSES } from '../../configs/inversify.types';
import { DevfilesRegistryHelper } from '../../utils/DevfilesRegistryHelper';
import { MOCHA_CONSTANTS } from '../../constants/MOCHA_CONSTANTS';
import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS';
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';

/**
* dynamically generating tests
Expand All @@ -29,10 +28,7 @@ void (async function (): Promise<void> {
const devfilesRegistryHelper: DevfilesRegistryHelper = e2eContainer.get(CLASSES.DevfilesRegistryHelper);

let devfileSamples: any = [];
if (
MOCHA_CONSTANTS.MOCHA_DELAYED_SUITE &&
!API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL().includes(BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL)
) {
if (MOCHA_CONSTANTS.MOCHA_DELAYED_SUITE && API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()) {
devfileSamples = await devfilesRegistryHelper.collectPathsToDevfilesFromRegistry(false);
}
for (const devfileSample of devfileSamples) {
Expand Down

This file was deleted.

80 changes: 39 additions & 41 deletions tests/e2e/utils/DevfilesRegistryHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,56 +28,54 @@ export class DevfilesRegistryHelper {
async getGitHubCheDevfileRegistryContent(): Promise<AxiosResponse> {
Logger.trace();

const url: string =
API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL() === ''
? SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL
: API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL();
return await this.getContent(url);
return await this.getContent(SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL);
}

async collectPathsToDevfilesFromRegistry(isInbuilt: boolean, sampleNamePatterns?: string[]): Promise<object[]> {
async collectPathsToDevfilesFromRegistry(isInbuilt: boolean = true, sampleNamePatterns?: string[]): Promise<object[]> {
Logger.debug();

const devfileSamples: object[] = [];
const sampleNames: string[] = [];
if (!isInbuilt) {
{
const content: any[any] = await this.getGitHubCheDevfileRegistryContent();
content.forEach((e: any): void => {
if (e.name[0] !== '.') {
sampleNames.push(e.name);
}
});

for (const sample of sampleNames) {
const sampleEndpoint: string = `${SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL}${sample}/meta.yaml`;
const sampleEndpointContent: AxiosResponse = await this.getContent(sampleEndpoint);
const decodedFileContent: string = Buffer.from((sampleEndpointContent as any).content, 'base64').toString();
const metaYamlContent: any = YAML.parse(decodedFileContent);
devfileSamples.push({
name: sample,
link: metaYamlContent.links.v2
switch (isInbuilt) {
case false:
{
const content: any[any] = await this.getGitHubCheDevfileRegistryContent();
content.forEach((e: any): void => {
if (e.name[0] !== '.') {
sampleNames.push(e.name);
}
});

for (const sample of sampleNames) {
const sampleEndpoint: string = `${SUPPORTED_DEVFILE_REGISTRIES.GIT_HUB_CHE_DEVFILE_REGISTRY_URL}${sample}/meta.yaml`;
const sampleEndpointContent: AxiosResponse = await this.getContent(sampleEndpoint);
const decodedFileContent: string = Buffer.from((sampleEndpointContent as any).content, 'base64').toString();
const metaYamlContent: any = YAML.parse(decodedFileContent);
devfileSamples.push({
name: sample,
link: metaYamlContent.links.v2
});
}
Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
}
Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
}
} else if (isInbuilt) {
{
const content: any[any] = await this.getInbuiltDevfilesRegistryContent(sampleNamePatterns);
for (const sample of content) {
const linkToDevWorkspaceYaml: any =
BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL +
'/devfile-registry' +
sample.links.devWorkspaces['che-incubator/che-code/latest'];
devfileSamples.push({
name: sample.displayName,
devWorkspaceConfigurationString: await this.getContent(linkToDevWorkspaceYaml)
});
break;
case true:
{
const content: any[any] = await this.getInbuiltDevfilesRegistryContent(sampleNamePatterns);
for (const sample of content) {
const linkToDevWorkspaceYaml: any =
BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL +
'/devfile-registry' +
sample.links.devWorkspaces['che-incubator/che-code/latest'];
devfileSamples.push({
name: sample.displayName,
devWorkspaceConfigurationString: await this.getContent(linkToDevWorkspaceYaml)
});
}
Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
}
Logger.debug(`samples list: ${JSON.stringify(devfileSamples)}`);
}
} else {
{
break;
default: {
Logger.error(`unsupported registry url - ${API_TEST_CONSTANTS.TS_API_ACCEPTANCE_TEST_REGISTRY_URL()}\n
supported registries: ${JSON.stringify(SUPPORTED_DEVFILE_REGISTRIES)}`);
}
Expand Down

0 comments on commit 71c1b4f

Please sign in to comment.