From dc032a160c8fe2a00b7bc2e9f95983b4acbd4a29 Mon Sep 17 00:00:00 2001 From: Flavius Lacatusu Date: Fri, 15 Jan 2021 11:35:21 +0100 Subject: [PATCH] feat: Add quarkus devfile to e2e tests and rename codecov.yml workflow (#1064) * feat: Add devfile to e2e tests Signed-off-by: Flavius Lacatusu * Fix Signed-off-by: Flavius Lacatusu * fix Signed-off-by: Flavius Lacatusu --- .github/workflows/codecov.yml | 16 +++++++++++++--- README.md | 2 +- package.json | 4 +++- test/e2e/e2e.test.ts | 6 ++++-- test/e2e/resources/devfile-example.yaml | 3 --- test/e2e/util.ts | 7 ++++--- 6 files changed, 25 insertions(+), 13 deletions(-) delete mode 100644 test/e2e/resources/devfile-example.yaml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index b22e899ea..ede39122d 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -1,9 +1,19 @@ -name: chectl +# +# Copyright (c) 2012-2021 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +name: Code Coverage Report on: [push] jobs: - build-and-deploy: + code-coverage-report: runs-on: ubuntu-20.04 - name: Code coverage steps: - name: Checkout uses: actions/checkout@v2.3.1 diff --git a/README.md b/README.md index 6787dc6ae..810de184c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ chectl [Eclipse Che](https://github.com/eclipse/che/) CLI [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) -[![Codecov](https://img.shields.io/codecov/c/github/che-incubator/chectl)](https://github.com/che-incubator/chectl) +[![codecov](https://codecov.io/gh/che-incubator/chectl/branch/master/graph/badge.svg?token=ZBQtKMeiYu)](https://codecov.io/gh/che-incubator/chectl) [![Build Status](https://travis-ci.org/che-incubator/chectl.svg?branch=master)](https://travis-ci.org/che-incubator/chectl) ![](https://img.shields.io/david/che-incubator/chectl.svg) diff --git a/package.json b/package.json index a3139e71f..6d0cdc046 100644 --- a/package.json +++ b/package.json @@ -161,7 +161,9 @@ "types": "lib/index.d.ts", "jest": { "collectCoverage": true, - "coverageReporters": ["json"], + "coverageReporters": [ + "json" + ], "collectCoverageFrom": [ "src/**/*.ts" ], diff --git a/test/e2e/e2e.test.ts b/test/e2e/e2e.test.ts index 6ca317ac1..5f4f326c4 100644 --- a/test/e2e/e2e.test.ts +++ b/test/e2e/e2e.test.ts @@ -37,6 +37,8 @@ const INSTALLER_OPERATOR = 'operator' const INSTALLER_HELM = 'helm' const INSTALLER_OLM = 'olm' +const DEVFILE_URL = 'https://raw.githubusercontent.com/eclipse/che-devfile-registry/master/devfiles/quarkus/devfile.yaml' + function getDeployCommand(): string { let command: string switch (PLATFORM) { @@ -148,7 +150,7 @@ describe('Workspace creation, list, start, inject, delete. Support stop and dele it('Testing workspace:create command', async () => { console.log('>>> Testing workspace:create command') - const { exitCode, stdout, stderr, } = await execa(binChectl, ['workspace:create', '--devfile=test/e2e/resources/devfile-example.yaml', '--telemetry=off', `-n ${NAMESPACE}`], { shell: true }) + const { exitCode, stdout, stderr, } = await execa(binChectl, ['workspace:create', `--devfile=${DEVFILE_URL}`, '--telemetry=off', `-n ${NAMESPACE}`], { shell: true }) console.log(`stdout: ${stdout}`) console.log(`stderr: ${stderr}`) expect(exitCode).equal(0) @@ -167,7 +169,7 @@ describe('Workspace creation, list, start, inject, delete. Support stop and dele expect(exitCode).equal(0) // Sleep time to wait to workspace to be running - await helper.sleep(200000) + await helper.sleep(300000) const workspaceStatus = await helper.getWorkspaceStatus() expect(workspaceStatus).to.contain('RUNNING') }) diff --git a/test/e2e/resources/devfile-example.yaml b/test/e2e/resources/devfile-example.yaml deleted file mode 100644 index 25bb828b9..000000000 --- a/test/e2e/resources/devfile-example.yaml +++ /dev/null @@ -1,3 +0,0 @@ -metadata: - name: e2e-tests -apiVersion: 1.0.0 diff --git a/test/e2e/util.ts b/test/e2e/util.ts index 6c016aa11..176eb1e64 100644 --- a/test/e2e/util.ts +++ b/test/e2e/util.ts @@ -35,7 +35,8 @@ export class E2eHelper { constructor() { this.kubeHelper = new KubeHelper({}) this.che = new CheHelper({}) - this.devfileName = 'e2e-tests' + // generate-name from https://raw.githubusercontent.com/eclipse/che-devfile-registry/master/devfiles/quarkus/devfile.yaml + this.devfileName = 'quarkus-' this.oc = new OpenShiftHelper() } @@ -62,7 +63,7 @@ export class E2eHelper { // Return id of test workspaces(e2e-tests. Please look devfile-example.yaml file) async getWorkspaceId(): Promise { const workspaces = await this.getAllWorkspaces() - const workspaceId = workspaces.filter((wks => wks.name === this.devfileName)).map(({ id }) => id)[0] + const workspaceId = workspaces.filter((wks => wks.name.match(this.devfileName))).map(({ id }) => id)[0] if (!workspaceId) { throw Error('Error getting workspaceId') @@ -74,7 +75,7 @@ export class E2eHelper { // Return the status of test workspaces(e2e-tests. Please look devfile-example.yaml file) async getWorkspaceStatus(): Promise { const workspaces = await this.getAllWorkspaces() - const workspaceStatus = workspaces.filter((wks => wks.name === this.devfileName)).map(({ status }) => status)[0] + const workspaceStatus = workspaces.filter((wks => wks.name.match(this.devfileName))).map(({ status }) => status)[0] if (!workspaceStatus) { throw Error('Error getting workspace_id')