Skip to content

Commit

Permalink
Fix devfile API tests to run against Eclipse Che with default environ…
Browse files Browse the repository at this point in the history
…ment variables; fix linter errors (#23320)

* Fix devfile API tests to run against Eclipse Che with default environment variables

* Fix linter error: 'numberOfCreatedWorkspaces' is assigned a value but never used

* Fix linter error: 'workspaces' is assigned a value but never used

---------

Signed-off-by: Dmytro Nochevnov <[email protected]>
  • Loading branch information
dmytro-ndp authored Jan 28, 2025
1 parent 0bc1c58 commit 46fa921
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/CppDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ suite('Cpp devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/DotnetDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('Dotnet devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/GoDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ suite('Go devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/JBossEapDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('JBoss EAP devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/LombokDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('Lombok devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/NodeJSMongoDBDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('NodeJS MongoDB devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/NodeJsExpressDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('NodeJS Express devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/PhpDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('PHP devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/PythonDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ suite('Python devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/api/QuarkusDevFileAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('Quarkus devfile API test', function (): void {

test(`Create ${devfileID} workspace`, async function (): Promise<void> {
const randomPref: string = crypto.randomBytes(4).toString('hex');
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || 'admin-devspaces';
kubernetesCommandLineToolsExecutor.namespace = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE;
devfileContent = devfilesRegistryHelper.getDevfileContent(devfileID);
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions');
devfileName = YAML.parse(devfileContent).metadata.name;
Expand Down
9 changes: 0 additions & 9 deletions tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTes
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
import { DriverHelper } from '../../utils/DriverHelper';
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
import { Logger } from '../../utils/Logger';
import { LoginTests } from '../../tests-library/LoginTests';
import { FACTORY_TEST_CONSTANTS, GitProviderType } from '../../constants/FACTORY_TEST_CONSTANTS';
Expand All @@ -53,7 +52,6 @@ suite(
const webCheCodeLocators: Locators = cheCodeLocatorLoader.webCheCodeLocators;
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
const createWorkspace: CreateWorkspace = e2eContainer.get(CLASSES.CreateWorkspace);
Expand All @@ -65,7 +63,6 @@ suite(
let viewsActionsButton: boolean;

// test specific data
let numberOfCreatedWorkspaces: number = 0;
const timeToRefresh: number = 1500;
const changesToCommit: string = new Date().getTime().toString();
const fileToChange: string = 'Date.txt';
Expand All @@ -80,12 +77,6 @@ suite(
await loginTests.loginIntoChe();
});

test('Get number of previously created workspaces', async function (): Promise<void> {
await dashboard.clickWorkspacesButton();
await workspaces.waitPage();
numberOfCreatedWorkspaces = (await workspaces.getAllCreatedWorkspacesNames()).length;
});

test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL());
await createWorkspace.performTrustAuthorPopup();
Expand Down

0 comments on commit 46fa921

Please sign in to comment.