Skip to content

Commit

Permalink
[Test] Stabilize CustomOpenVSXRegistry e2e test (#23329)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkorikSergey authored Feb 4, 2025
1 parent 99346a1 commit e9c293a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/constants/MOCHA_CONSTANTS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const MOCHA_CONSTANTS: {

MOCHA_DELAYED_SUITE: process.env.MOCHA_DELAYED_SUITE === 'true',

MOCHA_DEFAULT_TIMEOUT: Number(process.env.MOCHA_DEFAULT_TIMEOUT) || 420000,
MOCHA_DEFAULT_TIMEOUT: Number(process.env.MOCHA_DEFAULT_TIMEOUT) || 840000,

MOCHA_RETRIES: process.env.MOCHA_RETRIES || BASE_TEST_CONSTANTS.TEST_ENVIRONMENT === '' ? 0 : 2,

Expand Down
8 changes: 7 additions & 1 deletion tests/e2e/specs/miscellaneous/CustomOpenVSXRegistry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
import { DriverHelper } from '../../utils/DriverHelper';
import { error } from 'selenium-webdriver';
import { CreateWorkspace } from '../../pageobjects/dashboard/CreateWorkspace';

suite(
`Create a workspace via launching a factory from the ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL} repository`,
Expand All @@ -42,6 +43,7 @@ suite(
const appVersion: string = BASE_TEST_CONSTANTS.TESTING_APPLICATION_VERSION
? BASE_TEST_CONSTANTS.TESTING_APPLICATION_VERSION.split('.').slice(0, 2).join('.')
: 'next';
const createWorkspace: CreateWorkspace = e2eContainer.get(CLASSES.CreateWorkspace);
let currentNamespace: string | undefined = '';
let cheClusterNamespace: string | undefined = '';
let cheClusterName: string | undefined = '';
Expand All @@ -56,6 +58,7 @@ suite(
await browserTabsUtil.navigateTo(
FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL() || 'https://github.com/redhat-developer/devspaces/'
);
await createWorkspace.performTrustAuthorPopup();
});

test('Obtain workspace name from workspace loader page', async function (): Promise<void> {
Expand Down Expand Up @@ -112,7 +115,7 @@ suite(
const commandToBuildCustomVSXImage: string = `cd ${pathToPluginRegistry} && yes | ./build.sh`;
const commandLoginIntoInternalRegistry: string =
'podman login -u $(oc whoami | tr -d :) -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000';
const retagImageCommand: string = `podman tag quay.io/devspaces/pluginregistry-rhel8:next ${internalRegistry}/${currentNamespace}/che-plugin-registry:${appVersion}`;
const retagImageCommand: string = `podman tag quay.io/devspaces/pluginregistry-rhel9:next ${internalRegistry}/${currentNamespace}/che-plugin-registry:${appVersion}`;

const output: ShellString = kubernetesCommandLineToolsExecutor.execInContainerCommand(commandToBuildCustomVSXImage);
expect(output.code).equals(0);
Expand All @@ -130,6 +133,8 @@ suite(

test('Configure Che to use the embedded Eclipse Open VSX server', function (): void {
// create secret for using internal registry
kubernetesCommandLineToolsExecutor.execInContainerCommand(`oc delete secret regcred -n ${cheClusterNamespace} || true`);

const createRegistrySecretCommand: string = `oc create secret -n ${cheClusterNamespace} docker-registry regcred --docker-server=${internalRegistry} --docker-username=\$(oc whoami | tr -d :) --docker-password=\$(oc whoami -t)`;
const createSecretOutput: string = kubernetesCommandLineToolsExecutor.execInContainerCommand(createRegistrySecretCommand);
expect(createSecretOutput).contains('regcred created');
Expand Down Expand Up @@ -194,6 +199,7 @@ suite(
});

suiteTeardown('Clean up resources and restore default CHE cluster CR', async function (): Promise<void> {
kubernetesCommandLineToolsExecutor.getPodAndContainerNames();
try {
kubernetesCommandLineToolsExecutor.execInContainerCommand(`oc delete secret regcred -n ${cheClusterNamespace}`);
} catch (error) {
Expand Down

0 comments on commit e9c293a

Please sign in to comment.